[gnome-software/wip/temp/ubuntu-xenial-rebased: 226/329] More notification fixes under Unity



commit 1ac690428100714e9e395fd088ee51ac94e5f815
Author: William Hua <william hua canonical com>
Date:   Wed Apr 13 12:29:43 2016 -0400

    More notification fixes under Unity

 src/gs-shell-updates.c  |   18 +++++++++++++-----
 src/gs-update-monitor.c |    3 +--
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 881176a..0b5b04d 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -960,6 +960,12 @@ gs_shell_updates_reboot_failed_cb (GObject *source, GAsyncResult *res, gpointer
                                           self);
 }
 
+static gboolean
+is_unity (void)
+{
+       return g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0;
+}
+
 /**
  * gs_shell_updates_perform_update_cb:
  **/
@@ -998,11 +1004,13 @@ gs_shell_updates_perform_update_cb (GsPluginLoader *plugin_loader,
                n = g_notification_new (_("Updates have been installed"));
                /* TRANSLATORS: the new apps will not be run until we restart */
                g_notification_set_body (n, _("A restart is required for them to take effect."));
-               /* TRANSLATORS: button text */
-               g_notification_add_button (n, _("Not Now"), "app.nop");
-               /* TRANSLATORS: button text */
-               g_notification_add_button_with_target (n, _("Restart"), "app.reboot", NULL);
-               g_notification_set_default_action_and_target (n, "app.set-mode", "s", "updates");
+               if (!is_unity ()) {
+                       /* TRANSLATORS: button text */
+                       g_notification_add_button (n, _("Not Now"), "app.nop");
+                       /* TRANSLATORS: button text */
+                       g_notification_add_button_with_target (n, _("Restart"), "app.reboot", NULL);
+                       g_notification_set_default_action_and_target (n, "app.set-mode", "s", "updates");
+               }
                g_application_send_notification (g_application_get_default (), "restart-required", n);
        }
 }
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 69c5cb4..c1c6a41 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -444,12 +444,11 @@ get_updates_historical_cb (GObject *object, GAsyncResult *res, gpointer data)
                        notification = g_notification_new (_("Software Updates Failed"));
                        /* TRANSLATORS: message when we offline updates have failed */
                        g_notification_set_body (notification, _("An important OS update failed to be 
installed."));
-                       g_application_send_notification (monitor->application, "offline-updates", 
notification);
                        if (!is_unity ()) {
                                g_notification_add_button (notification, _("Show Details"), 
"app.show-offline-update-error");
                                g_notification_set_default_action (notification, 
"app.show-offline-update-error");
-                               g_application_send_notification (monitor->application, "offline-updates", 
notification);
                        }
+                       g_application_send_notification (monitor->application, "offline-updates", 
notification);
                }
                return;
        }


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