[gnome-software] Make category name sorting case insensitive
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Make category name sorting case insensitive
- Date: Mon, 22 Jan 2018 03:57:30 +0000 (UTC)
commit 101da4b3ec219ede691e6d6b754b5590b05a8afd
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Jan 22 16:47:12 2018 +1300
Make category name sorting case insensitive
src/gs-category-page.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index beea2ed..1a01bf2 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -187,6 +187,8 @@ gs_category_page_sort_flow_box_sort_func (GtkFlowBoxChild *child1,
GsApp *app1 = gs_app_tile_get_app (GS_APP_TILE (gtk_bin_get_child (GTK_BIN (child1))));
GsApp *app2 = gs_app_tile_get_app (GS_APP_TILE (gtk_bin_get_child (GTK_BIN (child2))));
SubcategorySortType sort_type;
+ g_autofree gchar *casefolded_name1 = NULL;
+ g_autofree gchar *casefolded_name2 = NULL;
if (!GS_IS_APP (app1) || !GS_IS_APP (app2))
return 0;
@@ -201,7 +203,12 @@ gs_category_page_sort_flow_box_sort_func (GtkFlowBoxChild *child1,
if (rating_app1 < rating_app2)
return 1;
}
- return g_strcmp0 (gs_app_get_name (app1), gs_app_get_name (app2));
+
+ if (gs_app_get_name (app1) != NULL)
+ casefolded_name1 = g_utf8_casefold (gs_app_get_name (app1), -1);
+ if (gs_app_get_name (app2) != NULL)
+ casefolded_name2 = g_utf8_casefold (gs_app_get_name (app2), -1);
+ return g_strcmp0 (casefolded_name1, casefolded_name2);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]