[Sugar-devel] [PATCH sugar] Start the activity when the treeview row is activated

Daniel Narvaez dwnarvaez at gmail.com
Sun Dec 2 19:59:50 EST 2012


From: Daniel Narvaez <dwnarvaez at gmail.com>

This makes the "activate" accessible action work, which is useful
both for the UI tests and accessibility.
It shouldn't interfer with the normal mouse behavior because gtk
only calls row_activated on a double click.
---
 src/jarabe/desktop/activitieslist.py |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
index 6594ee9..738a54f 100644
--- a/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -80,6 +80,8 @@ class ActivitiesTreeView(Gtk.TreeView):
         column.add_attribute(cell_icon, 'file-name', ListModel.COLUMN_ICON)
         self.append_column(column)
 
+        self._icon_column = column
+
         cell_text = Gtk.CellRendererText()
         cell_text.props.ellipsize = Pango.EllipsizeMode.MIDDLE
         cell_text.props.ellipsize_set = True
@@ -143,6 +145,9 @@ class ActivitiesTreeView(Gtk.TreeView):
                                      not row[ListModel.COLUMN_FAVORITE])
 
     def __icon_clicked_cb(self, cell, path):
+        self._start_activity(path)
+
+    def _start_activity(self, path):
         row = self.get_model()[path]
 
         registry = bundleregistry.get_registry()
@@ -165,6 +170,9 @@ class ActivitiesTreeView(Gtk.TreeView):
         title = normalize_string(title.decode('utf-8'))
         return title is not None and title.find(self._query) > -1
 
+    def do_row_activated(self, path, column):
+        if column == self._icon_column:
+            self._start_activity(path)
 
 class ListModel(Gtk.TreeModelSort):
     __gtype_name__ = 'SugarListModel'
-- 
1.7.10.4



More information about the Sugar-devel mailing list