summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2010-06-02 17:53:42 +0100
committerThomas Wood <thomas.wood@intel.com>2010-06-02 17:53:42 +0100
commitd36df5e3e43f071c83f4c01b523e5407356c14fd (patch)
treee74d1fc63c08ee37a318e86e3c79c112d9b279f6 /shell
parent847bbba2b88179f30416819b78941b34fb9cc749 (diff)
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.
Diffstat (limited to 'shell')
-rw-r--r--shell/gnome-control-center.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 2c57e9345..fcf925f1a 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);