[gtk+] icon-view: emit selection-changed when changing the model



commit c5c46a125e6a017a21fed434382d7712398802bc
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Aug 10 13:23:20 2012 -0400

    icon-view: emit selection-changed when changing the model
    
    Only if there was a selection active.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681613

 gtk/gtkiconview.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 3da42ae..8740f46 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -4901,6 +4901,8 @@ void
 gtk_icon_view_set_model (GtkIconView *icon_view,
 			 GtkTreeModel *model)
 {
+  gboolean dirty;
+
   g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
   g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
   
@@ -4917,6 +4919,8 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
   if (icon_view->priv->cell_area)
     gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
+  dirty = gtk_icon_view_unselect_all_internal (icon_view);
+
   if (model)
     {
       GType column_type;
@@ -5001,6 +5005,9 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
 
   g_object_notify (G_OBJECT (icon_view), "model");  
 
+  if (dirty)
+    g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0);
+
   gtk_widget_queue_resize (GTK_WIDGET (icon_view));
 }
 



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