gnome-panel r11451 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11451 - trunk/gnome-panel
- Date: Tue, 20 Jan 2009 11:26:33 +0000 (UTC)
Author: vuntz
Date: Tue Jan 20 11:26:32 2009
New Revision: 11451
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11451&view=rev
Log:
2009-01-20 Vincent Untz <vuntz gnome org>
Fix initial un-hiding of newly created panels. And also make sure that
a panel that was unused but put back in the configuration gets its
applets/objects loaded.
* applet.c: (panel_applet_queue_initial_unhide_toplevels): simplify
(panel_applet_stop_loading): trivial update
(panel_applet_load_idle_handler): if there's no applet to load anymore,
then do the initial unhiding. This is necessary in case there's still
an applet in the configuration that matches no panel -- else, we're
blocked with no visible panel at all.
(panel_applet_load_queued_applets): don't put
panel_applet_queue_initial_unhide_toplevels() in the idle loop and call
it correctly. It already queues stuff in the idle loop...
* panel-profile.c: (panel_profile_load_and_show_toplevel): for panels
added during runtime, we also check if there are some applets/objects
that might belong to it.
(panel_profile_load_and_show_toplevel_startup): old version of
panel_profile_load_and_show_toplevel(), only used on panel startup
(panel_profile_object_id_list_update): new, based on
panel_profile_object_id_list_notify() so that it can be used elsewhere
(panel_profile_object_id_list_notify): just call
panel_profile_object_id_list_notify()
(panel_profile_load): use panel_profile_load_and_show_toplevel_startup()
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/applet.c
trunk/gnome-panel/panel-profile.c
Modified: trunk/gnome-panel/applet.c
==============================================================================
--- trunk/gnome-panel/applet.c (original)
+++ trunk/gnome-panel/applet.c Tue Jan 20 11:26:32 2009
@@ -793,8 +793,11 @@
guint locked : 1;
} PanelAppletToLoad;
+/* Each time those lists get both empty,
+ * panel_applet_queue_initial_unhide_toplevels() should be called */
static GSList *panel_applets_to_load = NULL;
static GSList *panel_applets_loading = NULL;
+
static gboolean panel_applet_have_load_idle = FALSE;
static void
@@ -822,16 +825,13 @@
}
/* This doesn't do anything if the initial unhide already happened */
-static gboolean
-panel_applet_queue_initial_unhide_toplevels (gpointer user_data)
+static void
+panel_applet_queue_initial_unhide_toplevels (void)
{
GSList *l;
- for (l = panel_toplevel_list_toplevels (); l != NULL; l = l->next) {
+ for (l = panel_toplevel_list_toplevels (); l != NULL; l = l->next)
panel_toplevel_queue_initial_unhide ((PanelToplevel *) l->data);
- }
-
- return FALSE;
}
void
@@ -853,7 +853,7 @@
free_applet_to_load (applet);
if (panel_applets_loading == NULL && panel_applets_to_load == NULL)
- panel_applet_queue_initial_unhide_toplevels (NULL);
+ panel_applet_queue_initial_unhide_toplevels ();
}
static gboolean
@@ -884,6 +884,12 @@
g_slist_free (panel_applets_to_load);
panel_applets_to_load = NULL;
panel_applet_have_load_idle = FALSE;
+
+ if (panel_applets_loading == NULL) {
+ /* unhide any potential initially hidden toplevel */
+ panel_applet_queue_initial_unhide_toplevels ();
+ }
+
return FALSE;
}
@@ -1014,7 +1020,7 @@
panel_applet_load_queued_applets (void)
{
if (!panel_applets_to_load) {
- g_idle_add (panel_applet_queue_initial_unhide_toplevels, NULL);
+ panel_applet_queue_initial_unhide_toplevels ();
return;
}
Modified: trunk/gnome-panel/panel-profile.c
==============================================================================
--- trunk/gnome-panel/panel-profile.c (original)
+++ trunk/gnome-panel/panel-profile.c Tue Jan 20 11:26:32 2009
@@ -113,6 +113,10 @@
static GQuark queued_changes_quark = 0;
static GQuark commit_timeout_quark = 0;
+static void panel_profile_object_id_list_update (GConfClient *client,
+ GConfValue *value,
+ PanelGConfKeyType type);
+
gboolean
panel_profile_map_orientation_string (const char *str,
PanelOrientation *orientation)
@@ -1791,6 +1795,52 @@
const char *toplevel_id)
{
PanelToplevel *toplevel;
+ const char *id_list;
+ const char *key;
+ GConfValue *value;
+ gboolean loading_queued_applets;
+
+ toplevel = panel_profile_load_toplevel (client, profile_dir, type, toplevel_id);
+ if (!toplevel)
+ return;
+
+ gtk_widget_show (GTK_WIDGET (toplevel));
+
+ loading_queued_applets = FALSE;
+
+ /* reload list of objects to get those that might be on the new
+ * toplevel */
+ id_list = panel_gconf_key_type_to_id_list (PANEL_GCONF_OBJECTS);
+ key = panel_gconf_sprintf ("%s/general/%s", profile_dir, id_list);
+ value = gconf_client_get (client, key, NULL);
+ if (value) {
+ panel_profile_object_id_list_update (client, value,
+ PANEL_GCONF_OBJECTS);
+ loading_queued_applets = TRUE;
+ gconf_value_free (value);
+ }
+
+ id_list = panel_gconf_key_type_to_id_list (PANEL_GCONF_APPLETS);
+ key = panel_gconf_sprintf ("%s/general/%s", profile_dir, id_list);
+ value = gconf_client_get (client, key, NULL);
+ if (value) {
+ panel_profile_object_id_list_update (client, value,
+ PANEL_GCONF_APPLETS);
+ loading_queued_applets = TRUE;
+ gconf_value_free (value);
+ }
+
+ if (!loading_queued_applets)
+ panel_applet_load_queued_applets ();
+}
+
+static void
+panel_profile_load_and_show_toplevel_startup (GConfClient *client,
+ const char *profile_dir,
+ PanelGConfKeyType type,
+ const char *toplevel_id)
+{
+ PanelToplevel *toplevel;
toplevel = panel_profile_load_toplevel (client, profile_dir, type, toplevel_id);
if (toplevel)
@@ -2144,19 +2194,13 @@
}
static void
-panel_profile_object_id_list_notify (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- PanelGConfKeyType type = GPOINTER_TO_INT (data);
- GConfValue *value;
- GSList *existing_applets;
- GSList *sublist = NULL, *l;
- GSList *object_ids;
-
- if (!(value = gconf_entry_get_value (entry)))
- return;
+panel_profile_object_id_list_update (GConfClient *client,
+ GConfValue *value,
+ PanelGConfKeyType type)
+{
+ GSList *existing_applets;
+ GSList *sublist = NULL, *l;
+ GSList *object_ids;
if (value->type != GCONF_VALUE_LIST ||
gconf_value_get_list_type (value) != GCONF_VALUE_STRING) {
@@ -2201,6 +2245,21 @@
}
static void
+panel_profile_object_id_list_notify (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer data)
+{
+ GConfValue *value;
+ PanelGConfKeyType type = GPOINTER_TO_INT (data);
+
+ if (!(value = gconf_entry_get_value (entry)))
+ return;
+
+ panel_profile_object_id_list_update (client, value, type);
+}
+
+static void
panel_profile_load_list (GConfClient *client,
const char *profile_dir,
PanelGConfKeyType type,
@@ -2464,7 +2523,7 @@
panel_profile_load_list (client,
PANEL_CONFIG_DIR,
PANEL_GCONF_TOPLEVELS,
- panel_profile_load_and_show_toplevel,
+ panel_profile_load_and_show_toplevel_startup,
(GConfClientNotifyFunc) panel_profile_toplevel_id_list_notify);
panel_profile_load_list (client,
PANEL_CONFIG_DIR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]