[gnome-software] Only show one alternate application in most application pages



commit d81d12402af69c31d8d06dff904ff03e11fe2c9b
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 28 12:32:41 2018 +0100

    Only show one alternate application in most application pages
    
    Not deduplicated done are the installed page and the updates page.

 src/gs-category-page.c         |  4 ++++
 src/gs-extras-page.c           |  6 +++---
 src/gs-installed-page.c        |  1 +
 src/gs-overview-page.c         | 17 ++++++++++++-----
 src/gs-search-page.c           |  2 ++
 src/gs-shell-search-provider.c |  2 ++
 src/gs-updates-page.c          |  3 ++-
 7 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 037f3275..45524beb 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -306,6 +306,8 @@ gs_category_page_set_featured_apps (GsCategoryPage *self)
                                         "category", featured_subcat,
                                         "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                        GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                         NULL);
        gs_plugin_loader_job_process_async (self->plugin_loader,
                                            plugin_job,
@@ -385,6 +387,8 @@ gs_category_page_reload (GsPage *page)
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                        GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                         NULL);
        gs_plugin_job_set_sort_func (plugin_job, _max_results_sort_cb);
        gs_plugin_loader_job_process_async (self->plugin_loader,
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index 14b25b63..62b759fe 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -690,7 +690,7 @@ gs_extras_page_load (GsExtrasPage *self, GPtrArray *array_search_data)
                        g_autoptr(GsPluginJob) plugin_job = NULL;
                        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH_FILES,
                                                         "search", search_data->search_filename,
-                                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
+                                                        "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
                                                                         
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                                         
GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
                                                         NULL);
@@ -706,7 +706,7 @@ gs_extras_page_load (GsExtrasPage *self, GPtrArray *array_search_data)
                        file = g_file_new_for_path (search_data->package_filename);
                        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_FILE_TO_APP,
                                                         "file", file,
-                                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
+                                                        "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
                                                                         
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                                         
GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
                                                         NULL);
@@ -720,7 +720,7 @@ gs_extras_page_load (GsExtrasPage *self, GPtrArray *array_search_data)
                        g_debug ("searching what provides: '%s'", search_data->search);
                        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_SEARCH_PROVIDES,
                                                         "search", search_data->search,
-                                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
+                                                        "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
                                                                         
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
                                                                         
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
                                                                         
GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c
index a411e574..9cc17643 100644
--- a/src/gs-installed-page.c
+++ b/src/gs-installed-page.c
@@ -280,6 +280,7 @@ gs_installed_page_load (GsInstalledPage *self)
        /* get installed apps */
        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_INSTALLED,
                                         "refine-flags", flags,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_NONE,
                                         NULL);
        gs_plugin_loader_job_process_async (self->plugin_loader,
                                            plugin_job,
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 81d27000..24d74f61 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -767,6 +767,8 @@ gs_overview_page_load (GsOverviewPage *self)
                plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_FEATURED,
                                                 "max-results", 5,
                                                 "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                                "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                                GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                                 NULL);
                gs_plugin_loader_job_process_async (priv->plugin_loader,
                                                    plugin_job,
@@ -782,8 +784,10 @@ gs_overview_page_load (GsOverviewPage *self)
                priv->loading_popular = TRUE;
                plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_POPULAR,
                                                 "max-results", 20,
-                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
+                                                "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                                 GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                                "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                                GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                                 NULL);
                gs_plugin_loader_job_process_async (priv->plugin_loader,
                                                    plugin_job,
@@ -800,8 +804,10 @@ gs_overview_page_load (GsOverviewPage *self)
                plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_RECENT,
                                                 "age", (guint64) (60 * 60 * 24 * 60),
                                                 "max-results", 20,
-                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
+                                                "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                                 GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                                "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                                GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                                 NULL);
                gs_plugin_loader_job_process_async (priv->plugin_loader,
                                                    plugin_job,
@@ -843,8 +849,10 @@ gs_overview_page_load (GsOverviewPage *self)
                        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_CATEGORY_APPS,
                                                         "max-results", 20,
                                                         "category", featured_category,
-                                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
+                                                        "refine-flags", 
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
                                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
+                                                        "dedupe-flags", 
GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                                        
GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                                         NULL);
                        gs_plugin_loader_job_process_async (priv->plugin_loader,
                                                            plugin_job,
@@ -859,8 +867,7 @@ gs_overview_page_load (GsOverviewPage *self)
        if (!priv->loading_categories) {
                g_autoptr(GsPluginJob) plugin_job = NULL;
                priv->loading_categories = TRUE;
-               plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_CATEGORIES,
-                                                        NULL);
+               plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_CATEGORIES, NULL);
                gs_plugin_loader_job_get_categories_async (priv->plugin_loader, plugin_job,
                                                          priv->cancellable,
                                                          gs_overview_page_get_categories_cb,
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index e5fe2405..9cb60550 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -274,6 +274,8 @@ gs_search_page_load (GsSearchPage *self)
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                        GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                         NULL);
        gs_plugin_job_set_sort_func (plugin_job, gs_search_page_sort_cb);
        gs_plugin_job_set_sort_func_data (plugin_job, self);
diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
index fa473b2c..88bec30b 100644
--- a/src/gs-shell-search-provider.c
+++ b/src/gs-shell-search-provider.c
@@ -189,6 +189,8 @@ execute_search (GsShellSearchProvider  *self,
                                         "refine-flags", GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
                                                         GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME,
                                         "max-results", GS_SHELL_SEARCH_PROVIDER_MAX_RESULTS,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED |
+                                                        GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES,
                                         NULL);
        gs_plugin_job_set_sort_func (plugin_job, gs_shell_search_provider_sort_cb);
        gs_plugin_job_set_sort_func_data (plugin_job, self);
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index c753957f..559b5f44 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -677,6 +677,7 @@ gs_updates_page_load (GsUpdatesPage *self)
        self->action_cnt++;
        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_UPDATES,
                                         "refine-flags", refine_flags,
+                                        "dedupe-flags", GS_APP_LIST_FILTER_FLAG_NONE,
                                         NULL);
        gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job,
                                            self->cancellable,
@@ -701,7 +702,7 @@ gs_updates_page_load (GsUpdatesPage *self)
                g_object_unref (plugin_job);
                plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_GET_DISTRO_UPDATES,
                                                 "refine-flags", refine_flags,
-                                                        NULL);
+                                                NULL);
                gs_plugin_loader_job_process_async (self->plugin_loader,
                                                    plugin_job,
                                                    self->cancellable,


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