claws-mail/src/setup.c
Colin Leroy 8dc0029409 2008-09-09 [colin] 3.5.0cvs96
* src/action.h
	* src/addr_compl.c
	* src/addressadd.c
	* src/addressbook.h
	* src/addressbook_foldersel.c
	* src/addressitem.h
	* src/addrgather.c
	* src/alertpanel.c
	* src/browseldap.c
	* src/editaddress.c
	* src/editaddress_other_attributes_ldap.h
	* src/editbook.c
	* src/editjpilot.c
	* src/editldap.c
	* src/editldap_basedn.c
	* src/editvcard.c
	* src/exphtmldlg.c
	* src/expldifdlg.c
	* src/export.c
	* src/foldersel.c
	* src/foldersel.h
	* src/gedit-print.c
	* src/gedit-print.h
	* src/grouplistdialog.c
	* src/headerview.c
	* src/headerview.h
	* src/image_viewer.c
	* src/import.c
	* src/importldif.c
	* src/importmutt.c
	* src/importpine.c
	* src/inc.c
	* src/main.c
	* src/main.h
	* src/messageview.c
	* src/messageview.h
	* src/noticeview.c
	* src/prefs_actions.c
	* src/prefs_filtering.c
	* src/prefs_folder_column.c
	* src/prefs_gtk.h
	* src/prefs_summary_column.c
	* src/prefs_toolbar.c
	* src/send_message.c
	* src/setup.c
	* src/sourcewindow.c
	* src/sourcewindow.h
	* src/ssl_manager.c
	* src/statusbar.c
	* src/statusbar.h
	* src/stock_pixmap.c
	* src/stock_pixmap.h
	* src/summaryview.c
	* src/textview.c
	* src/textview.h
	* src/undo.h
	* src/uri_opener.c
	* src/wizard.c
	* src/wizard.h
	* src/common/ssl.h
	* src/common/utils.c
	* src/gtk/about.c
	* src/gtk/colorlabel.c
	* src/gtk/colorlabel.h
	* src/gtk/combobox.h
	* src/gtk/description_window.c
	* src/gtk/filesel.c
	* src/gtk/gtkaspell.c
	* src/gtk/gtkaspell.h
	* src/gtk/gtkcmclist.c
	* src/gtk/gtkcmclist.h
	* src/gtk/gtkcmctree.c
	* src/gtk/gtkcmctree.h
	* src/gtk/gtkcmoptionmenu.h
	* src/gtk/gtksctree.c
	* src/gtk/gtksctree.h
	* src/gtk/gtkshruler.c
	* src/gtk/gtkshruler.h
	* src/gtk/gtksourceprintjob.c
	* src/gtk/gtksourceprintjob.h
	* src/gtk/gtkutils.c
	* src/gtk/gtkutils.h
	* src/gtk/gtkvscrollbutton.c
	* src/gtk/gtkvscrollbutton.h
	* src/gtk/icon_legend.c
	* src/gtk/inputdialog.c
	* src/gtk/logwindow.c
	* src/gtk/logwindow.h
	* src/gtk/manage_window.c
	* src/gtk/manage_window.h
	* src/gtk/menu.c
	* src/gtk/prefswindow.c
	* src/gtk/progressdialog.c
	* src/gtk/progressdialog.h
	* src/plugins/bogofilter/bogofilter_gtk.c
	* src/plugins/pgpcore/passphrase.c
	* src/plugins/spamassassin/spamassassin_gtk.c
	* src/plugins/trayicon/trayicon.c
	* src/plugins/trayicon/libeggtrayicon/eggtrayicon.c
	* src/plugins/trayicon/libeggtrayicon/eggtrayicon.h
	* src/plugins/trayicon/libeggtrayicon/gtk2-funcs.c
	* src/plugins/trayicon/libeggtrayicon/gtkplugxembed.c
	* src/plugins/trayicon/libeggtrayicon/gtkplugxembed.h
		Complete GTK+ 2.14 undeprecation
2008-09-09 16:40:59 +00:00

108 lines
3 KiB
C

/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "inputdialog.h"
#include "alertpanel.h"
#include "mainwindow.h"
#include "gtkutils.h"
#include "mh.h"
#include "wizard.h"
#define SETUP_DIALOG_WIDTH 540
static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data);
gboolean setup_write_mailbox_path(MainWindow *mainwin, const gchar *path)
{
Folder *folder;
gchar *base;
if (!path) return FALSE;
if (folder_find_from_path(path)) {
g_warning("The mailbox already exists.\n");
return FALSE;
}
base = g_path_get_basename(path);
folder = folder_new(mh_get_class(), !strcmp(path, "Mail") ? _("Mailbox") : base, path);
if (folder->klass->create_tree(folder) < 0) {
alertpanel_error(_("Creation of the mailbox failed.\n"
"Maybe some files already exist, or you don't have the permission to write there."));
folder_destroy(folder);
g_free(base);
return FALSE;
}
folder_add(folder);
folder_set_ui_func(folder, scan_tree_func, mainwin);
folder_scan_tree(folder, TRUE);
folder_set_ui_func(folder, NULL, NULL);
g_free(base);
return TRUE;
}
void setup(MainWindow *mainwin)
{
gchar *path;
path = input_dialog
(_("Mailbox setting"),
_("First, you have to set the location of mailbox.\n"
"You can use existing mailbox in MH format\n"
"if you have the one.\n"
"If you're not sure, just select OK."),
"Mail");
setup_write_mailbox_path(mainwin, path);
g_free(path);
}
static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
gchar *str;
if (item->path)
str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
LOCAL_FOLDER(folder)->rootpath,
G_DIR_SEPARATOR,
item->path);
else
str = g_strdup_printf(_("Scanning folder %s ..."),
LOCAL_FOLDER(folder)->rootpath);
if (mainwin->statusbar)
gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar),
mainwin->mainwin_cid, str);
if (mainwin->hbox_stat)
gtkut_widget_draw_now(mainwin->hbox_stat);
if (mainwin->statusbar)
gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar),
mainwin->mainwin_cid);
g_free(str);
}