[gnome-control-center/wip/gbsneto/sidelist-groups: 1/4] shell-model: introduce new categories



commit 1df8f5e0229c6587210b9c566e8b8f3ce9872fe7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Jun 6 14:07:25 2016 -0300

    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 de9c5df..03dbfb1 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 bf24173..8680d8c 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]