From 2cdd37023cf53fa60302e7ffe26d912d891d62c4 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 11 May 2001 18:46:10 +0000 Subject: Don't allow multiple copies of this to be run at a time. 2001-05-11 Jeffrey Stedfast * mail-vfolder.c (vfolder_edit): Don't allow multiple copies of this to be run at a time. * mail-callbacks.c (providers_config): Don't allow multiple copies of this to be run at a time. (manage_subscriptions): Same, but this was a tad more kludgy since we don't gnome_dialog_run_and_close() this one. I had to make the widget a semi-global variable. yuck :\ (filter_edit): Same. svn path=/trunk/; revision=9762 --- mail/ChangeLog | 12 +++++++++ mail/mail-callbacks.c | 74 +++++++++++++++++++++++++++++++++++++++------------ mail/mail-vfolder.c | 24 ++++++++++++----- 3 files changed, 87 insertions(+), 23 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3cbecc9e56..5c1c173425 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2001-05-11 Jeffrey Stedfast + + * mail-vfolder.c (vfolder_edit): Don't allow multiple copies of + this to be run at a time. + + * mail-callbacks.c (providers_config): Don't allow multiple copies + of this to be run at a time. + (manage_subscriptions): Same, but this was a tad more kludgy since + we don't gnome_dialog_run_and_close() this one. I had to make the + widget a semi-global variable. yuck :\ + (filter_edit): Same. + 2001-05-11 Jon Trowbridge * e-searching-tokenizer.c (e_searching_tokenizer_new): diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 377cea95d0..c3223ea15e 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1407,7 +1407,8 @@ previous_unread_msg (GtkWidget *button, gpointer user_data) 0, CAMEL_MESSAGE_SEEN); } -static void expunged_folder(CamelFolder *f, void *data) +static void +expunged_folder (CamelFolder *f, void *data) { FolderBrowser *fb = data; @@ -1427,8 +1428,18 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path) } } +/********************** Begin Filter Editor ********************/ + +static GtkWidget *filter_editor = NULL; + +static void +filter_editor_destroy (GtkWidget *dialog, gpointer user_data) +{ + filter_editor = NULL; +} + static void -filter_druid_clicked (GtkWidget *dialog, int button, FolderBrowser *fb) +filter_editor_clicked (GtkWidget *dialog, int button, FolderBrowser *fb) { FilterContext *fc; @@ -1458,7 +1469,11 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) FolderBrowser *fb = FOLDER_BROWSER (user_data); FilterContext *fc; char *user, *system; - GtkWidget *dialog; + + if (filter_editor) { + /* FIXME: raise the filter_editor dialog? */ + return; + } fc = filter_context_new (); user = g_strdup_printf ("%s/filters.xml", evolution_dir); @@ -1467,6 +1482,7 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) g_free (user); if (((RuleContext *)fc)->error) { + GtkWidget *dialog; gchar *err; err = g_strdup_printf (_("Error loading filter information:\n%s"), @@ -1478,14 +1494,17 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) return; } - dialog = (GtkWidget *)filter_editor_new (fc, filter_source_names); - gtk_window_set_title (GTK_WINDOW (dialog), _("Filters")); - - gtk_object_set_data_full (GTK_OBJECT (dialog), "context", fc, (GtkDestroyNotify)gtk_object_unref); - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", filter_druid_clicked, fb); - gtk_widget_show (GTK_WIDGET (dialog)); + filter_editor = (GtkWidget *)filter_editor_new (fc, filter_source_names); + gtk_window_set_title (GTK_WINDOW (filter_editor), _("Filters")); + + gtk_object_set_data_full (GTK_OBJECT (filter_editor), "context", fc, (GtkDestroyNotify)gtk_object_unref); + gtk_signal_connect (GTK_OBJECT (filter_editor), "clicked", filter_editor_clicked, fb); + gtk_signal_connect (GTK_OBJECT (filter_editor), "destroy", filter_editor_destroy, NULL); + gtk_widget_show (GTK_WIDGET (filter_editor)); } +/********************** End Filter Editor ********************/ + void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path) { @@ -1495,11 +1514,15 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path void providers_config (BonoboUIComponent *uih, void *user_data, const char *path) { - /* FIXME: should we block until mail-config is done? */ - MailAccountsDialog *dialog; + static MailAccountsDialog *dialog = NULL; - dialog = mail_accounts_dialog_new ((FOLDER_BROWSER (user_data))->shell); - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + if (!dialog) { + dialog = mail_accounts_dialog_new ((FOLDER_BROWSER (user_data))->shell); + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + dialog = NULL; + } else { + /* FIXME: raise the dialog? */ + } } /* @@ -1601,15 +1624,32 @@ print_preview_msg (GtkWidget *button, gpointer user_data) mail_print_preview_msg (fb->mail_display); } +/******************** Begin Subscription Dialog ***************************/ + +static GtkWidget *subscribe_dialog = NULL; + +static void +subscribe_dialog_destroy (GtkWidget *widget, gpointer user_data) +{ + subscribe_dialog = NULL; +} + void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path) { - /* XXX pass in the selected storage */ - GtkWidget *subscribe = subscribe_dialog_new ((FOLDER_BROWSER (user_data))->shell); - - gtk_widget_show (subscribe); + if (!subscribe_dialog) { + subscribe_dialog = subscribe_dialog_new ((FOLDER_BROWSER (user_data))->shell); + gtk_signal_connect (GTK_OBJECT (subscribe_dialog), "destroy", + subscribe_dialog_destroy, NULL); + + gtk_widget_show (subscribe_dialog); + } else { + /* FIXME: raise the subscription dialog window... */ + } } +/******************** End Subscription Dialog ***************************/ + void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path) { diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 8642993ae2..39753a5cf1 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -349,6 +349,14 @@ vfolder_uri_to_folder(const char *uri, CamelException *ex) return folder; } +static GtkWidget *vfolder_editor = NULL; + +static void +vfolder_editor_destroy (GtkWidget *widget, gpointer user_data) +{ + vfolder_editor = NULL; +} + static void vfolder_editor_clicked(GtkWidget *w, int button, void *data) { @@ -366,13 +374,17 @@ vfolder_editor_clicked(GtkWidget *w, int button, void *data) } void -vfolder_edit(void) +vfolder_edit (void) { - GtkWidget *w; - - w = GTK_WIDGET (vfolder_editor_new (context)); - gtk_signal_connect (GTK_OBJECT (w), "clicked", vfolder_editor_clicked, NULL); - gtk_widget_show (w); + if (vfolder_editor) { + /* FIXME: raise the vfolder editor window? */ + return; + } + + vfolder_editor = GTK_WIDGET (vfolder_editor_new (context)); + gtk_signal_connect (GTK_OBJECT (vfolder_editor), "clicked", vfolder_editor_clicked, NULL); + gtk_signal_connect (GTK_OBJECT (vfolder_editor), "destroy", vfolder_editor_destroy, NULL); + gtk_widget_show (vfolder_editor); } static void -- cgit