[gtk+/bgo141154-filechooser-icon-view: 6/23] Set the model on the current view with a bit less code



commit 147df8dbe48cc3aac44f93d4571f3bf67ac21425
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Apr 5 12:23:53 2011 -0500

    Set the model on the current view with a bit less code
    
    A tiny bit less code, by setting the 'model' property instead of
    calling explicit functions for each view type.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkfilechooserdefault.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 0324c9d..3f947fb 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -10873,13 +10873,18 @@ current_selection_unselect_all (GtkFileChooserDefault *impl)
 static void
 current_view_set_file_model (GtkFileChooserDefault *impl, GtkTreeModel *model)
 {
+  GtkWidget *view;
+
   impl->current_model = model;
+
   if (impl->view_mode == VIEW_MODE_LIST)
-    gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), model);
+    view = impl->browse_files_tree_view;
   else if (impl->view_mode == VIEW_MODE_ICON)
-    gtk_icon_view_set_model (GTK_ICON_VIEW (impl->browse_files_icon_view), model);
+    view = impl->browse_files_icon_view;
   else
     g_assert_not_reached ();
+
+  g_object_set (view, "model", impl->current_model, NULL);
 }
 
 static void



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