[gnome-control-center] shell: Use the X-GNOME-Settings-Panel value to identify panels
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Use the X-GNOME-Settings-Panel value to identify panels
- Date: Wed, 2 Jun 2010 17:13:31 +0000 (UTC)
commit d91e466f93456c056d6afff6619e39fa66cc8177
Author: Thomas Wood <thomas wood intel com>
Date: Wed Jun 2 16:20:45 2010 +0100
shell: Use the X-GNOME-Settings-Panel value to identify panels
Use the custom .desktop file field to identify panels and make sure the
panel implementations use the name to identify themselves.
examples/cc-example-panel.c | 2 +-
.../cc-default-applications-panel.c | 2 +-
panels/keybindings/cc-keybindings-panel.c | 2 +-
panels/keyboard/cc-keyboard-panel.c | 2 +-
panels/mouse/cc-mouse-panel.c | 2 +-
panels/network/cc-network-panel.c | 2 +-
shell/gnome-control-center.c | 91 +++++++++++--------
7 files changed, 59 insertions(+), 44 deletions(-)
---
diff --git a/examples/cc-example-panel.c b/examples/cc-example-panel.c
index 64727f7..979414d 100644
--- a/examples/cc-example-panel.c
+++ b/examples/cc-example-panel.c
@@ -106,6 +106,6 @@ cc_example_panel_register (GIOModule *module)
cc_example_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_EXAMPLE_PANEL,
- "gnome-example-panel.desktop", 0);
+ "example-panel", 0);
}
diff --git a/panels/default-applications/cc-default-applications-panel.c b/panels/default-applications/cc-default-applications-panel.c
index b31a944..fc077e8 100644
--- a/panels/default-applications/cc-default-applications-panel.c
+++ b/panels/default-applications/cc-default-applications-panel.c
@@ -127,6 +127,6 @@ cc_default_applications_panel_register (GIOModule *module)
cc_default_applications_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_DEFAULT_APPLICATIONS_PANEL,
- "default-applications.desktop", 0);
+ "default-applications", 0);
}
diff --git a/panels/keybindings/cc-keybindings-panel.c b/panels/keybindings/cc-keybindings-panel.c
index a4479f9..a128fba 100644
--- a/panels/keybindings/cc-keybindings-panel.c
+++ b/panels/keybindings/cc-keybindings-panel.c
@@ -125,6 +125,6 @@ cc_keybindings_panel_register (GIOModule *module)
cc_keybindings_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_KEYBINDINGS_PANEL,
- "keybinding.desktop", 0);
+ "keybinding", 0);
}
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 442f98d..1616cd8 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -135,5 +135,5 @@ cc_keyboard_panel_register (GIOModule * module)
cc_keyboard_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_KEYBOARD_PANEL,
- "keyboard.desktop", 0);
+ "keyboard", 0);
}
diff --git a/panels/mouse/cc-mouse-panel.c b/panels/mouse/cc-mouse-panel.c
index c3d7d9b..e52e191 100644
--- a/panels/mouse/cc-mouse-panel.c
+++ b/panels/mouse/cc-mouse-panel.c
@@ -142,6 +142,6 @@ cc_mouse_panel_register (GIOModule *module)
cc_mouse_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_MOUSE_PANEL,
- "gnome-settings-mouse.desktop", 0);
+ "mouse", 0);
}
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index f7d8630..0393c4f 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -132,6 +132,6 @@ cc_network_panel_register (GIOModule *module)
cc_network_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_NETWORK_PANEL,
- "gnome-network-properties.desktop", 0);
+ "network", 0);
}
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index cef8921..2c57e93 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -77,7 +77,7 @@ struct _GnomeControlCenterPrivate
static void
activate_panel (GnomeControlCenter *shell,
- const gchar *id,
+ const gchar *nid,
const gchar *desktop_file,
const gchar *name,
const gchar *icon_name)
@@ -89,72 +89,89 @@ activate_panel (GnomeControlCenter *shell,
GKeyFile *key_file;
GType panel_type = G_TYPE_INVALID;
GList *panels, *l;
+ gchar *panel_id;
/* check if there is an plugin that implements this panel */
panels = g_io_extension_point_get_extensions (priv->extension_point);
- for (l = panels; l != NULL; l = l->next)
- {
- GIOExtension *extension;
- const gchar *name;
+ if (!desktop_file)
+ return;
- extension = l->data;
+ key_file = g_key_file_new ();
+ 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);
- name = g_io_extension_get_name (extension);
+ if (panel_id)
+ {
- if (!g_strcmp0 (name, id))
+ for (l = panels; l != NULL; l = l->next)
{
- panel_type = g_io_extension_get_type (extension);
- break;
+ GIOExtension *extension;
+ const gchar *name;
+
+ extension = l->data;
+
+ name = g_io_extension_get_name (extension);
+
+ if (!g_strcmp0 (name, panel_id))
+ {
+ panel_type = g_io_extension_get_type (extension);
+ break;
+ }
}
- }
- if (panel_type != G_TYPE_INVALID)
- {
- GtkWidget *panel;
- GtkWidget *box;
- gint i;
+ if (panel_type != G_TYPE_INVALID)
+ {
+ GtkWidget *panel;
+ GtkWidget *box;
+ gint i;
- /* create the panel plugin */
- panel = g_object_new (panel_type, "shell", shell, NULL);
+ /* create the panel plugin */
+ panel = g_object_new (panel_type, "shell", shell, NULL);
- box = gtk_alignment_new (0, 0, 1, 1);
- gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6);
+ box = gtk_alignment_new (0, 0, 1, 1);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6);
- gtk_container_add (GTK_CONTAINER (box), panel);
+ gtk_container_add (GTK_CONTAINER (box), panel);
- /* switch to the new panel */
- i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box, NULL);
- gtk_widget_show_all (box);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
+ /* switch to the new panel */
+ i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box, NULL);
+ gtk_widget_show_all (box);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
- /* set the title of the window */
- gtk_window_set_title (GTK_WINDOW (priv->window), name);
- gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
+ /* set the title of the window */
+ gtk_window_set_title (GTK_WINDOW (priv->window), name);
+ gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
- return;
+ g_key_file_free (key_file);
+ key_file = NULL;
+
+ return;
+ }
}
/* if a plugin was not found, then start app directly */
- if (!desktop_file)
- return;
-
- key_file = g_key_file_new ();
- g_key_file_load_from_file (key_file, desktop_file, 0, &err);
if (err)
{
- g_warning ("Error starting \"%s\": %s", id, err->message);
+ g_warning ("Error starting \"%s\": %s", desktop_file, err->message);
g_error_free (err);
err = NULL;
+
+ g_key_file_free (key_file);
+ key_file = NULL;
+
return;
}
appinfo = (GAppInfo*) g_desktop_app_info_new_from_keyfile (key_file);
g_key_file_free (key_file);
+ key_file = NULL;
ctx = gdk_app_launch_context_new ();
@@ -168,7 +185,7 @@ activate_panel (GnomeControlCenter *shell,
if (err)
{
- g_warning ("Error starting \"%s\": %s", id, err->message);
+ g_warning ("Error starting \"%s\": %s", desktop_file, err->message);
g_error_free (err);
err = NULL;
}
@@ -191,8 +208,6 @@ shell_show_overview_page (GnomeControlCenterPrivate *priv)
gtk_window_set_title (GTK_WINDOW (priv->window), priv->default_window_title);
gtk_window_set_icon_name (GTK_WINDOW (priv->window),
priv->default_window_icon);
-
- g_debug ("%s %s", priv->default_window_title, priv->default_window_icon);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]