[gnome-software/gnome-3-22] trivial: Do the flatpak management plugin check in one place



commit 2a9bbcc06ab3889fc8ec0ee5f17d6a35365d9f17
Author: Richard Hughes <richard hughsie com>
Date:   Thu Dec 1 14:39:25 2016 +0000

    trivial: Do the flatpak management plugin check in one place

 src/plugins/gs-flatpak.c        |   30 ------------------------------
 src/plugins/gs-plugin-flatpak.c |    7 +++++++
 2 files changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 75b6282..a166477 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -785,11 +785,6 @@ gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
        const gchar *branch;
        g_autoptr(FlatpakRemote) xremote = NULL;
 
-       /* only process this source if was created for this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        /* does the remote already exist and is disabled */
        xremote = flatpak_installation_get_remote_by_name (self->installation,
                                                           gs_app_get_id (app),
@@ -1693,11 +1688,6 @@ gs_flatpak_refine_app (GsFlatpak *self,
 {
        g_autoptr(AsProfileTask) ptask = NULL;
 
-       /* only process this app if was created by this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        /* profile */
        ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
                                  "flatpak::refine{%s}",
@@ -1826,11 +1816,6 @@ gs_flatpak_launch (GsFlatpak *self,
        GsApp *runtime;
        const gchar *branch = NULL;
 
-       /* only process this app if was created by this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        branch = gs_app_get_flatpak_branch (app);
        if (branch == NULL)
                branch = "master";
@@ -1901,11 +1886,6 @@ gs_flatpak_app_remove (GsFlatpak *self,
                       GCancellable *cancellable,
                       GError **error)
 {
-       /* only process this app if was created by this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        /* refine to get basics */
        if (!gs_flatpak_refine_app (self, app,
                                    GS_PLUGIN_REFINE_FLAGS_DEFAULT,
@@ -1952,11 +1932,6 @@ gs_flatpak_app_install (GsFlatpak *self,
 {
        g_autoptr(FlatpakInstalledRef) xref = NULL;
 
-       /* only process this app if was created by this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        /* ensure we have metadata and state */
        if (!gs_flatpak_refine_app (self, app, 0, cancellable,
                                    error))
@@ -2080,11 +2055,6 @@ gs_flatpak_update_app (GsFlatpak *self,
 {
        g_autoptr(FlatpakInstalledRef) xref = NULL;
 
-       /* only process this app if was created by this plugin */
-       if (g_strcmp0 (gs_app_get_management_plugin (app),
-                      gs_plugin_get_name (self->plugin)) != 0)
-               return TRUE;
-
        /* install */
        gs_app_set_state (app, AS_APP_STATE_INSTALLING);
        xref = flatpak_installation_update (self->installation,
diff --git a/src/plugins/gs-plugin-flatpak.c b/src/plugins/gs-plugin-flatpak.c
index 083ca11..c94e1e4 100644
--- a/src/plugins/gs-plugin-flatpak.c
+++ b/src/plugins/gs-plugin-flatpak.c
@@ -244,6 +244,13 @@ static GsFlatpak *
 gs_plugin_flatpak_get_handler (GsPlugin *plugin, GsApp *app)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
+
+       /* 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 NULL;
+       }
+
        for (guint i = 0; i < priv->flatpaks->len; i++) {
                GsFlatpak *flatpak = g_ptr_array_index (priv->flatpaks, i);
 


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