From: Philipp Zabel Date: Sat, 5 Dec 2009 08:57:24 +0000 (+0100) Subject: Source list view: add get_iter, get_selection and set_hildon_ui_mode methods X-Git-Tag: v0.0.9~10 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=7198676260ca8ca8d65a6cd9bb6cb5b4afb2c4f6;p=cinaest Source list view: add get_iter, get_selection and set_hildon_ui_mode methods These will be used in the catalog plugin settings to show a source list to select active sources. --- diff --git a/src/source-list-view.vala b/src/source-list-view.vala index d243000..03fc33e 100644 --- a/src/source-list-view.vala +++ b/src/source-list-view.vala @@ -97,6 +97,34 @@ public class SourceListView : PannableArea { } } + public bool get_iter (MovieSource source, out Gtk.TreeIter iter) { + if (store.get_iter_first (out iter)) do { + MovieSource s = null; + store.get (iter, 2, out s); + if (s == source) { + return true; + } + } while (store.iter_next (ref iter)); + + return false; + } + + public unowned TreeSelection get_selection () { + return tree.get_selection (); + } + + public void set_hildon_ui_mode (UIMode mode) { + var selection = tree.get_selection (); + + if (mode == UIMode.NORMAL) { + selection.set_mode (SelectionMode.NONE); + } + Hildon.gtk_tree_view_set_ui_mode (tree, mode); + if (mode == UIMode.EDIT) { + selection.set_mode (SelectionMode.MULTIPLE); + } + } + 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;