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
This commit is contained in:
William Jon McCann 2012-08-10 13:23:20 -04:00
parent a28e1a22a6
commit c5c46a125e

View File

@ -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));
}