[gnome-software/wip/ubuntu-master: 60/60] Sort category snaps before other packages
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/ubuntu-master: 60/60] Sort category snaps before other packages
- Date: Mon, 22 Jan 2018 04:03:16 +0000 (UTC)
commit 3e3edadb82d1dfed2fddabcebf61a373e9962eb8
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Jan 22 16:50:29 2018 +1300
Sort category snaps before other packages
src/gs-category-page.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index 1a01bf2..0a224dc 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -176,6 +176,8 @@ gs_category_page_get_apps_cb (GObject *source_object,
static gboolean
_max_results_sort_cb (GsApp *app1, GsApp *app2, gpointer user_data)
{
+ if (gs_app_get_bundle_kind (app1) == AS_BUNDLE_KIND_SNAP || gs_app_get_bundle_kind (app2) ==
AS_BUNDLE_KIND_SNAP)
+ return gs_app_get_bundle_kind (app1) == AS_BUNDLE_KIND_SNAP ? -1 : 1;
return gs_app_get_rating (app1) < gs_app_get_rating (app2);
}
@@ -196,8 +198,13 @@ gs_category_page_sort_flow_box_sort_func (GtkFlowBoxChild *child1,
sort_type = GS_CATEGORY_PAGE (data)->sort_type;
if (sort_type == SUBCATEGORY_SORT_TYPE_RATING) {
- gint rating_app1 = gs_app_get_rating (app1);
- gint rating_app2 = gs_app_get_rating (app2);
+ gint rating_app1, rating_app2;
+
+ if (gs_app_get_bundle_kind (app1) == AS_BUNDLE_KIND_SNAP || gs_app_get_bundle_kind (app2) ==
AS_BUNDLE_KIND_SNAP)
+ return gs_app_get_bundle_kind (app1) == AS_BUNDLE_KIND_SNAP ? -1 : 1;
+
+ rating_app1 = gs_app_get_rating (app1);
+ rating_app2 = gs_app_get_rating (app2);
if (rating_app1 > rating_app2)
return -1;
if (rating_app1 < rating_app2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]