From c738d4534492ed235d3f555f64e5a9fa9b62bd48 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 10 Sep 2001 19:44:43 +0000 Subject: Attach to the destroy event for each progressbar using bar_destroyed as 2001-09-10 Jeffrey Stedfast * mail-send-recv.c (build_dialogue): Attach to the destroy event for each progressbar using bar_destroyed as the callback. (bar_destroyed): New callback to unregister the timeout and set the send-info's bar member to NULL so we don't try to update a destroyed progressbar. * mail-callbacks.c (mail_generate_reply): Pass along the right string, this fixes bug #9518. svn path=/trunk/; revision=12738 --- mail/ChangeLog | 6 ++++++ mail/mail-send-recv.c | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3cff3a2b5b..709b160da4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,11 @@ 2001-09-10 Jeffrey Stedfast + * mail-send-recv.c (build_dialogue): Attach to the destroy event + for each progressbar using bar_destroyed as the callback. + (bar_destroyed): New callback to unregister the timeout and set + the send-info's bar member to NULL so we don't try to update a + destroyed progressbar. + * mail-callbacks.c (mail_generate_reply): Pass along the right string, this fixes bug #9518. diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 1f2add6467..cdbb49b160 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -194,6 +194,17 @@ static void hide_send_info(void *key, struct _send_info *info, void *data) info->stop = NULL; info->bar = NULL; info->status = NULL; + + if (info->timeout_id != 0) { + gtk_timeout_remove (info->timeout_id); + info->timeout_id = 0; + } +} + +static void +bar_destroyed (GtkProgressBar *bar, struct _send_info *info) +{ + hide_send_info (NULL, info, NULL); } static void @@ -211,6 +222,7 @@ dialogue_clicked(GnomeDialog *gd, int button, struct _send_data *data) case -1: /* dialogue vanished, so make out its just hidden */ d(printf("hiding dialogue\n")); g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL); + data->gd = NULL; break; } } @@ -268,8 +280,7 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) while (sources) { MailConfigService *source = sources->data; - if (!source->url - || !source->enabled) { + if (!source->url || !source->enabled) { sources = sources->next; continue; } @@ -308,6 +319,8 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination) bar = (GtkProgressBar *)gtk_progress_bar_new (); gtk_progress_set_show_text (GTK_PROGRESS (bar), FALSE); + gtk_signal_connect (GTK_OBJECT (bar), "destroy", bar_destroyed, info); + stop = (GtkButton *)gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); status_label = (GtkLabel *)gtk_label_new ((info->type == SEND_UPDATE) ? _("Updating...") : _("Waiting...")); -- cgit