[gnome-software/wip/kalev/shell-extensions-fixes: 9/10] shell extensions: Make launch work for PackageKit-installed extensions



commit 469b65c851370796ece702d117595f31ad027d99
Author: Kalev Lember <klember redhat com>
Date:   Wed Feb 21 10:58:12 2018 +0100

    shell extensions: Make launch work for PackageKit-installed extensions

 plugins/shell-extensions/gs-plugin-shell-extensions.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c 
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index d81b6892..fa28a89e 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -971,15 +971,21 @@ gs_plugin_launch (GsPlugin *plugin,
                  GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
-       const gchar *uuid;
+       g_autofree gchar *uuid = NULL;
        g_autoptr(GVariant) retval = NULL;
 
        /* launch both PackageKit-installed and user-installed */
        if (gs_app_get_kind (app) != AS_APP_KIND_SHELL_EXTENSION)
                return TRUE;
 
-       /* install */
-       uuid = gs_app_get_metadata_item (app, "shell-extensions::uuid");
+       uuid = g_strdup (gs_app_get_metadata_item (app, "shell-extensions::uuid"));
+       if (uuid == NULL) {
+               const gchar *suffix = ".shell-extension";
+               const gchar *id = gs_app_get_id (app);
+               /* PackageKit-installed extension ID generated by appstream-builder */
+               if (g_str_has_suffix (id, suffix))
+                       uuid = g_strndup (id, strlen (id) - strlen (suffix));
+       }
        if (uuid == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
@@ -988,6 +994,7 @@ gs_plugin_launch (GsPlugin *plugin,
                             gs_app_get_id (app));
                return FALSE;
        }
+       /* launch */
        retval = g_dbus_proxy_call_sync (priv->proxy,
                                         "LaunchExtensionPrefs",
                                         g_variant_new ("(s)", uuid),


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