[gnome-control-center] shell: Flatten activate_panel()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Flatten activate_panel()
- Date: Wed, 9 May 2012 15:10:34 +0000 (UTC)
commit d25563f5c475fcc86740539013640178faea8e3e
Author: Bastien Nocera <hadess hadess net>
Date: Mon Apr 30 17:00:33 2012 +0100
shell: Flatten activate_panel()
And exit as soon as we fail.
shell/gnome-control-center.c | 88 +++++++++++++++++++-----------------------
1 files changed, 40 insertions(+), 48 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index c87a7da..fbd0418 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -120,75 +120,67 @@ activate_panel (GnomeControlCenter *shell,
GnomeControlCenterPrivate *priv = shell->priv;
GType panel_type = G_TYPE_INVALID;
GList *panels, *l;
+ GtkWidget *panel;
+ GtkWidget *box;
+ gint i;
+ const gchar *icon_name;
/* check if there is an plugin that implements this panel */
panels = g_io_extension_point_get_extensions (priv->extension_point);
if (!desktop_file)
return;
+ if (!id)
+ return;
- if (id)
+ for (l = panels; l != NULL; l = l->next)
{
+ GIOExtension *extension;
+ const gchar *name;
- for (l = panels; l != NULL; l = l->next)
- {
- GIOExtension *extension;
- const gchar *name;
-
- extension = l->data;
+ extension = l->data;
- name = g_io_extension_get_name (extension);
-
- if (!g_strcmp0 (name, id))
- {
- panel_type = g_io_extension_get_type (extension);
- break;
- }
- }
+ name = g_io_extension_get_name (extension);
- if (panel_type != G_TYPE_INVALID)
+ if (!g_strcmp0 (name, id))
{
- GtkWidget *panel;
- GtkWidget *box;
- gint i;
- const gchar *icon_name;
-
- /* create the panel plugin */
- panel = g_object_new (panel_type, "shell", shell, "argv", argv, NULL);
+ panel_type = g_io_extension_get_type (extension);
+ break;
+ }
+ }
- gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button),
- cc_panel_get_permission (CC_PANEL (panel)));
+ if (panel_type == G_TYPE_INVALID)
+ {
+ g_warning ("Could not find the loadable module for panel '%s'", id);
+ return;
+ }
- box = gtk_alignment_new (0, 0, 1, 1);
- gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6);
+ /* create the panel plugin */
+ panel = g_object_new (panel_type, "shell", shell, "argv", argv, NULL);
- gtk_container_add (GTK_CONTAINER (box), panel);
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (priv->lock_button),
+ cc_panel_get_permission (CC_PANEL (panel)));
- i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box,
- NULL);
+ box = gtk_alignment_new (0, 0, 1, 1);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (box), 6, 6, 6, 6);
- /* switch to the new panel */
- gtk_widget_show (box);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
+ gtk_container_add (GTK_CONTAINER (box), panel);
- /* set the title of the window */
- icon_name = get_icon_name_from_g_icon (gicon);
- gtk_window_set_role (GTK_WINDOW (priv->window), id);
- gtk_window_set_title (GTK_WINDOW (priv->window), name);
- gtk_window_set_default_icon_name (icon_name);
- gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
+ i = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), box,
+ NULL);
- gtk_widget_show (panel);
+ /* switch to the new panel */
+ gtk_widget_show (box);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), i);
- priv->current_panel = box;
+ /* set the title of the window */
+ icon_name = get_icon_name_from_g_icon (gicon);
+ gtk_window_set_role (GTK_WINDOW (priv->window), id);
+ gtk_window_set_title (GTK_WINDOW (priv->window), name);
+ gtk_window_set_default_icon_name (icon_name);
+ gtk_window_set_icon_name (GTK_WINDOW (priv->window), icon_name);
- return;
- }
- else
- {
- g_warning ("Could not find the loadable module for panel '%s'", id);
- }
- }
+ priv->current_panel = box;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]