[gnome-software: 6/7] lib: Drop GS_PLUGIN_ACTION_SEARCH_PROVIDES and gs_plugin_add_search_what_provides()




commit 94ea09a09a662efd03715d03ae3b0dafc042ec74
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Jul 7 17:03:14 2022 +0100

    lib: Drop GS_PLUGIN_ACTION_SEARCH_PROVIDES and gs_plugin_add_search_what_provides()
    
    Neither of them are used any more: instead, plugins and call sites use
    `GsPluginJobListApps` with a `GsAppQuery` with `provides-tag` and
    `provides-type` set.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin-loader.c | 55 --------------------------------------------------
 lib/gs-plugin-types.h  |  2 --
 lib/gs-plugin-vfuncs.h | 21 -------------------
 lib/gs-plugin.c        |  6 ------
 4 files changed, 84 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 2354ccdb5..de8894e1c 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -639,14 +639,6 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
                        ret = plugin_func (plugin, list, cancellable, &error_local);
                }
                break;
-       case GS_PLUGIN_ACTION_SEARCH_PROVIDES:
-               {
-                       GsPluginSearchFunc plugin_func = func;
-                       const gchar *search[2] = { gs_plugin_job_get_search (helper->plugin_job), NULL };
-                       ret = plugin_func (plugin, (gchar **) search, list,
-                                          cancellable, &error_local);
-               }
-               break;
        case GS_PLUGIN_ACTION_GET_CATEGORIES:
                {
                        GsPluginCategoriesFunc plugin_func = func;
@@ -985,38 +977,6 @@ gs_plugin_loader_app_is_valid_updatable (GsApp *app, gpointer user_data)
                (gs_app_is_updatable (app) || gs_app_get_state (app) == GS_APP_STATE_INSTALLING);
 }
 
