diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-11-26 15:58:48 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-02-26 16:49:08 (GMT) |
commit | 9f8016edf52910a23850dc2be33bee6f600f3ac8 (patch) | |
tree | eaffb4cd4d350174bb72c13057f3e9ef08d2394c /readactivity.py | |
parent | c2d306eca25a26bf814483d9f12ebb3f070ecd0b (diff) |
Expand rows on tap/click SL #4197
This patch changes the normal behaviour of the clicks on rows, so they
are expanded just tapping/clicking once on them. This is helpful when
the XO is used in eBook mode because the arrows are really small and
difficult to tap with the finger.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Reviewed-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'readactivity.py')
-rw-r--r-- | readactivity.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/readactivity.py b/readactivity.py index beed2b4..1481056 100644 --- a/readactivity.py +++ b/readactivity.py @@ -392,10 +392,24 @@ class ReadActivity(activity.Activity): self._view_toolbar.show_nav_button() def _create_navigator(self): + def __cursor_changed_cb(treeview): + selection = treeview.get_selection() + store, index_iter = selection.get_selected() + if index_iter is None: + # Nothing selected. This happens at startup + return + if store.iter_has_child(index_iter): + path = store.get_path(index_iter) + if treeview.row_expanded(path): + treeview.collapse_row(path) + else: + treeview.expand_row(path, False) + self._toc_visible = False self._update_toc_view = False toc_navigator = Gtk.TreeView() toc_navigator.set_enable_search(False) + toc_navigator.connect('cursor-changed', __cursor_changed_cb) toc_selection = toc_navigator.get_selection() toc_selection.set_mode(Gtk.SelectionMode.SINGLE) |