Emit row_activated
authorEnrico Zini <enrico@enricozini.org>
Wed, 9 Dec 2009 22:36:59 +0000 (22:36 +0000)
committerEnrico Zini <enrico@enricozini.org>
Wed, 9 Dec 2009 22:36:59 +0000 (22:36 +0000)
src/fisheye.vala

index 177a012328977e27ec68f0726ee1eef19f560721..99e16e4f488f469483af8e0ca85719bc3a4b9685 100644 (file)
@@ -74,6 +74,9 @@ public class FisheyeList : Gtk.DrawingArea
                }
        }
 
+       //public virtual signal void cursor_changed ();
+       public virtual signal void row_activated(Gtk.TreePath path);
+
        public FisheyeList()
        {
                model = null;
@@ -127,17 +130,29 @@ public class FisheyeList : Gtk.DrawingArea
        private void on_rows_reordered(Gtk.TreePath path, Gtk.TreeIter iter, void* new_order) { build_label_cache_needed = true; }
 
        /* Mouse button got pressed over widget */
+       /*
        public override bool button_press_event(Gdk.EventButton event)
        {
                stderr.printf("Mouse pressed on %d %s\n", cur_el, label_cache[cur_el]);
                return false;
        }
+       */
 
        /* Mouse button got released */
        public override bool button_release_event(Gdk.EventButton event)
        {
                stderr.printf("Mouse released on %d %s\n", cur_el, label_cache[cur_el]);
-               // ...
+
+               // Emit row_activated if applicable
+               if (model != null)
+               {
+                       Gtk.TreeIter iter;
+                       if (model.iter_nth_child(out iter, null, cur_el))
+                       {
+                               Gtk.TreePath path = model.get_path(iter);
+                               row_activated(path);
+                       }
+               }
                return false;
        }