From: Philipp Zabel Date: Wed, 18 Nov 2009 13:35:51 +0000 (+0100) Subject: Movie list view: add set_hildon_ui_mode and get_selection methods X-Git-Tag: v0.0.5~5 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=3f4c7ec27c1ac76b19a2f74c1526c996d7e87804;p=cinaest Movie list view: add set_hildon_ui_mode and get_selection methods Both are needed for the edit mode / multiple selection implementation of the movie list window. --- diff --git a/src/movie-list-view.vala b/src/movie-list-view.vala index bfaa8a7..cc7cc33 100644 --- a/src/movie-list-view.vala +++ b/src/movie-list-view.vala @@ -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;