[gnome-settings-daemon/gnome-3-14] datetime: Don't add more than one Settings button



commit 61512b81340621d383da0e396327d681ebb76387
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 4 16:20:13 2015 +0100

    datetime: Don't add more than one Settings button
    
    In the notification. We were adding a new Settings button each time
    we were updating a notification. We only need to add one the first
    time around.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743804

 plugins/datetime/gsd-datetime-manager.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/plugins/datetime/gsd-datetime-manager.c b/plugins/datetime/gsd-datetime-manager.c
index e23d5c9..bb4fafd 100644
--- a/plugins/datetime/gsd-datetime-manager.c
+++ b/plugins/datetime/gsd-datetime-manager.c
@@ -89,7 +89,6 @@ timezone_changed_cb (GsdTimezoneMonitor *timezone_monitor,
 {
         GDateTime *datetime;
         GTimeZone *tz;
-        gchar *control_center;
         gchar *notification_summary;
         gchar *timezone_name;
         gchar *utc_offset;
@@ -111,12 +110,24 @@ timezone_changed_cb (GsdTimezoneMonitor *timezone_monitor,
         g_free (utc_offset);
 
         if (self->priv->notification == NULL) {
+                gchar *control_center;
+
                 self->priv->notification = notify_notification_new (notification_summary, NULL,
                                                                     "preferences-system-time-symbolic");
                 g_signal_connect (self->priv->notification,
                                   "closed",
                                   G_CALLBACK (notification_closed_cb),
                                   self);
+
+                control_center = g_find_program_in_path ("gnome-control-center");
+                if (control_center != NULL && notification_server_has_actions ()) {
+                        notify_notification_add_action (self->priv->notification,
+                                                        "settings",
+                                                        _("Settings"),
+                                                        (NotifyActionCallback) open_settings_cb,
+                                                        NULL, NULL);
+                }
+                g_free (control_center);
         } else {
                 notify_notification_update (self->priv->notification,
                                             notification_summary, NULL,
@@ -128,16 +139,6 @@ timezone_changed_cb (GsdTimezoneMonitor *timezone_monitor,
         notify_notification_set_urgency (self->priv->notification, NOTIFY_URGENCY_NORMAL);
         notify_notification_set_timeout (self->priv->notification, NOTIFY_EXPIRES_NEVER);
 
-        control_center = g_find_program_in_path ("gnome-control-center");
-        if (control_center != NULL && notification_server_has_actions ()) {
-                notify_notification_add_action (self->priv->notification,
-                                                "settings",
-                                                _("Settings"),
-                                                (NotifyActionCallback) open_settings_cb,
-                                                NULL, NULL);
-        }
-        g_free (control_center);
-
         if (!notify_notification_show (self->priv->notification, NULL)) {
                 g_warning ("Failed to send timezone notification");
         }


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