[gnome-software] Do not offer to 'Launch' addons like fonts and codecs



commit ab58c827e884ede31896a1bb97d5799a60c18630
Author: Richard Hughes <richard hughsie com>
Date:   Mon Oct 28 09:56:00 2013 +0000

    Do not offer to 'Launch' addons like fonts and codecs
    
    Additionally, use the full ID to avoid appending .desktop to the name.

 src/gs-application.c |   13 ++++---------
 src/gs-utils.c       |   12 ++++++++----
 2 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index ef54a3c..8cf3d72 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -341,20 +341,18 @@ launch_activated (GSimpleAction *action,
                  GVariant      *parameter,
                  gpointer       data)
 {
-       const gchar *id;
-       gchar *desktop_id;
+       const gchar *desktop_id;
        GdkDisplay *display;
        GAppInfo *appinfo;
        GAppLaunchContext *context;
        GError *error = NULL;
 
-       id = g_variant_get_string (parameter, NULL);
+       desktop_id = g_variant_get_string (parameter, NULL);
        display = gdk_display_get_default ();
-       desktop_id = g_strconcat (id, ".desktop", NULL);
        appinfo = G_APP_INFO (g_desktop_app_info_new (desktop_id));
-       if (!appinfo) {
+       if (appinfo == NULL) {
                g_warning ("no such desktop file: %s", desktop_id);
-               goto out;
+               return;
        }
 
        context = G_APP_LAUNCH_CONTEXT (gdk_display_get_app_launch_context (display));
@@ -365,9 +363,6 @@ launch_activated (GSimpleAction *action,
 
        g_object_unref (appinfo);
        g_object_unref (context);
-
-out:
-       g_free (desktop_id);
 }
 
 static void
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 0824de3..c1711ee 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -127,12 +127,16 @@ gs_app_notify_installed (GsApp *app)
         * has been successfully installed */
        summary = g_strdup_printf (_("%s is now installed"), gs_app_get_name (app));
        n = g_notification_new (summary);
-       /* 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_id (app), ""); 
+       if (gs_app_get_id_kind (app) == GS_APP_ID_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_full (app));
+       }
+       g_notification_set_default_action_and_target  (n, "app.details", "(ss)",
+                                                      gs_app_get_id_full (app), "");
        g_application_send_notification (g_application_get_default (), "installed", n);
        g_object_unref (n);
-
        g_free (summary);
 }
 


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