From 27ce5b388f7ebd7e7b8a10b7de42d1a3e48e6e6e Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 6 Jun 2016 14:07:25 -0300 Subject: [PATCH] shell-model: introduce new categories Following the previous set of patches for implementing the next generation Shell, a new set of categories must be added. These new categories will reflect on the ordering of the panels and subpages in the sidelist. This patch adds these new categories and conditionally compiles them, to not break the current icon-based Shell. https://bugzilla.gnome.org/show_bug.cgi?id=767301 --- shell/cc-panel-loader.c | 35 +++++++++++++++++++++++++---------- shell/cc-shell-model.h | 12 +++++++++++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c index de9c5df0e..03dbfb1a6 100644 --- a/shell/cc-panel-loader.c +++ b/shell/cc-panel-loader.c @@ -122,22 +122,37 @@ parse_categories (GDesktopAppInfo *app) const char *categories; char **split; int retval; - int i; categories = g_desktop_app_info_get_categories (app); split = g_strsplit (categories, ";", -1); retval = -1; - for (i = 0; split[i]; i++) - { - if (strcmp (split[i], "HardwareSettings") == 0) - retval = CC_CATEGORY_HARDWARE; - else if (strcmp (split[i], "X-GNOME-PersonalSettings") == 0) - retval = CC_CATEGORY_PERSONAL; - else if (strcmp (split[i], "X-GNOME-SystemSettings") == 0) - retval = CC_CATEGORY_SYSTEM; - } +#define const_strv(s) ((const gchar* const*) s) + +#ifdef CC_ENABLE_ALT_CATEGORIES + if (g_strv_contains (const_strv (split), "X-GNOME-ConnectivitySettings")) + retval = CC_CATEGORY_CONNECTIVITY; + else if (g_strv_contains (const_strv (split), "X-GNOME-PersonalizationSettings")) + retval = CC_CATEGORY_PERSONALIZATION; + else if (g_strv_contains (const_strv (split), "X-GNOME-AccountSettings")) + retval = CC_CATEGORY_ACCOUNT; + else if (g_strv_contains (const_strv (split), "X-GNOME-DevicesSettings")) + retval = CC_CATEGORY_DEVICES; + else if (g_strv_contains (const_strv (split), "X-GNOME-DetailsSettings")) + retval = CC_CATEGORY_DETAILS; + else if (g_strv_contains (const_strv (split), "HardwareSettings")) + retval = CC_CATEGORY_HARDWARE; +#else + if (g_strv_contains (const_strv (split), "HardwareSettings")) + retval = CC_CATEGORY_HARDWARE; + else if (g_strv_contains (const_strv (split), "X-GNOME-PersonalSettings")) + retval = CC_CATEGORY_PERSONAL; + else if (g_strv_contains (const_strv (split), "X-GNOME-SystemSettings")) + retval = CC_CATEGORY_SYSTEM; +#endif + +#undef const_strv if (retval < 0) { diff --git a/shell/cc-shell-model.h b/shell/cc-shell-model.h index bf24173a8..8680d8cdf 100644 --- a/shell/cc-shell-model.h +++ b/shell/cc-shell-model.h @@ -53,9 +53,19 @@ typedef struct _CcShellModelClass CcShellModelClass; typedef struct _CcShellModelPrivate CcShellModelPrivate; typedef enum { - CC_CATEGORY_PERSONAL, +#ifdef CC_ENABLE_ALT_CATEGORIES + CC_CATEGORY_CONNECTIVITY, + CC_CATEGORY_PERSONALIZATION, + CC_CATEGORY_ACCOUNT, CC_CATEGORY_HARDWARE, + CC_CATEGORY_DEVICES, + CC_CATEGORY_DETAILS, +#else + CC_CATEGORY_PERSONAL, CC_CATEGORY_SYSTEM, + CC_CATEGORY_HARDWARE, +#endif + CC_CATEGORY_LAST } CcPanelCategory;