[gnome-control-center] shell-model: Add hidden settings



commit 1485b50a7a25fc4353e4cc432c94530d9b03732e
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Sat Jun 10 20:38:46 2017 +0530

    shell-model: Add hidden settings
    
    Some panels shall be shown only in current design, And some other panels
    shall be shown only in new Shell design. So let's have a code that
    would help us do that
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779216

 shell/cc-panel-loader.c |   15 ++++++++++++---
 shell/cc-shell-model.h  |    1 +
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 9582d80..4ed994d 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -129,7 +129,9 @@ parse_categories (GDesktopAppInfo *app)
 #define const_strv(s) ((const gchar* const*) s)
 
 #ifdef CC_ENABLE_ALT_CATEGORIES
-  if (g_strv_contains (const_strv (split), "X-GNOME-ConnectivitySettings"))
+  if (g_strv_contains (const_strv (split), "X-GNOME-AltHidden"))
+    retval = CC_CATEGORY_HIDDEN;
+  else 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;
@@ -142,7 +144,9 @@ parse_categories (GDesktopAppInfo *app)
   else if (g_strv_contains (const_strv (split), "HardwareSettings"))
     retval = CC_CATEGORY_HARDWARE;
 #else
-  if (g_strv_contains (const_strv (split), "HardwareSettings"))
+  if (g_strv_contains (const_strv (split), "X-GNOME-Hidden"))
+    retval = CC_CATEGORY_HIDDEN;
+  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;
@@ -189,7 +193,12 @@ cc_panel_loader_fill_model (CcShellModel *model)
       if (G_UNLIKELY (category < 0))
         continue;
 
-      cc_shell_model_add_item (model, category, G_APP_INFO (app), all_panels[i].name);
+      /* Only add the panel when it is not hidden, e.g. the Details subpanels
+       * that are only visible in the new Shell.
+       */
+      if (category != CC_CATEGORY_HIDDEN)
+        cc_shell_model_add_item (model, category, G_APP_INFO (app), all_panels[i].name);
+
       g_object_unref (app);
     }
 }
diff --git a/shell/cc-shell-model.h b/shell/cc-shell-model.h
index 8680d8c..ca0e913 100644
--- a/shell/cc-shell-model.h
+++ b/shell/cc-shell-model.h
@@ -66,6 +66,7 @@ typedef enum {
   CC_CATEGORY_HARDWARE,
 #endif
 
+  CC_CATEGORY_HIDDEN,
   CC_CATEGORY_LAST
 } CcPanelCategory;
 


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