aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-local.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-05-12 03:50:04 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-05-12 03:50:04 +0800
commit6febeab3270c35664cc3938d4f89b9c292550040 (patch)
tree2d04c55cf7fc1674f6b5b0c19fd6cad99400f3f3 /mail/mail-local.c
parentb4796b63763b08f13aa77f51f679d0b660bf48a4 (diff)
downloadgsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar.gz
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar.bz2
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar.lz
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar.xz
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.tar.zst
gsoc2013-evolution-6febeab3270c35664cc3938d4f89b9c292550040.zip
Set a title on the window "Reconfigure %s" where %s is the folder name.
2001-05-11 Jeffrey Stedfast <fejj@ximian.com> * mail-local.c (mail_local_reconfigure_folder): Set a title on the window "Reconfigure %s" where %s is the folder name. Also, don't allow more than one of these type windows to be opened per folder. * mail-tools.c (mail_tool_get_folder_name): Fix Danw's kludge to actually work :-) svn path=/trunk/; revision=9767
Diffstat (limited to 'mail/mail-local.c')
-rw-r--r--mail/mail-local.c95
1 files changed, 62 insertions, 33 deletions
diff --git a/mail/mail-local.c b/mail/mail-local.c
index 597a17b8e1..5c27fb0e0a 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -987,67 +987,96 @@ static struct _mail_msg_op reconfigure_folder_op = {
reconfigure_folder_free,
};
+/* hash table of folders that the user has a reconfig-folder dialog for */
+static GHashTable *reconfigure_folder_hash = NULL;
+
static void
-reconfigure_clicked(GnomeDialog *d, int button, struct _reconfigure_msg *m)
+reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m)
{
if (button == 0) {
- GtkMenu *menu;
+ GtkWidget *menu;
int type;
char *types[] = { "mbox", "maildir", "mh" };
-
+
/* hack to clear the message list during update */
- message_list_set_folder(m->fb->message_list, NULL);
-
- menu = (GtkMenu *)gtk_option_menu_get_menu(m->optionlist);
- type = g_list_index(GTK_MENU_SHELL(menu)->children, gtk_menu_get_active(menu));
+ message_list_set_folder (m->fb->message_list, NULL);
+
+ menu = gtk_option_menu_get_menu (m->optionlist);
+ type = g_list_index (GTK_MENU_SHELL (menu)->children,
+ gtk_menu_get_active (GTK_MENU (menu)));
if (type < 0 || type > 2)
type = 0;
-
- gtk_widget_set_sensitive(m->frame, FALSE);
- gtk_widget_set_sensitive(m->apply, FALSE);
- gtk_widget_set_sensitive(m->cancel, FALSE);
-
+
+ gtk_widget_set_sensitive (m->frame, FALSE);
+ gtk_widget_set_sensitive (m->apply, FALSE);
+ gtk_widget_set_sensitive (m->cancel, FALSE);
+
m->newtype = g_strdup (types[type]);
- e_thread_put(mail_thread_queued, (EMsg *)m);
+ e_thread_put (mail_thread_queued, (EMsg *)m);
} else
- mail_msg_free((struct _mail_msg *)m);
-
+ mail_msg_free ((struct _mail_msg *)m);
+
if (button != -1)
- gnome_dialog_close(d);
+ gnome_dialog_close (dialog);
}
void
-mail_local_reconfigure_folder(FolderBrowser *fb)
+mail_local_reconfigure_folder (FolderBrowser *fb)
{
CamelStore *store;
GladeXML *gui;
GnomeDialog *gd;
struct _reconfigure_msg *m;
-
+ char *name, *title;
+
if (fb->folder == NULL) {
- g_warning("Trying to reconfigure nonexistant folder");
+ g_warning ("Trying to reconfigure nonexistant folder");
return;
}
-
- m = mail_msg_new(&reconfigure_folder_op, NULL, sizeof(*m));
- store = camel_folder_get_parent_store(fb->folder);
-
- gui = glade_xml_new(EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format");
+
+ if ((gd = g_hash_table_lookup (reconfigure_folder_hash, fb->folder))) {
+ /* FIXME: raise this dialog?? */
+ return;
+ }
+
+ m = mail_msg_new (&reconfigure_folder_op, NULL, sizeof (*m));
+ store = camel_folder_get_parent_store (fb->folder);
+
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format");
gd = (GnomeDialog *)glade_xml_get_widget (gui, "dialog_format");
-
+
+ name = mail_tool_get_folder_name (fb->folder);
+ title = g_strdup_printf ("Reconfigure %s", name);
+ gtk_window_set_title (GTK_WINDOW (gd), title);
+ g_free (title);
+ g_free (name);
+
m->frame = glade_xml_get_widget (gui, "frame_format");
m->apply = glade_xml_get_widget (gui, "apply_format");
m->cancel = glade_xml_get_widget (gui, "cancel_format");
m->optionlist = (GtkOptionMenu *)glade_xml_get_widget (gui, "option_format");
m->newtype = NULL;
m->fb = fb;
- gtk_object_ref((GtkObject *)fb);
-
- gtk_label_set_text((GtkLabel *)glade_xml_get_widget (gui, "label_format"),
- ((CamelService *)store)->url->protocol);
-
- gtk_signal_connect((GtkObject *)gd, "clicked", reconfigure_clicked, m);
- gtk_object_unref((GtkObject *)gui);
-
+ gtk_object_ref (GTK_OBJECT (fb));
+
+ gtk_label_set_text ((GtkLabel *)glade_xml_get_widget (gui, "label_format"),
+ ((CamelService *)store)->url->protocol);
+
+ gtk_signal_connect (GTK_OBJECT (gd), "clicked", reconfigure_clicked, m);
+ gtk_object_unref (GTK_OBJECT (gui));
+
+ if (!reconfigure_folder_hash)
+ reconfigure_folder_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ g_hash_table_insert (reconfigure_folder_hash, (gpointer) fb->folder, (gpointer) gd);
+
gnome_dialog_run_and_close (GNOME_DIALOG (gd));
+
+ /* remove this folder from our hash since we are done with it */
+ g_hash_table_remove (reconfigure_folder_hash, fb->folder);
+ if (g_hash_table_size (reconfigure_folder_hash) == 0) {
+ /* additional cleanup */
+ g_hash_table_destroy (reconfigure_folder_hash);
+ reconfigure_folder_hash = NULL;
+ }
}