[gnome-software: 1/5] gs-installed-page: Add installed page sections to mirror all sort keys
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/5] gs-installed-page: Add installed page sections to mirror all sort keys
- Date: Tue, 30 Mar 2021 15:50:43 +0000 (UTC)
commit 137535905c89ed6672341fe4cad69362ffa6f374
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Mar 18 12:22:25 2021 +0000
gs-installed-page: Add installed page sections to mirror all sort keys
If the list of apps is being sorted into several different groups, there
needs to be a `GsInstalledPageSection` for each group, otherwise there’s
no way to label each group properly.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1175
src/gs-installed-page.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c
index 21bb128e5..e4e641691 100644
--- a/src/gs-installed-page.c
+++ b/src/gs-installed-page.c
@@ -408,21 +408,33 @@ gs_installed_page_sort_func (GtkListBoxRow *a,
}
typedef enum {
+ GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING,
GS_UPDATE_LIST_SECTION_REMOVABLE_APPS,
GS_UPDATE_LIST_SECTION_SYSTEM_APPS,
GS_UPDATE_LIST_SECTION_ADDONS,
GS_UPDATE_LIST_SECTION_LAST
} GsInstalledPageSection;
+/* This must mostly mirror gs_installed_page_get_app_sort_key() otherwise apps
+ * will end up sorted into a section they don’t belong in. */
static GsInstalledPageSection
gs_installed_page_get_app_section (GsApp *app)
{
- if (gs_app_get_kind (app) == AS_COMPONENT_KIND_DESKTOP_APP ||
- gs_app_get_kind (app) == AS_COMPONENT_KIND_WEB_APP) {
+ GsAppState state = gs_app_get_state (app);
+ AsComponentKind kind = gs_app_get_kind (app);
+
+ if (state == GS_APP_STATE_INSTALLING ||
+ state == GS_APP_STATE_QUEUED_FOR_INSTALL ||
+ state == GS_APP_STATE_REMOVING)
+ return GS_UPDATE_LIST_SECTION_INSTALLING_AND_REMOVING;
+
+ if (kind == AS_COMPONENT_KIND_DESKTOP_APP ||
+ kind == AS_COMPONENT_KIND_WEB_APP) {
if (gs_app_has_quirk (app, GS_APP_QUIRK_COMPULSORY))
return GS_UPDATE_LIST_SECTION_SYSTEM_APPS;
return GS_UPDATE_LIST_SECTION_REMOVABLE_APPS;
}
+
return GS_UPDATE_LIST_SECTION_ADDONS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]