[balsa] Save a time-out id and remove the GSource
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Save a time-out id and remove the GSource
- Date: Sat, 15 Jul 2017 16:23:07 +0000 (UTC)
commit f0b5090441078dfd0837708fae2a4775042e3e2b
Author: Albrecht Dreß <albrecht dress arcor de>
Date: Sat Jul 15 12:21:08 2017 -0400
Save a time-out id and remove the GSource
* libbalsa/libbalsa-progress.c (revealer_destroy_notify),
(libbalsa_progress_dialog_update), (remove_progress_widget):
save a time-out id and remove the GSource if the progress dialog
is closed before the time-out expires.
Signed-off-by: Peter Bloomfield <PeterBloomfield bellsouth net>
ChangeLog | 7 +++++++
libbalsa/libbalsa-progress.c | 15 ++++++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b29e51a..3439b0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-15 Albrecht Dreß
+
+ * libbalsa/libbalsa-progress.c (revealer_destroy_notify),
+ (libbalsa_progress_dialog_update), (remove_progress_widget):
+ save a time-out id and remove the source if the progress dialog
+ is closed before the time-out expires.
+
2017-07-02 Albrecht Dreß
Gpgme-related improvements
diff --git a/libbalsa/libbalsa-progress.c b/libbalsa/libbalsa-progress.c
index d1e2cf4..a7034e7 100644
--- a/libbalsa/libbalsa-progress.c
+++ b/libbalsa/libbalsa-progress.c
@@ -96,6 +96,11 @@ libbalsa_progress_dialog_ensure(GtkWidget **progress_dialog,
g_mutex_unlock(&progress_mutex);
}
+static void
+revealer_destroy_notify(gpointer timer_id)
+{
+ g_source_remove(GPOINTER_TO_UINT(timer_id));
+}
gboolean
libbalsa_progress_dialog_update(gpointer user_data)
@@ -130,8 +135,14 @@ libbalsa_progress_dialog_update(gpointer user_data)
gtk_progress_bar_set_fraction(progress, ctrl_data->fraction);
}
if (ctrl_data->finished) {
+ guint timer_id;
+
gtk_revealer_set_reveal_child(GTK_REVEALER(progress_widget), FALSE);
- g_timeout_add(500, remove_progress_widget, progress_widget);
+
+ /* set a timer and remember it's id so we can remove it properly if the user
destroys the whole dialogue */
+ timer_id = g_timeout_add(500, remove_progress_widget, progress_widget);
+ g_object_set_data_full(G_OBJECT(progress_widget), "timer",
GUINT_TO_POINTER(timer_id),
+ revealer_destroy_notify);
}
}
}
@@ -241,6 +252,8 @@ remove_progress_widget(gpointer user_data)
GtkWidget *content_box;
guint rev_children = 0U;
+ (void) g_object_steal_data(G_OBJECT(progress), "timer");
+
parent_dialog = gtk_widget_get_toplevel(progress);
gtk_widget_destroy(progress);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]