[gnome-control-center] shell: Use X-GNOME-Settings-Panel key value for the command line parameter



commit d36df5e3e43f071c83f4c01b523e5407356c14fd
Author: Thomas Wood <thomas wood intel com>
Date:   Wed Jun 2 17:53:42 2010 +0100

    shell: Use X-GNOME-Settings-Panel key value for the command line parameter
    
    Read the X-GNOME-Settings-Panel key from the desktop file to start the
    correct panel from the command line parameter.

 shell/gnome-control-center.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 2c57e93..fcf925f 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -44,6 +44,8 @@ G_DEFINE_TYPE (GnomeControlCenter, gnome_control_center, CC_TYPE_SHELL)
 
 #define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
 
+#define GNOME_SETTINGS_PANEL_ID_KEY "X-GNOME-Settings-Panel"
+
 enum
 {
   OVERVIEW_PAGE,
@@ -101,7 +103,7 @@ activate_panel (GnomeControlCenter *shell,
   g_key_file_load_from_file (key_file, desktop_file, 0, &err);
 
   panel_id = g_key_file_get_string (key_file, "Desktop Entry",
-                                    "X-GNOME-Settings-Panel", NULL);
+                                    GNOME_SETTINGS_PANEL_ID_KEY, NULL);
 
   if (panel_id)
     {
@@ -122,6 +124,9 @@ activate_panel (GnomeControlCenter *shell,
             }
         }
 
+      g_free (panel_id);
+      panel_id = NULL;
+
       if (panel_type != G_TYPE_INVALID)
         {
           GtkWidget *panel;
@@ -712,14 +717,26 @@ _shell_set_active_panel_from_id (CcShell      *shell,
   /* find the details for this item */
   while (iter_valid)
     {
+      GKeyFile *key_file;
       gchar *id;
 
       gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
                           COL_NAME, &name,
-                          COL_ID, &id,
                           COL_DESKTOP_FILE, &desktop,
                           COL_ICON_NAME, &icon_name,
                           -1);
+
+      /* load the .desktop file since gnome-menus doesn't have a way to read
+       * custom properties from desktop files */
+
+      key_file = g_key_file_new ();
+      g_key_file_load_from_file (key_file, desktop, 0, NULL);
+
+      id = g_key_file_get_string (key_file, "Desktop Entry",
+                                  GNOME_SETTINGS_PANEL_ID_KEY, NULL);
+      g_key_file_free (key_file);
+      key_file = NULL;
+
       if (id && !strcmp (id, start_id))
         {
           g_free (id);



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