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



commit 9c38586a28fa2717630b8183b1bd1f7ba0a4c29d
Author: Thomas Wood <thomas wood intel com>
Date:   Tue Mar 23 10:02:53 2010 +0000

    appearance: 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/appearance/cc-appearance-panel.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/capplets/appearance/cc-appearance-panel.c b/capplets/appearance/cc-appearance-panel.c
index 6479106..7023e36 100644
--- a/capplets/appearance/cc-appearance-panel.c
+++ b/capplets/appearance/cc-appearance-panel.c
@@ -1,6 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
  *
  * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010 Intel, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -131,11 +132,19 @@ on_notebook_switch_page (GtkNotebook       *notebook,
 }
 
 static void
-setup_panel (CcAppearancePanel *panel)
+setup_panel (CcAppearancePanel *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",
@@ -193,8 +202,6 @@ cc_appearance_panel_constructor (GType                  type,
                       "id", "gnome-appearance-properties.desktop",
                       NULL);
 
-        setup_panel (appearance_panel);
-
         return G_OBJECT (appearance_panel);
 }
 
@@ -220,6 +227,9 @@ static void
 cc_appearance_panel_init (CcAppearancePanel *panel)
 {
         panel->priv = CC_APPEARANCE_PANEL_GET_PRIVATE (panel);
+
+        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]