[gnome-software/gnome-40: 2/3] flatpak: Implement gs_plugin_add_search_what_provides()




commit 252691874456a1450b775458d171d04405aef877
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 15 18:49:08 2021 +0200

    flatpak: Implement gs_plugin_add_search_what_provides()
    
    Let the Flatpak plugin search for "what provides" as well. It's the same
    search, due to the appstream search terms, and it gets more results to
    pick from.
    
    Related https://gitlab.gnome.org/GNOME/gnome-software/-/issues/613
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1210

 plugins/flatpak/gs-plugin-flatpak.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 364bc27d1..808e1a56e 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1444,12 +1444,12 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        return TRUE;
 }
 
-gboolean
-gs_plugin_add_search (GsPlugin *plugin,
-                     gchar **values,
-                     GsAppList *list,
-                     GCancellable *cancellable,
-                     GError **error)
+static gboolean
+gs_plugin_flatpak_do_search (GsPlugin *plugin,
+                            gchar **values,
+                            GsAppList *list,
+                            GCancellable *cancellable,
+                            GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
        for (guint i = 0; i < priv->flatpaks->len; i++) {
@@ -1459,9 +1459,30 @@ gs_plugin_add_search (GsPlugin *plugin,
                        return FALSE;
                }
        }
+
        return TRUE;
 }
 
+gboolean
+gs_plugin_add_search (GsPlugin *plugin,
+                     gchar **values,
+                     GsAppList *list,
+                     GCancellable *cancellable,
+                     GError **error)
+{
+       return gs_plugin_flatpak_do_search (plugin, values, list, cancellable, error);
+}
+
+gboolean
+gs_plugin_add_search_what_provides (GsPlugin *plugin,
+                                   gchar **search,
+                                   GsAppList *list,
+                                   GCancellable *cancellable,
+                                   GError **error)
+{
+       return gs_plugin_flatpak_do_search (plugin, search, list, cancellable, error);
+}
+
 gboolean
 gs_plugin_add_categories (GsPlugin *plugin,
                          GPtrArray *list,


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