[gnome-software/wip/kalev/shell-extensions-fixes: 3/10] shell extensions: Don't adopt system installed shell extensions



commit 6a9018554ae9c3de7a2d7cec87de5474e7a87f59
Author: Kalev Lember <klember redhat com>
Date:   Tue Feb 20 21:01:18 2018 +0100

    shell extensions: Don't adopt system installed shell extensions
    
    If we have system installed extensions, these need to stay managed by
    the packagekit plugin so that we don't lose the ability to remove them.

 plugins/shell-extensions/gs-plugin-shell-extensions.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c 
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index 2ea817f1..cf28cc0c 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -98,8 +98,10 @@ gs_plugin_destroy (GsPlugin *plugin)
 void
 gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
 {
-       if (gs_app_get_kind (app) == AS_APP_KIND_SHELL_EXTENSION)
+       if (gs_app_get_kind (app) == AS_APP_KIND_SHELL_EXTENSION &&
+           gs_app_get_scope (app) == AS_APP_SCOPE_USER) {
                gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
+       }
 }
 
 static AsAppState
@@ -400,14 +402,11 @@ gs_plugin_refine_app (GsPlugin *plugin,
 {
        const gchar *uuid;
 
-       /* only process this these kinds */
-       if (gs_app_get_kind (app) != AS_APP_KIND_SHELL_EXTENSION)
+       /* only process this app if was created by this plugin */
+       if (g_strcmp0 (gs_app_get_management_plugin (app),
+                      gs_plugin_get_name (plugin)) != 0)
                return TRUE;
 
-       /* adopt any here */
-       if (gs_app_get_management_plugin (app) == NULL)
-               gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
-
        /* can we get the AppStream-created app state using the cache */
        uuid = gs_app_get_metadata_item (app, "shell-extensions::uuid");
        if (uuid != NULL && gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) {


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