Movie list view: add set_hildon_ui_mode and get_selection methods
authorPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 18 Nov 2009 13:35:51 +0000 (14:35 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 18 Nov 2009 14:36:50 +0000 (15:36 +0100)
Both are needed for the edit mode / multiple selection implementation
of the movie list window.

src/movie-list-view.vala

index bfaa8a7..cc7cc33 100644 (file)
@@ -125,6 +125,22 @@ public class MovieListView : PannableArea {
                tree.row_activated.connect (on_row_activated);
        }
 
+       public void set_hildon_ui_mode (UIMode mode) {
+               var selection = tree.get_selection ();
+
+               if (mode == UIMode.NORMAL) {
+                       selection.set_mode (SelectionMode.SINGLE);
+               }
+               Hildon.gtk_tree_view_set_ui_mode (tree, mode);
+               if (mode == UIMode.EDIT) {
+                       selection.set_mode (SelectionMode.MULTIPLE);
+               }
+       }
+
+       public unowned TreeSelection get_selection () {
+               return tree.get_selection ();
+       }
+
        private void on_row_activated (TreeView tree, TreePath path_, TreeViewColumn column) {
                TreePath path = path_.copy (); // FIXME - calling model.get_iter with path_ directly causes a C qualifier warning
                TreeModel model = tree.model;