[gnome-control-center/extensible-shell] keyboard: initialise the panel only when first activated



commit 3fd64e28cda0afdeead8b0bb40d765b015de7d79
Author: Thomas Wood <thomas wood intel com>
Date:   Tue Mar 23 10:07:09 2010 +0000

    keyboard: initialise the panel only when first activated
    
    This improves the shell start up time by not initialising the panel at
    the time the extension is loaded. Instead, initialisation can be done when
    the panel is first activated.

 capplets/keyboard/cc-keyboard-panel.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/capplets/keyboard/cc-keyboard-panel.c b/capplets/keyboard/cc-keyboard-panel.c
index 140dd53..4f70a86 100644
--- a/capplets/keyboard/cc-keyboard-panel.c
+++ b/capplets/keyboard/cc-keyboard-panel.c
@@ -100,11 +100,18 @@ on_notebook_switch_page (GtkNotebook     *notebook,
 }
 
 static void
-setup_panel (CcKeyboardPanel *panel)
+setup_panel (CcKeyboardPanel *panel,
+             gboolean         is_active)
 {
+        static gboolean initialised = FALSE;
         GtkWidget *label;
         char      *display_name;
 
+        if (initialised)
+                return;
+
+        initialised = TRUE;
+
         panel->priv->notebook = gtk_notebook_new ();
         g_signal_connect (panel->priv->notebook,
                           "switch-page",
@@ -157,8 +164,6 @@ cc_keyboard_panel_constructor (GType                  type,
                       "id", "keyboard.desktop",
                       NULL);
 
-        setup_panel (keyboard_panel);
-
         return G_OBJECT (keyboard_panel);
 }
 
@@ -194,6 +199,11 @@ cc_keyboard_panel_init (CcKeyboardPanel *panel)
         gconf_client_add_dir (client, "/desktop/gnome/interface",
                               GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
         g_object_unref (client);
+
+
+        g_signal_connect (panel, "active-changed", G_CALLBACK (setup_panel),
+                          NULL);
+
 }
 
 static void



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