[gdm/gnome-2-30] Queue chooser visibility updates



commit 33e1e9efd2f4dd0581ee5f2a710740d00bde2b6a
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Jun 8 17:06:18 2010 -0400

    Queue chooser visibility updates
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621045

 gui/simple-greeter/gdm-chooser-widget.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-chooser-widget.c b/gui/simple-greeter/gdm-chooser-widget.c
index 0f6859a..40f2fcd 100644
--- a/gui/simple-greeter/gdm-chooser-widget.c
+++ b/gui/simple-greeter/gdm-chooser-widget.c
@@ -88,6 +88,7 @@ struct GdmChooserWidgetPrivate
         gint                     number_of_active_timers;
 
         guint                    update_idle_id;
+        guint                    update_visibility_idle_id;
         guint                    timer_animation_timeout_id;
 
         guint32                  should_hide_inactive_items : 1;
@@ -596,7 +597,7 @@ update_separator_visibility (GdmChooserWidget *widget)
                             -1);
 }
 
-static void
+static gboolean
 update_chooser_visibility (GdmChooserWidget *widget)
 {
         if (gdm_chooser_widget_get_number_of_items (widget) > 0) {
@@ -605,6 +606,10 @@ update_chooser_visibility (GdmChooserWidget *widget)
                 gtk_widget_hide (widget->priv->frame);
         }
         g_object_notify (G_OBJECT (widget), "list-visible");
+
+        widget->priv->update_visibility_idle_id = 0;
+
+        return FALSE;
 }
 
 static void
@@ -1140,6 +1145,11 @@ gdm_chooser_widget_dispose (GObject *object)
 
         widget = GDM_CHOOSER_WIDGET (object);
 
+        if (widget->priv->update_visibility_idle_id > 0) {
+                g_source_remove (widget->priv->update_visibility_idle_id);
+                widget->priv->update_visibility_idle_id = 0;
+        }
+
         if (widget->priv->separator_row != NULL) {
                 gtk_tree_row_reference_free (widget->priv->separator_row);
                 widget->priv->separator_row = NULL;
@@ -1578,6 +1588,8 @@ add_separator (GdmChooserWidget *widget)
 static gboolean
 update_column_visibility (GdmChooserWidget *widget)
 {
+        g_debug ("GdmChooserWidget: updating column visibility");
+
         if (widget->priv->number_of_rows_with_images > 0) {
                 gtk_tree_view_column_set_visible (widget->priv->image_column,
                                                   TRUE);
@@ -2023,6 +2035,15 @@ gdm_chooser_widget_update_item (GdmChooserWidget *widget,
                             -1);
 }
 
+static void
+queue_update_chooser_visibility (GdmChooserWidget *widget)
+{
+        if (widget->priv->update_visibility_idle_id == 0) {
+                widget->priv->update_visibility_idle_id =
+                        g_idle_add ((GSourceFunc) update_chooser_visibility, widget);
+        }
+}
+
 void
 gdm_chooser_widget_add_item (GdmChooserWidget *widget,
                              const char       *id,
@@ -2069,7 +2090,7 @@ gdm_chooser_widget_add_item (GdmChooserWidget *widget,
                                            -1);
 
         move_cursor_to_top (widget);
-        update_chooser_visibility (widget);
+        queue_update_chooser_visibility (widget);
 }
 
 void
@@ -2118,7 +2139,7 @@ gdm_chooser_widget_remove_item (GdmChooserWidget *widget,
         gtk_list_store_remove (widget->priv->list_store, &iter);
 
         move_cursor_to_top (widget);
-        update_chooser_visibility (widget);
+        queue_update_chooser_visibility (widget);
 }
 
 gboolean



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