Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2012-11-27 12:55:50 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-11-27 15:04:01 (GMT)
commit330bdf5ac9a4e58ff505a43a14484ca82c2a70aa (patch)
treed9b038afa7f970ad1a4e962b2a4d0ea493190eea
parentd507017564136d775b932728ca1ddc5d0f39faf8 (diff)
View Source: Expand rows on tap/click - SL #4206
Change the normal behaviour of tap/click on rows, so they are expanded pressing on the whole row, not just on the arrow button. This is helpful for touch interaction. Signed-off-by: Manuel Quiñones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/jarabe/view/viewsource.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
index 1578a8f..d23038b 100644
--- a/src/jarabe/view/viewsource.py
+++ b/src/jarabe/view/viewsource.py
@@ -469,6 +469,7 @@ class FileViewer(Gtk.ScrolledWindow):
self._initial_filename = initial_filename
self._tree_view = Gtk.TreeView()
+ self._tree_view.connect('cursor-changed', self.__cursor_changed_cb)
self.add(self._tree_view)
self._tree_view.show()
@@ -518,6 +519,19 @@ class FileViewer(Gtk.ScrolledWindow):
file_path = model.get_value(tree_iter, 1)
self.emit('file-selected', file_path)
+ def __cursor_changed_cb(self, treeview):
+ selection = treeview.get_selection()
+ store, iter_ = selection.get_selected()
+ if iter_ is None:
+ # Nothing selected. This happens at startup
+ return
+ if store.iter_has_child(iter_):
+ path = store.get_path(iter_)
+ if treeview.row_expanded(path):
+ treeview.collapse_row(path)
+ else:
+ treeview.expand_row(path, False)
+
class SourceDisplay(Gtk.ScrolledWindow):
__gtype_name__ = 'SugarSourceDisplay'