-static gboolean
-gs_plugin_loader_filter_qt_for_gtk (GsApp *app, gpointer user_data)
-{
-       /* hide the QT versions in preference to the GTK ones */
-       if (g_strcmp0 (gs_app_get_id (app), "transmission-qt.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "nntpgrab_qt.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "gimagereader-qt4.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "gimagereader-qt5.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "nntpgrab_server_qt.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "hotot-qt.desktop") == 0) {
-               g_debug ("removing QT version of %s",
-                        gs_plugin_loader_get_app_str (app));
-               return FALSE;
-       }
-
-       /* hide the KDE version in preference to the GTK one */
-       if (g_strcmp0 (gs_app_get_id (app), "qalculate_kde.desktop") == 0) {
-               g_debug ("removing KDE version of %s",
-                        gs_plugin_loader_get_app_str (app));
-               return FALSE;
-       }
-
-       /* hide the KDE version in preference to the Qt one */
-       if (g_strcmp0 (gs_app_get_id (app), "kid3.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id (app), "kchmviewer.desktop") == 0) {
-               g_debug ("removing KDE version of %s",
-                        gs_plugin_loader_get_app_str (app));
-               return FALSE;
-       }
-       return TRUE;
-}
-
 gboolean
 gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader,
                                     GsApp          *app)
@@ -1037,15 +997,6 @@ gs_plugin_loader_app_is_compatible (GsPluginLoader *plugin_loader,
        return FALSE;
 }
 
-static gboolean
-gs_plugin_loader_get_app_is_compatible (GsApp    *app,
-                                        gpointer  user_data)
-{
-       GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (user_data);
-
-       return gs_plugin_loader_app_is_compatible (plugin_loader, app);
-}
-
 /******************************************************************************/
 
 /**
@@ -3588,11 +3539,6 @@ gs_plugin_loader_process_thread_cb (GTask *task,
        case GS_PLUGIN_ACTION_URL_TO_APP:
                gs_app_list_filter (list, gs_plugin_loader_app_is_valid_filter, helper);
                break;
-       case GS_PLUGIN_ACTION_SEARCH_PROVIDES:
-               gs_app_list_filter (list, gs_plugin_loader_app_is_valid_filter, helper);
-               gs_app_list_filter (list, gs_plugin_loader_filter_qt_for_gtk, NULL);
-               gs_app_list_filter (list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
-               break;
        case GS_PLUGIN_ACTION_GET_UPDATES:
                gs_app_list_filter (list, gs_plugin_loader_app_is_valid_updatable, helper);
                break;
@@ -3971,7 +3917,6 @@ job_process_cb (GTask *task)
 
        /* check required args */
        switch (action) {
-       case GS_PLUGIN_ACTION_SEARCH_PROVIDES:
        case GS_PLUGIN_ACTION_URL_TO_APP:
                if (gs_plugin_job_get_search (plugin_job) == NULL) {
                        g_task_return_new_error (task,
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index 3e8c3cc92..dde60d098 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -265,7 +265,6 @@ typedef enum {
  * @GS_PLUGIN_ACTION_UPDATE_CANCEL:            Cancel the update
  * @GS_PLUGIN_ACTION_GET_UPDATES:              Get the list of updates
  * @GS_PLUGIN_ACTION_GET_SOURCES:              Get the list of sources
- * @GS_PLUGIN_ACTION_SEARCH_PROVIDES:          Get the search results for a provide query
  * @GS_PLUGIN_ACTION_GET_CATEGORIES:           Get the list of categories
  * @GS_PLUGIN_ACTION_FILE_TO_APP:              Convert the file to an application
  * @GS_PLUGIN_ACTION_URL_TO_APP:               Convert the URI to an application
@@ -290,7 +289,6 @@ typedef enum {
        GS_PLUGIN_ACTION_UPDATE_CANCEL,
        GS_PLUGIN_ACTION_GET_UPDATES,
        GS_PLUGIN_ACTION_GET_SOURCES,
-       GS_PLUGIN_ACTION_SEARCH_PROVIDES,
        GS_PLUGIN_ACTION_GET_CATEGORIES,
        GS_PLUGIN_ACTION_FILE_TO_APP,
        GS_PLUGIN_ACTION_URL_TO_APP,
diff --git a/lib/gs-plugin-vfuncs.h b/lib/gs-plugin-vfuncs.h
index a69864528..66fd69562 100644
--- a/lib/gs-plugin-vfuncs.h
+++ b/lib/gs-plugin-vfuncs.h
@@ -63,27 +63,6 @@ GType                 gs_plugin_query_type                   (void);
 void            gs_plugin_adopt_app                    (GsPlugin       *plugin,
                                                         GsApp          *app);
 
-/**
- * gs_plugin_add_search_what_provides
- * @plugin: a list of tags, e.g. [ "text/rtf" ]
- * @values: a #GStrv
- * @list: a #GsAppList
- * @cancellable: a #GCancellable, or %NULL
- * @error: a #GError, or %NULL
- *
- * Called when searching for an application that provides specific defined tags,
- * for instance a codec string or mime-type.
- *
- * Plugins are expected to add new apps using gs_app_list_add().
- *
- * Returns: %TRUE for success or if not relevant
- **/
-gboolean        gs_plugin_add_search_what_provides     (GsPlugin       *plugin,
-                                                        gchar          **values,
-                                                        GsAppList      *list,
-                                                        GCancellable   *cancellable,
-                                                        GError         **error);
-
 /**
  * gs_plugin_add_updates:
  * @plugin: a #GsPlugin
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index df34e40fc..13c6e8d94 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1586,8 +1586,6 @@ gs_plugin_action_to_function_name (GsPluginAction action)
                return "gs_plugin_add_updates_historical";
        if (action == GS_PLUGIN_ACTION_GET_UPDATES)
                return "gs_plugin_add_updates";
-       if (action == GS_PLUGIN_ACTION_SEARCH_PROVIDES)
-               return "gs_plugin_add_search_what_provides";
        if (action == GS_PLUGIN_ACTION_GET_CATEGORIES)
                return "gs_plugin_add_categories";
        if (action == GS_PLUGIN_ACTION_GET_LANGPACKS)
@@ -1628,8 +1626,6 @@ gs_plugin_action_to_string (GsPluginAction action)
                return "get-updates";
        if (action == GS_PLUGIN_ACTION_GET_SOURCES)
                return "get-sources";
-       if (action == GS_PLUGIN_ACTION_SEARCH_PROVIDES)
-               return "search-provides";
        if (action == GS_PLUGIN_ACTION_GET_CATEGORIES)
                return "get-categories";
        if (action == GS_PLUGIN_ACTION_FILE_TO_APP)
@@ -1684,8 +1680,6 @@ gs_plugin_action_from_string (const gchar *action)
                return GS_PLUGIN_ACTION_GET_UPDATES;
        if (g_strcmp0 (action, "get-sources") == 0)
                return GS_PLUGIN_ACTION_GET_SOURCES;
-       if (g_strcmp0 (action, "search-provides") == 0)
-               return GS_PLUGIN_ACTION_SEARCH_PROVIDES;
        if (g_strcmp0 (action, "get-categories") == 0)
                return GS_PLUGIN_ACTION_GET_CATEGORIES;
        if (g_strcmp0 (action, "file-to-app") == 0)


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