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



commit e02b631cdfd7ed09e69a7da3fee70811fdfdad64
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Apr 8 13:52:29 2020 +0100

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

 plugins/malcontent/gs-plugin-malcontent.c | 38 ++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/plugins/malcontent/gs-plugin-malcontent.c b/plugins/malcontent/gs-plugin-malcontent.c
index e588553e..57ecc18b 100644
--- a/plugins/malcontent/gs-plugin-malcontent.c
+++ b/plugins/malcontent/gs-plugin-malcontent.c
@@ -245,12 +245,12 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        return (priv->app_filter != NULL);
 }
 
-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);
 
@@ -261,14 +261,30 @@ gs_plugin_refine_app (GsPlugin *plugin,
        /* Filter by various parental filters. The filter can’t be %NULL,
         * otherwise setup() would have failed and the plugin would have been
         * disabled. */
-       {
-               g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->mutex);
-               g_assert (priv->app_filter != NULL);
+       g_assert (priv->app_filter != NULL);
 
-               app_set_parental_quirks (plugin, app, priv->app_filter);
+       app_set_parental_quirks (plugin, app, priv->app_filter);
 
-               return TRUE;
+       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);
+
+       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;
 }
 
 gboolean


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