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
This commit is contained in:
Georges Basile Stavracas Neto 2016-06-06 14:07:25 -03:00
parent 8e414f88b1
commit 27ce5b388f
2 changed files with 36 additions and 11 deletions

View file

@ -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)
#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 (strcmp (split[i], "X-GNOME-PersonalSettings") == 0)
#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 (strcmp (split[i], "X-GNOME-SystemSettings") == 0)
else if (g_strv_contains (const_strv (split), "X-GNOME-SystemSettings"))
retval = CC_CATEGORY_SYSTEM;
}
#endif
#undef const_strv
if (retval < 0)
{

View file

@ -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;