gnome-panel r11450 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11450 - trunk/gnome-panel
- Date: Tue, 20 Jan 2009 07:29:40 +0000 (UTC)
Author: vuntz
Date: Tue Jan 20 07:29:40 2009
New Revision: 11450
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11450&view=rev
Log:
2009-01-20 Vincent Untz <vuntz gnome org>
First part of smoothing the panel slide-in on login.
Part of bug #554343.
Patch by Ray Strode <rstrode redhat com>, with a few minor bug
fixes/changes from me.
We delay the slide-in until all panel objects are loaded.
* applet.[ch]: (panel_applet_queue_initial_unhide_toplevels): new
(panel_applet_stop_loading): new, when an object has stopped loading,
we look if we should queue an unhide
(panel_applet_load_idle_handler): put the applet that is being loaded
in the list of applets loading, and call panel_applet_stop_loading()
when it makes sense
(panel_applet_load_queued_applets): unhide the panels if there's no
applet to load
* panel-applet-frame.c: (panel_applet_frame_activated): consolidate
freeing stuff in case of error, and call panel_applet_stop_loading()
* panel-toplevel.[ch]: (panel_toplevel_attach_to_widget): an attached
toplevel (ie, drawer) should not have an initial animation
(panel_toplevel_initially_hide): don't queue an unhide here, but still
update the struts
(panel_toplevel_queue_initial_unhide): new
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/applet.c
trunk/gnome-panel/applet.h
trunk/gnome-panel/panel-applet-frame.c
trunk/gnome-panel/panel-toplevel.c
trunk/gnome-panel/panel-toplevel.h
Modified: trunk/gnome-panel/applet.c
==============================================================================
--- trunk/gnome-panel/applet.c (original)
+++ trunk/gnome-panel/applet.c Tue Jan 20 07:29:40 2009
@@ -794,6 +794,7 @@
} PanelAppletToLoad;
static GSList *panel_applets_to_load = NULL;
+static GSList *panel_applets_loading = NULL;
static gboolean panel_applet_have_load_idle = FALSE;
static void
@@ -820,6 +821,41 @@
return FALSE;
}
+/* This doesn't do anything if the initial unhide already happened */
+static gboolean
+panel_applet_queue_initial_unhide_toplevels (gpointer user_data)
+{
+ GSList *l;
+
+ for (l = panel_toplevel_list_toplevels (); l != NULL; l = l->next) {
+ panel_toplevel_queue_initial_unhide ((PanelToplevel *) l->data);
+ }
+
+ return FALSE;
+}
+
+void
+panel_applet_stop_loading (const char *id)
+{
+ PanelAppletToLoad *applet;
+ GSList *l;
+
+ for (l = panel_applets_loading; l; l = l->next) {
+ applet = l->data;
+
+ if (strcmp (applet->id, id) == 0)
+ break;
+ }
+
+ g_assert (l != NULL);
+
+ panel_applets_loading = g_slist_delete_link (panel_applets_loading, l);
+ free_applet_to_load (applet);
+
+ if (panel_applets_loading == NULL && panel_applets_to_load == NULL)
+ panel_applet_queue_initial_unhide_toplevels (NULL);
+}
+
static gboolean
panel_applet_load_idle_handler (gpointer dummy)
{
@@ -852,6 +888,7 @@
}
panel_applets_to_load = g_slist_delete_link (panel_applets_to_load, l);
+ panel_applets_loading = g_slist_append (panel_applets_loading, applet);
panel_widget = panel_toplevel_get_panel_widget (toplevel);
@@ -921,10 +958,13 @@
applet->position,
applet->id);
default:
+ g_assert_not_reached ();
break;
}
- free_applet_to_load (applet);
+ /* Only the bonobo applets will do a late stop_loading */
+ if (applet->type != PANEL_OBJECT_BONOBO)
+ panel_applet_stop_loading (applet->id);
return TRUE;
}
@@ -973,8 +1013,10 @@
void
panel_applet_load_queued_applets (void)
{
- if (!panel_applets_to_load)
+ if (!panel_applets_to_load) {
+ g_idle_add (panel_applet_queue_initial_unhide_toplevels, NULL);
return;
+ }
panel_applets_to_load = g_slist_sort (panel_applets_to_load,
(GCompareFunc) panel_applet_compare);
Modified: trunk/gnome-panel/applet.h
==============================================================================
--- trunk/gnome-panel/applet.h (original)
+++ trunk/gnome-panel/applet.h Tue Jan 20 07:29:40 2009
@@ -53,6 +53,7 @@
gboolean exactpos,
PanelObjectType type,
const char *id);
+void panel_applet_stop_loading (const char *id);
const char *panel_applet_get_id (AppletInfo *info);
const char *panel_applet_get_id_by_widget (GtkWidget *widget);
Modified: trunk/gnome-panel/panel-applet-frame.c
==============================================================================
--- trunk/gnome-panel/panel-applet-frame.c (original)
+++ trunk/gnome-panel/panel-applet-frame.c Tue Jan 20 07:29:40 2009
@@ -1262,6 +1262,7 @@
char *error;
char *item_name;
+ widget = NULL;
frame_act = (PanelAppletFrameActivating *) data;
frame = frame_act->frame;
@@ -1270,10 +1271,7 @@
if (error_reason != NULL || object == CORBA_OBJECT_NIL) {
g_warning (G_STRLOC ": failed to load applet %s:\n%s",
frame->priv->iid, error_reason);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_free (frame_act->id);
- g_free (frame_act);
- return;
+ goto error_out;
}
CORBA_exception_init (&corba_ev);
@@ -1310,13 +1308,10 @@
error = bonobo_exception_get_text (&corba_ev);
g_warning (G_STRLOC ": failed to get Bonobo/Control interface on applet %s:\n%s",
frame->priv->iid, error);
- panel_applet_frame_loading_failed (frame, frame_act->id);
CORBA_exception_free (&corba_ev);
bonobo_object_release_unref (object, NULL);
- g_free (frame_act->id);
- g_free (frame_act);
g_free (error);
- return;
+ goto error_out;
}
widget = bonobo_widget_new_control_from_objref (frame->priv->control,
@@ -1328,21 +1323,14 @@
if (!widget) {
g_warning (G_STRLOC ": failed to load applet %s",
frame->priv->iid);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_free (frame_act->id);
- g_free (frame_act);
- return;
+ goto error_out;
}
control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));
if (control_frame == NULL) {
g_warning (G_STRLOC ": failed to load applet %s "
"(cannot get control frame)", frame->priv->iid);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_object_unref (widget);
- g_free (frame_act->id);
- g_free (frame_act);
- return;
+ goto error_out;
}
frame->priv->property_bag =
@@ -1354,12 +1342,8 @@
g_warning (G_STRLOC ": failed to load applet %s "
"(cannot get property bag):\n%s",
frame->priv->iid, error);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_object_unref (widget);
- g_free (frame_act->id);
- g_free (frame_act);
g_free (error);
- return;
+ goto error_out;
}
bonobo_event_source_client_add_listener (frame->priv->property_bag,
@@ -1377,12 +1361,8 @@
g_warning (G_STRLOC ": failed to load applet %s "
"(cannot get popup component):\n%s",
frame->priv->iid, error);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_object_unref (widget);
- g_free (frame_act->id);
- g_free (frame_act);
g_free (error);
- return;
+ goto error_out;
}
bonobo_ui_util_set_ui (frame->priv->ui_component, DATADIR,
@@ -1401,11 +1381,7 @@
CORBA_exception_free (&corba_ev);
g_warning (G_STRLOC ": failed to load applet %s "
"(cannot get control)", frame->priv->iid);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_object_unref (widget);
- g_free (frame_act->id);
- g_free (frame_act);
- return;
+ goto error_out;
}
frame->priv->applet_shell = panel_applet_frame_get_applet_shell (control);
@@ -1413,11 +1389,7 @@
CORBA_exception_free (&corba_ev);
g_warning (G_STRLOC ": failed to load applet %s "
"(cannot get applet shell)", frame->priv->iid);
- panel_applet_frame_loading_failed (frame, frame_act->id);
- g_object_unref (widget);
- g_free (frame_act->id);
- g_free (frame_act);
- return;
+ goto error_out;
}
CORBA_exception_free (&corba_ev);
@@ -1446,6 +1418,17 @@
panel_lockdown_notify_add (G_CALLBACK (panel_applet_frame_sync_menu_state),
frame);
+ panel_applet_stop_loading (frame_act->id);
+ g_free (frame_act->id);
+ g_free (frame_act);
+
+ return;
+
+error_out:
+ panel_applet_frame_loading_failed (frame, frame_act->id);
+ if (widget)
+ g_object_unref (widget);
+ panel_applet_stop_loading (frame_act->id);
g_free (frame_act->id);
g_free (frame_act);
}
Modified: trunk/gnome-panel/panel-toplevel.c
==============================================================================
--- trunk/gnome-panel/panel-toplevel.c (original)
+++ trunk/gnome-panel/panel-toplevel.c Tue Jan 20 07:29:40 2009
@@ -2731,6 +2731,12 @@
toplevel->priv->attached = TRUE;
+ /* Cancelling the initial animation for drawers in
+ * panel_toplevel_initially_hide() is not enough, since this will
+ * happen only when the toplevel is realized, which might be too late
+ * for drawers (since it's realized when the drawer is clicked) */
+ toplevel->priv->initial_animation_done = TRUE;
+
toplevel->priv->attach_toplevel = attach_toplevel;
toplevel->priv->attach_widget = attach_widget;
@@ -2900,13 +2906,17 @@
if (!toplevel->priv->attached) {
toplevel->priv->initial_animation_done = FALSE;
+ /* We start the panel off hidden until all the applets are
+ * loaded, and then finally slide it down when it's ready to be
+ * used */
toplevel->priv->state = PANEL_STATE_AUTO_HIDDEN;
gtk_widget_queue_resize (GTK_WIDGET (toplevel));
- panel_toplevel_queue_auto_unhide (toplevel);
+ /* We still want to have the struts ready at the beginning to
+ * avoid desktop icons moving around */
+ panel_toplevel_update_struts (toplevel, FALSE);
} else
toplevel->priv->initial_animation_done = TRUE;
-
}
static void
@@ -3643,6 +3653,22 @@
toplevel);
}
+void
+panel_toplevel_queue_initial_unhide (PanelToplevel *toplevel)
+{
+ g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel));
+
+ if (toplevel->priv->initial_animation_done)
+ return;
+
+ if (toplevel->priv->unhide_timeout)
+ return;
+
+ toplevel->priv->unhide_timeout =
+ g_idle_add ((GSourceFunc) panel_toplevel_auto_unhide_timeout_handler,
+ toplevel);
+}
+
static gboolean
panel_toplevel_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
Modified: trunk/gnome-panel/panel-toplevel.h
==============================================================================
--- trunk/gnome-panel/panel-toplevel.h (original)
+++ trunk/gnome-panel/panel-toplevel.h Tue Jan 20 07:29:40 2009
@@ -136,6 +136,7 @@
void panel_toplevel_unhide (PanelToplevel *toplevel);
void panel_toplevel_queue_auto_hide (PanelToplevel *toplevel);
void panel_toplevel_queue_auto_unhide (PanelToplevel *toplevel);
+void panel_toplevel_queue_initial_unhide (PanelToplevel *toplevel);
void panel_toplevel_push_autohide_disabler (PanelToplevel *toplevel);
void panel_toplevel_pop_autohide_disabler (PanelToplevel *toplevel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]