Commit a7412dfa authored by Sébastien Bacher's avatar Sébastien Bacher Committed by Vincent Untz

[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
parent a511d24b
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment