From cca23c1566c899885baa3758817173aca71c09c8 Mon Sep 17 00:00:00 2001 From: 1 Date: Fri, 21 Sep 2001 23:12:44 +0000 Subject: If we have an operation that failed before, dont show the dialogue for the 2001-09-21 * mail-mt.c (mail_msg_check_error): If we have an operation that failed before, dont show the dialogue for the the new error. Also use gtk_widget_show rather than invoking another main loop. Fix for lazy people who like to leave their mailers running and go home. svn path=/trunk/; revision=13075 --- mail/ChangeLog | 8 ++++++++ mail/mail-mt.c | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 919cecbb46..8835dacc94 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-09-21 + + * mail-mt.c (mail_msg_check_error): If we have an operation that + failed before, dont show the dialogue for the the new error. Also + use gtk_widget_show rather than invoking another main loop. Fix + for lazy people who like to leave their mailers running and go + home. + 2001-09-21 Jeffrey Stedfast * mail-ops.c (mail_send_message): Use the mail-tools convenience diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 9a2033c2e9..3e9394c6a0 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -164,6 +164,14 @@ void mail_msg_free(void *msg) mail_proxy_event(destroy_objects, NULL, activity, NULL); } +/* hash table of ops->dialogue of active errors */ +static GHashTable *active_errors = NULL; + +static void error_gone(GtkObject *o, void *data) +{ + g_hash_table_remove(active_errors, data); +} + void mail_msg_check_error(void *msg) { struct _mail_msg *m = msg; @@ -181,6 +189,9 @@ void mail_msg_check_error(void *msg) || m->ex.id == CAMEL_EXCEPTION_USER_CANCEL) return; + if (active_errors == NULL) + active_errors = g_hash_table_new(NULL, NULL); + if (m->ops->describe_msg) what = m->ops->describe_msg(m, FALSE); @@ -190,9 +201,21 @@ void mail_msg_check_error(void *msg) } else text = g_strdup_printf(_("Error while performing operation:\n%s"), camel_exception_get_description(&m->ex)); + /* check to see if we have dialogue already running for this operation */ + /* we key on the operation pointer, which is at least accurate enough + for the operation type, although it could be on a different object. */ + if (g_hash_table_lookup(active_errors, m->ops)) { + g_warning("Error occured while existing dialogue active:\n%s", text); + g_free(text); + return; + } + gd = (GnomeDialog *)gnome_error_dialog(text); - gnome_dialog_run_and_close(gd); + g_hash_table_insert(active_errors, m->ops, gd); g_free(text); + gtk_signal_connect((GtkObject *)gd, "destroy", error_gone, m->ops); + gnome_dialog_set_close(gd, TRUE); + gtk_widget_show((GtkWidget *)gd); } void mail_msg_cancel(unsigned int msgid) -- cgit