+ 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);
+ }
+ }
+
+ public unowned TreeSelection get_selection () {
+ return tree.get_selection ();
+ }
+
+ private Pango.AttrList get_attributes (Gtk.Window window, string font_name, string color_name) {
+ Pango.AttrList attr_list = new Pango.AttrList ();
+ var style = Gtk.rc_get_style_by_paths (Gtk.Settings.get_default (), font_name, null, typeof (void));
+ if (style != null) {
+ var attr_font_desc = new Pango.AttrFontDesc (style.font_desc.copy ());
+ attr_list.insert ((owned) attr_font_desc);
+ }
+ Gdk.Color color;
+ window.ensure_style ();
+ if (window.style.lookup_color (color_name, out color)) {
+ Pango.Attribute attr_color = Pango.attr_foreground_new (color.red, color.green, color.blue);
+ attr_list.insert ((owned) attr_color);
+ }
+ return attr_list;
+ }
+
+ // TODO: after scrolling down 80% of the list, load more
+ // results if available.
+ private void on_adjustment_value_changed () {
+ if (more_movies_available) {
+ var vadj = get_vadjustment ();
+ if (vadj.value > 0.8 * vadj.upper) {
+ Banner.show_information (this, null, _("More results available - refine search to reduce the dataset"));
+ more_movies_available = false;
+ }
+ }
+ }
+
+ private void on_row_activated (TreeView tree, TreePath path, TreeViewColumn column) {
+ TreeModel model = tree.model;
+ TreeIter iter;
+
+ if (model.get_iter (out iter, path)) {
+ Movie movie;
+ model.get (iter, MovieListStore.Columns.MOVIE, out movie);
+ movie_activated (movie);
+ }
+ }