[gnome-software] snap: Only define refine(), not refine_app()



commit 2fc036932035193ee8d97dbdfc45e365bf7f50e5
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Apr 8 13:54:48 2020 +0100

    snap: Only define refine(), not refine_app()
    
    See the previous commit for details.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 plugins/snap/gs-plugin-snap.c | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 321afe76..4ccabe43 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -890,15 +890,15 @@ refine_screenshots (GsApp *app, SnapdSnap *snap)
        }
 }
 
-gboolean
-gs_plugin_refine_app (GsPlugin *plugin,
-                     GsApp *app,
-                     GsPluginRefineFlags flags,
-                     GCancellable *cancellable,
-                     GError **error)
+static gboolean
+refine_app_with_client (GsPlugin             *plugin,
+                       SnapdClient          *client,
+                       GsApp                *app,
+                       GsPluginRefineFlags   flags,
+                       GCancellable         *cancellable,
+                       GError              **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
-       g_autoptr(SnapdClient) client = NULL;
        const gchar *snap_name, *name, *version;
        g_autofree gchar *channel = NULL;
        g_autofree gchar *store_channel = NULL;
@@ -915,10 +915,6 @@ gs_plugin_refine_app (GsPlugin *plugin,
        if (g_strcmp0 (gs_app_get_management_plugin (app), "snap") != 0)
                return TRUE;
 
-       client = get_client (plugin, error);
-       if (client == NULL)
-               return FALSE;
-
        snap_name = gs_app_get_metadata_item (app, "snap::name");
        channel = g_strdup (gs_app_get_branch (app));
 
@@ -1059,6 +1055,28 @@ gs_plugin_refine_app (GsPlugin *plugin,
        return TRUE;
 }
 
+gboolean
+gs_plugin_refine (GsPlugin             *plugin,
+                 GsAppList            *list,
+                 GsPluginRefineFlags   flags,
+                 GCancellable         *cancellable,
+                 GError              **error)
+{
+       g_autoptr(SnapdClient) client = NULL;
+
+       client = get_client (plugin, error);
+       if (client == NULL)
+               return FALSE;
+
+       for (guint i = 0; i < gs_app_list_length (list); i++) {
+               GsApp *app = gs_app_list_index (list, i);
+               if (!refine_app_with_client (plugin, client, app, flags, cancellable, error))
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
 static void
 progress_cb (SnapdClient *client, SnapdChange *change, gpointer deprecated, gpointer user_data)
 {


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