[gnome-software: 9/11] lib: Drop GS_PLUGIN_ACTION_GET_ALTERNATES and gs_plugin_add_alternates()




commit 6e0b1586a376b5b5aa667ee3f271cd8f54425f03
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Jul 6 15:25:01 2022 +0100

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

 lib/gs-plugin-loader.c | 27 ---------------------------
 lib/gs-plugin-types.h  |  2 --
 lib/gs-plugin-vfuncs.h | 21 ---------------------
 lib/gs-plugin.c        |  6 ------
 4 files changed, 56 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index a6ab3329c..cd08c5efd 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -647,13 +647,6 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
                                           cancellable, &error_local);
                }
                break;
-       case GS_PLUGIN_ACTION_GET_ALTERNATES:
-               {
-                       GsPluginAlternatesFunc plugin_func = func;
-                       ret = plugin_func (plugin, app, list,
-                                          cancellable, &error_local);
-               }
-               break;
        case GS_PLUGIN_ACTION_GET_CATEGORIES:
                {
                        GsPluginCategoriesFunc plugin_func = func;
@@ -3596,7 +3589,6 @@ gs_plugin_loader_process_thread_cb (GTask *task,
                gs_app_list_filter (list, gs_plugin_loader_app_is_valid_filter, helper);
                break;
        case GS_PLUGIN_ACTION_SEARCH_PROVIDES:
-       case GS_PLUGIN_ACTION_GET_ALTERNATES:
                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);
@@ -3979,13 +3971,6 @@ job_process_cb (GTask *task)
                                                GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION);
        }
 
-       /* get alternates is unusual in that it needs an app input and a list
-        * output -- so undo the helpful app add in gs_plugin_job_set_app() */
-       if (action == GS_PLUGIN_ACTION_GET_ALTERNATES) {
-               GsAppList *list = gs_plugin_job_get_list (plugin_job);
-               gs_app_list_remove_all (list);
-       }
-
        /* check required args */
        switch (action) {
        case GS_PLUGIN_ACTION_SEARCH_PROVIDES:
@@ -4002,18 +3987,6 @@ job_process_cb (GTask *task)
                break;
        }
 
-       /* sorting fallbacks */
-       switch (action) {
-       case GS_PLUGIN_ACTION_GET_ALTERNATES:
-               if (gs_plugin_job_get_sort_func (plugin_job, NULL) == NULL) {
-                       gs_plugin_job_set_sort_func (plugin_job,
-                                                    gs_utils_app_sort_priority, NULL);
-               }
-               break;
-       default:
-               break;
-       }
-
        /* save helper */
        helper = gs_plugin_loader_helper_new (plugin_loader, plugin_job);
        g_task_set_task_data (task, helper, (GDestroyNotify) gs_plugin_loader_helper_free);
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index 99f9b76a3..3e8c3cc92 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -271,7 +271,6 @@ typedef enum {
  * @GS_PLUGIN_ACTION_URL_TO_APP:               Convert the URI to an application
  * @GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL:    Get the list of historical updates
  * @GS_PLUGIN_ACTION_DOWNLOAD:                 Download an application
- * @GS_PLUGIN_ACTION_GET_ALTERNATES:           Get the alternates for a specific application
  * @GS_PLUGIN_ACTION_GET_LANGPACKS:            Get appropriate language pack
  * @GS_PLUGIN_ACTION_INSTALL_REPO:             Install a repository (Since: 41)
  * @GS_PLUGIN_ACTION_REMOVE_REPO:              Remove a repository (Since: 41)
@@ -297,7 +296,6 @@ typedef enum {
        GS_PLUGIN_ACTION_URL_TO_APP,
        GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL,
        GS_PLUGIN_ACTION_DOWNLOAD,
-       GS_PLUGIN_ACTION_GET_ALTERNATES,
        GS_PLUGIN_ACTION_GET_LANGPACKS,
        GS_PLUGIN_ACTION_INSTALL_REPO,
        GS_PLUGIN_ACTION_REMOVE_REPO,
diff --git a/lib/gs-plugin-vfuncs.h b/lib/gs-plugin-vfuncs.h
index 03b091f94..a69864528 100644
--- a/lib/gs-plugin-vfuncs.h
+++ b/lib/gs-plugin-vfuncs.h
@@ -84,27 +84,6 @@ gboolean      gs_plugin_add_search_what_provides     (GsPlugin       *plugin,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 
-/**
- * gs_plugin_add_alternates
- * @plugin: a #GsPlugin
- * @app: a #GsApp
- * @list: a #GsAppList
- * @cancellable: a #GCancellable, or %NULL
- * @error: a #GError, or %NULL
- *
- * Called when trying to find alternates to a specific app, for instance
- * finding a flatpak version of an existing distro packaged application.
- *
- * Plugins are expected to add new apps using gs_app_list_add().
- *
- * Returns: %TRUE for success or if not relevant
- **/
-gboolean        gs_plugin_add_alternates               (GsPlugin       *plugin,
-                                                        GsApp          *app,
-                                                        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 68064c377..2dcb9190c 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1465,8 +1465,6 @@ gs_plugin_action_to_function_name (GsPluginAction action)
                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_ALTERNATES)
-               return "gs_plugin_add_alternates";
        if (action == GS_PLUGIN_ACTION_GET_LANGPACKS)
                return "gs_plugin_add_langpacks";
        return NULL;
@@ -1515,8 +1513,6 @@ gs_plugin_action_to_string (GsPluginAction action)
                return "url-to-app";
        if (action == GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL)
                return "get-updates-historical";
-       if (action == GS_PLUGIN_ACTION_GET_ALTERNATES)
-               return "get-alternates";
        if (action == GS_PLUGIN_ACTION_GET_LANGPACKS)
                return "get-langpacks";
        if (action == GS_PLUGIN_ACTION_INSTALL_REPO)
@@ -1573,8 +1569,6 @@ gs_plugin_action_from_string (const gchar *action)
                return GS_PLUGIN_ACTION_URL_TO_APP;
        if (g_strcmp0 (action, "get-updates-historical") == 0)
                return GS_PLUGIN_ACTION_GET_UPDATES_HISTORICAL;
-       if (g_strcmp0 (action, "get-alternates") == 0)
-               return GS_PLUGIN_ACTION_GET_ALTERNATES;
        if (g_strcmp0 (action, "get-langpacks") == 0)
                return GS_PLUGIN_ACTION_GET_LANGPACKS;
        if (g_strcmp0 (action, "repo-install") == 0)


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