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



commit 7ae6f8e38bcf4c5793e3b7c46de3093a5fcd86a8
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Apr 8 13:51:18 2020 +0100

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

 .../gs-plugin-fedora-pkgdb-collections.c           | 41 +++++++++++++++-------
 1 file changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c 
b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index 5862bae5..389ab4e6 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -494,17 +494,15 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
        return TRUE;
 }
 
-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);
        PkgdbItem *item;
        const gchar *cpe_name;
-       g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&priv->mutex);
 
        /* not for us */
        if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE)
@@ -515,10 +513,6 @@ gs_plugin_refine_app (GsPlugin *plugin,
        if (cpe_name == NULL)
                return TRUE;
 
-       /* ensure valid data is loaded */
-       if (!_ensure_cache (plugin, cancellable, error))
-               return FALSE;
-
        /* find item */
        item = _get_item_by_cpe_name (plugin, cpe_name);
        if (item == NULL) {
@@ -541,3 +535,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);
+
+       /* ensure valid data is loaded */
+       if (!_ensure_cache (plugin, cancellable, error))
+               return FALSE;
+
+       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]