[gnome-boxes] collection-view: add an activate() method



commit 784393c1531598c84daf53fe8c10bd7a5d30f5e4
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Aug 2 20:06:45 2012 +0200

    collection-view: add an activate() method
    
    When the search entry is activated, we want to open whatever item
    is matching the search (start Box and display it).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681089

 src/collection-view.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 2c96bf0..981f514 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -256,6 +256,13 @@ private class Boxes.CollectionView: Boxes.UI {
         model_filter.refilter ();
     }
 
+    public void activate () {
+        if (model_filter.iter_n_children (null) == 1) {
+            Gtk.TreePath path = new Gtk.TreePath.from_string ("0");
+            icon_view.item_activated (path);
+        }
+    }
+
     private void setup_view () {
         model = new Gtk.ListStore (3,
                                    typeof (Gdk.Pixbuf),



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