[libgd] view-generic: Handle selection for tree stores as well



commit c3134c706315898b08d37e679305cb0b152a2f8a
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 14 17:38:39 2014 +0100

    view-generic: Handle selection for tree stores as well
    
    We only supported list stores, but the rest of the widget supports
    tree stores just as well.
    
    Similar to a7a628884449e48af5bd6d1cf8d7b76cb4beff9f

 libgd/gd-main-view-generic.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/libgd/gd-main-view-generic.c b/libgd/gd-main-view-generic.c
index 200153c..19b1886 100644
--- a/libgd/gd-main-view-generic.c
+++ b/libgd/gd-main-view-generic.c
@@ -230,9 +230,18 @@ set_selection_foreach (GtkTreeModel *model,
 {
   gboolean selection = GPOINTER_TO_INT (user_data);
 
-  gtk_list_store_set (GTK_LIST_STORE (model), iter,
-                      GD_MAIN_COLUMN_SELECTED, selection,
-                      -1);
+  if (GTK_IS_LIST_STORE (model))
+    {
+      gtk_list_store_set (GTK_LIST_STORE (model), iter,
+                          GD_MAIN_COLUMN_SELECTED, selection,
+                          -1);
+    }
+  else
+    {
+      gtk_tree_store_set (GTK_TREE_STORE (model), iter,
+                          GD_MAIN_COLUMN_SELECTED, selection,
+                          -1);
+    }
 
   return FALSE;
 }


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