[gnome-software/wip/ubuntu-master: 14/23] Don't use notification actions under Unity



commit 48eaee06bec545c9db1c79dd50ed5a4921b95b1f
Author: William Hua <william hua canonical com>
Date:   Tue Nov 8 11:36:19 2016 +1300

    Don't use notification actions under Unity

 src/gs-common.c         |   16 +++++++++-------
 src/gs-dbus-helper.c    |    8 +++++---
 src/gs-update-monitor.c |   19 +++++++++++--------
 src/gs-updates-page.c   |   12 +++++++-----
 4 files changed, 32 insertions(+), 23 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index 1ec2afd..ab4f3ab 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -146,14 +146,16 @@ gs_app_notify_installed (GsApp *app)
        }
        n = g_notification_new (summary);
        g_notification_set_body (n, body);
-       if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP) {
-               /* TRANSLATORS: this is button that opens the newly installed application */
-               g_notification_add_button_with_target (n, _("Launch"),
-                                                      "app.launch", "s",
-                                                      gs_app_get_id (app));
+       if (!gs_utils_is_current_desktop ("Unity")) {
+               if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP) {
+                       /* TRANSLATORS: this is button that opens the newly installed application */
+                       g_notification_add_button_with_target (n, _("Launch"),
+                                                              "app.launch", "s",
+                                                              gs_app_get_id (app));
+               }
+               g_notification_set_default_action_and_target (n, "app.details", "(ss)",
+                                                             gs_app_get_unique_id (app), "");
        }
-       g_notification_set_default_action_and_target  (n, "app.details", "(ss)",
-                                                      gs_app_get_unique_id (app), "");
        g_application_send_notification (g_application_get_default (), "installed", n);
 }
 
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index 92ef2ad..41525de 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -332,9 +332,11 @@ notify_search_resources (GsExtrasPageMode   mode,
        n = g_notification_new (title);
        g_notification_set_body (n, body);
        /* TRANSLATORS: this is a button that launches gnome-software */
-       g_notification_add_button_with_target (n, _("Find in Software"), "app.install-resources", "(s^ass)", 
mode_string, resources, "");
-       g_notification_set_default_action_and_target (n, "app.install-resources", "(s^ass)", mode_string, 
resources, "");
-       g_application_send_notification (g_application_get_default (), "install-resources", n);
+       if (!gs_utils_is_current_desktop ("Unity")) {
+               g_notification_add_button_with_target (n, _("Find in Software"), "app.install-resources", 
"(s^ass)", mode_string, resources, "");
+               g_notification_set_default_action_and_target (n, "app.install-resources", "(s^ass)", 
mode_string, resources, "");
+               g_application_send_notification (g_application_get_default (), "install-resources", n);
+       }
 }
 
 static void
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index ab1baaf..fbd91ee 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -272,7 +272,8 @@ get_upgrades_finished_cb (GObject *object,
        /* TRANSLATORS: this is a distro upgrade */
        n = g_notification_new (_("Software Upgrade Available"));
        g_notification_set_body (n, body);
-       g_notification_set_default_action_and_target (n, "app.set-mode", "s", "updates");
+       if (!gs_utils_is_current_desktop ("Unity"))
+               g_notification_set_default_action_and_target (n, "app.set-mode", "s", "updates");
        g_application_send_notification (monitor->application, "upgrades-available", n);
 }
 
@@ -576,13 +577,15 @@ get_updates_historical_cb (GObject *object, GAsyncResult *res, gpointer data)
 
        notification = g_notification_new (title);
        g_notification_set_body (notification, message);
-       /* TRANSLATORS: Button to look at the updates that were installed.
-        * Note that it has nothing to do with the application reviews, the
-        * users can't express their opinions here. In some languages
-        * "Review (evaluate) something" is a different translation than
-        * "Review (browse) something." */
-       g_notification_add_button_with_target (notification, C_("updates", "Review"), "app.set-mode", "s", 
"updated");
-       g_notification_set_default_action_and_target (notification, "app.set-mode", "s", "updated");
+       if (!gs_utils_is_current_desktop ("Unity")) {
+               /* TRANSLATORS: Button to look at the updates that were installed.
+                * Note that it has nothing to do with the application reviews, the
+                * users can't express their opinions here. In some languages
+                * "Review (evaluate) something" is a different translation than
+                * "Review (browse) something." */
+               g_notification_add_button_with_target (notification, C_("updates", "Review"), "app.set-mode", 
"s", "updated");
+               g_notification_set_default_action_and_target (notification, "app.set-mode", "s", "updated");
+       }
        g_application_send_notification (monitor->application, "offline-updates", notification);
 
        /* update the timestamp so we don't show again */
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index b66c45b..fcf80d2 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -947,11 +947,13 @@ gs_updates_page_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 (!gs_utils_is_current_desktop ("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);
        }
 }


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