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



commit b38e0739227a6db5f557d3e6d80b022437d747f4
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Apr 8 13:54:07 2020 +0100

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

 plugins/repos/gs-plugin-repos.c | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/plugins/repos/gs-plugin-repos.c b/plugins/repos/gs-plugin-repos.c
index 08e50c18..edb2ed5f 100644
--- a/plugins/repos/gs-plugin-repos.c
+++ b/plugins/repos/gs-plugin-repos.c
@@ -164,16 +164,15 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        return gs_plugin_repos_setup (plugin, cancellable, error);
 }
 
-gboolean
-gs_plugin_refine_app (GsPlugin *plugin,
-                     GsApp *app,
-                     GsPluginRefineFlags flags,
-                     GCancellable *cancellable,
-                     GError **error)
+static gboolean
+refine_app_locked (GsPlugin             *plugin,
+                  GsApp                *app,
+                  GsPluginRefineFlags   flags,
+                  GCancellable         *cancellable,
+                  GError              **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
        const gchar *tmp;
-       g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->mutex);
 
        /* not required */
        if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME) == 0)
@@ -222,3 +221,26 @@ gs_plugin_refine_app (GsPlugin *plugin,
 
        return TRUE;
 }
+
+gboolean
+gs_plugin_refine (GsPlugin             *plugin,
+                 GsAppList            *list,
+                 GsPluginRefineFlags   flags,
+                 GCancellable         *cancellable,
+                 GError              **error)
+{
+       GsPluginData *priv = gs_plugin_get_data (plugin);
+       g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->mutex);
+
+       /* nothing to do here */
+       if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME) == 0)
+               return TRUE;
+
+       for (guint i = 0; i < gs_app_list_length (list); i++) {
+               GsApp *app = gs_app_list_index (list, i);
+               if (!refine_app_locked (plugin, app, flags, cancellable, error))
+                       return FALSE;
+       }
+
+       return TRUE;
+}


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