claws-mail/src/setup.c
Colin Leroy 7bab9009bc 2005-06-01 [colin] 1.9.11cvs31
* src/addrharvest.c
	* src/compose.c
	* src/mbox.c
	* src/mbox.h
	* src/mh.c
	* src/msgcache.c
	* src/send_message.c
	* src/setup.c
	* src/undo.c
	* src/common/hooks.c
	* src/common/prefs.c
	* src/common/template.c
	* src/common/utils.c
	* src/gtk/gtkutils.c
	* src/gtk/inputdialog.c
	* src/gtk/menu.c
	* src/gtk/pluginwindow.c
	* src/gtk/prefswindow.c
	* src/plugins/pgpmime/passphrase.c
	* src/plugins/pgpmime/prefs_gpg.c
		More -Wall fixes

	* src/common/Makefile.am
	* src/common/timing.h
		Add basic timing code

	* src/summaryview.c
		Fix a bug with unread messages when
		re-sorting folders, and by the way
		fix a big performance hit when
		re-sorting (10k mails: before 5s,
		after .5s)

	* src/prefs_compose_writing.c
	* src/prefs_compose_writing.h
	* src/prefs_message.c
	* src/prefs_message.h
	* src/prefs_other.c
	* src/prefs_other.h
	* src/prefs_quote.c
	* src/prefs_quote.h
	* src/prefs_receive.c
	* src/prefs_receive.h
	* src/prefs_send.c
	* src/prefs_send.h
	* src/prefs_summaries.c
	* src/prefs_summaries.h
		Fix copyright banner
2005-06-01 17:44:37 +00:00

104 lines
2.9 KiB
C

/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999,2000 Hiroyuki Yamamoto
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stddef.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtkstatusbar.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);
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);
gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar),
mainwin->mainwin_cid, str);
gtkut_widget_draw_now(mainwin->hbox_stat);
gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar),
mainwin->mainwin_cid);
g_free(str);
}