[gnome-todo/gnome-3-22] notification-widget: execute remaining notifications when quitting



commit 64da29b3d08df41a94ff1a47176325aefcd43438
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 1 00:51:32 2016 -0200

    notification-widget: execute remaining notifications when quitting
    
    When there are notifications available, we should execute them when
    quitting the application.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773834

 src/notification/gtd-notification-widget.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/notification/gtd-notification-widget.c b/src/notification/gtd-notification-widget.c
index 33b7bc7..cb54155 100644
--- a/src/notification/gtd-notification-widget.c
+++ b/src/notification/gtd-notification-widget.c
@@ -191,7 +191,22 @@ gtd_notification_widget_finalize (GObject *object)
 {
   GtdNotificationWidget *self = (GtdNotificationWidget *)object;
   GtdNotificationWidgetPrivate *priv = gtd_notification_widget_get_instance_private (self);
+  GList *l;
 
+  /* When quitting, always execute the primary option of the notifications */
+  if (priv->current_notification)
+    {
+      g_signal_handlers_disconnect_by_func (priv->current_notification,
+                                            gtd_notification_widget__notification_executed_cb,
+                                            self);
+
+      gtd_notification_execute_primary_action (priv->current_notification);
+    }
+
+  for (l = priv->queue->head; l != NULL; l = l->next)
+    gtd_notification_execute_primary_action (l->data);
+
+  /* And only after executing all of them, release the queue */
   g_queue_free_full (priv->queue, g_object_unref);
 
   G_OBJECT_CLASS (gtd_notification_widget_parent_class)->finalize (object);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]