[gnome-panel] [panel] Load applets in a high-priority idle loop on startup



commit a7412dfa955f5f27550e160d00c1e980231b9126
Author: Sébastien Bacher <seb128 ubuntu com>
Date:   Wed Jan 27 16:32:51 2010 +0100

    [panel] Load applets in a high-priority idle loop on startup
    
    Since we don't care about the toplevel redraws at startup (they are
    hidden), this makes sense.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=608254

 gnome-panel/applet.c        |   35 +++++++++++++++++++++++------------
 gnome-panel/applet.h        |    2 +-
 gnome-panel/panel-profile.c |    6 +++---
 3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/gnome-panel/applet.c b/gnome-panel/applet.c
index c2932ee..3aa9e68 100644
--- a/gnome-panel/applet.c
+++ b/gnome-panel/applet.c
@@ -1031,25 +1031,36 @@ panel_applet_compare (const PanelAppletToLoad *a,
 }
 
 void
-panel_applet_load_queued_applets (void)
+panel_applet_load_queued_applets (gboolean initial_load)
 {
-	if (!panel_applets_to_load) {
-		panel_applet_queue_initial_unhide_toplevels (NULL);
-		return;
-        } else {
-		/* Install a timeout to make sure we don't block the unhiding
-		 * because of an applet that doesn't load */
-		panel_applet_unhide_toplevels_timeout =
-			g_timeout_add_seconds (UNHIDE_TOPLEVELS_TIMEOUT_SECONDS,
-					       panel_applet_queue_initial_unhide_toplevels,
-					       NULL);
+	if (initial_load) {
+		if (!panel_applets_to_load) {
+			panel_applet_queue_initial_unhide_toplevels (NULL);
+			return;
+		} else {
+			/* Install a timeout to make sure we don't block the
+			 * unhiding because of an applet that doesn't load */
+			panel_applet_unhide_toplevels_timeout =
+				g_timeout_add_seconds (UNHIDE_TOPLEVELS_TIMEOUT_SECONDS,
+						       panel_applet_queue_initial_unhide_toplevels,
+						       NULL);
+		}
 	}
 
 	panel_applets_to_load = g_slist_sort (panel_applets_to_load,
 					      (GCompareFunc) panel_applet_compare);
 
 	if ( ! panel_applet_have_load_idle) {
-		g_idle_add (panel_applet_load_idle_handler, NULL);
+		/* on panel startup, we don't care about redraws of the
+		 * toplevels since they are hidden, so we give a higher
+		 * priority to loading of applets */
+		if (initial_load)
+			g_idle_add_full (G_PRIORITY_HIGH_IDLE,
+					 panel_applet_load_idle_handler,
+					 NULL, NULL);
+		else
+			g_idle_add (panel_applet_load_idle_handler, NULL);
+
 		panel_applet_have_load_idle = TRUE;
 	}
 }
diff --git a/gnome-panel/applet.h b/gnome-panel/applet.h
index 4b5ba47..f60d9a9 100644
--- a/gnome-panel/applet.h
+++ b/gnome-panel/applet.h
@@ -70,7 +70,7 @@ void panel_applet_queue_applet_to_load (const char      *id,
 					int              position,
 					gboolean         right_stick,
 					gboolean         locked);
-void panel_applet_load_queued_applets  (void);
+void panel_applet_load_queued_applets  (gboolean initial_load);
 gboolean panel_applet_on_load_queue    (const char *id);
 
 
diff --git a/gnome-panel/panel-profile.c b/gnome-panel/panel-profile.c
index 99cc8c6..d4fe289 100644
--- a/gnome-panel/panel-profile.c
+++ b/gnome-panel/panel-profile.c
@@ -1831,7 +1831,7 @@ panel_profile_load_and_show_toplevel (GConfClient       *client,
 	}
 
 	if (!loading_queued_applets)
-		panel_applet_load_queued_applets ();
+		panel_applet_load_queued_applets (FALSE);
 }
 
 static void
@@ -2241,7 +2241,7 @@ panel_profile_object_id_list_update (GConfClient       *client,
 	g_slist_free (sublist);
 	g_slist_free (object_ids);
 
-	panel_applet_load_queued_applets ();
+	panel_applet_load_queued_applets (FALSE);
 }
 
 static void
@@ -2538,7 +2538,7 @@ panel_profile_load (void)
 
 	panel_profile_ensure_toplevel_per_screen (client, PANEL_CONFIG_DIR);
 
-	panel_applet_load_queued_applets ();
+	panel_applet_load_queued_applets (TRUE);
 }
 
 static gboolean



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