[gnome-panel/wip/3.0-freeze-break] panel: Two small fixes to object loader



commit dd8108a426243d3c483bf129636a3ac6ce038170
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Mar 25 18:21:32 2011 +0100

    panel: Two small fixes to object loader
    
    a) Never queue an object twice
    b) Make stop_loading() also remove objects that are still marked as "to
       load", instead of just "loading" objects. That's really the behavior
       we want.

 gnome-panel/panel-object-loader.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel-object-loader.c b/gnome-panel/panel-object-loader.c
index 72379ee..42a7cb8 100644
--- a/gnome-panel/panel-object-loader.c
+++ b/gnome-panel/panel-object-loader.c
@@ -111,18 +111,24 @@ panel_object_loader_stop_loading (const char *id)
 
         for (l = panel_objects_loading; l; l = l->next) {
                 object = l->data;
-
                 if (g_strcmp0 (object->id, id) == 0)
                         break;
         }
-
-        /* this can happen if we reload an object after it crashed,
-         * for example */
         if (l != NULL) {
                 panel_objects_loading = g_slist_delete_link (panel_objects_loading, l);
                 free_object_to_load (object);
         }
 
+        for (l = panel_objects_to_load; l; l = l->next) {
+                object = l->data;
+                if (g_strcmp0 (object->id, id) == 0)
+                        break;
+        }
+        if (l != NULL) {
+                panel_objects_to_load = g_slist_delete_link (panel_objects_to_load, l);
+                free_object_to_load (object);
+        }
+
         if (panel_objects_loading == NULL && panel_objects_to_load == NULL)
                 panel_object_loader_queue_initial_unhide_toplevels (NULL);
 }
@@ -239,6 +245,9 @@ panel_object_loader_queue (const char *id,
         GSettings         *settings;
         char              *toplevel_id;
 
+        if (panel_object_loader_is_queued (id))
+                return;
+
         settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA,
                                              settings_path);
         toplevel_id = g_settings_get_string (settings,



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