[gnome-settings-daemon] power: Simplify setting the notification app name



commit e1f0bc6c925e779b19fad70b40ae7ccde2fb4308
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Nov 23 11:42:06 2015 +0100

    power: Simplify setting the notification app name
    
    All of the notifications in the power plugin are "Power" notifications,
    so do this in the helper function instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758532

 plugins/power/gsd-power-manager.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 1215f8b..d3908f2 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -313,6 +313,8 @@ create_notification (const char *summary,
         NotifyNotification *notification;
 
         notification = notify_notification_new (summary, body, icon_name);
+        /* TRANSLATORS: this is the notification application name */
+        notify_notification_set_app_name (notification, _("Power"));
         *weak_pointer_location = notification;
         g_object_add_weak_pointer (G_OBJECT (notification),
                                    (gpointer *) weak_pointer_location);
@@ -365,8 +367,6 @@ engine_ups_discharging (GsdPowerManager *manager, UpDevice *device)
                                          GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG);
         notify_notification_set_urgency (manager->priv->notification_ups_discharging,
                                          NOTIFY_URGENCY_NORMAL);
-        /* TRANSLATORS: this is the notification application name */
-        notify_notification_set_app_name (manager->priv->notification_ups_discharging, _("Power"));
         notify_notification_set_hint (manager->priv->notification_ups_discharging,
                                       "transient", g_variant_new_boolean (TRUE));
 
@@ -514,7 +514,6 @@ engine_charge_low (GsdPowerManager *manager, UpDevice *device)
                                          GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG);
         notify_notification_set_urgency (manager->priv->notification_low,
                                          NOTIFY_URGENCY_NORMAL);
-        notify_notification_set_app_name (manager->priv->notification_low, _("Power"));
         notify_notification_set_hint (manager->priv->notification_low,
                                       "transient", g_variant_new_boolean (TRUE));
 
@@ -665,7 +664,6 @@ engine_charge_critical (GsdPowerManager *manager, UpDevice *device)
                                          NOTIFY_EXPIRES_NEVER);
         notify_notification_set_urgency (manager->priv->notification_low,
                                          NOTIFY_URGENCY_CRITICAL);
-        notify_notification_set_app_name (manager->priv->notification_low, _("Power"));
 
         notify_notification_show (manager->priv->notification_low, NULL);
 
@@ -773,7 +771,6 @@ engine_charge_action (GsdPowerManager *manager, UpDevice *device)
                                          NOTIFY_EXPIRES_NEVER);
         notify_notification_set_urgency (manager->priv->notification_low,
                                          NOTIFY_URGENCY_CRITICAL);
-        notify_notification_set_app_name (manager->priv->notification_low, _("Power"));
 
         /* try to show */
         notify_notification_show (manager->priv->notification_low, NULL);
@@ -2060,7 +2057,6 @@ show_sleep_warning (GsdPowerManager *manager)
                                          NOTIFY_EXPIRES_NEVER);
         notify_notification_set_urgency (manager->priv->notification_sleep_warning,
                                          NOTIFY_URGENCY_CRITICAL);
-        notify_notification_set_app_name (manager->priv->notification_sleep_warning, _("Power"));
 
         notify_notification_show (manager->priv->notification_sleep_warning, NULL);
 }


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