summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-03-15 14:09:09 (GMT)
committerWill Thompson <will.thompson@collabora.co.uk>2011-03-15 14:09:09 (GMT)
commit9793db1477b74a183080755e87164052b4984d9e (patch)
tree6da13382c035edaf64fc9a63700173af08efc8ab
parent94ebce11e2ffb92556fbe89f78085e7606a6a7de (diff)
downloadgtimelog-9793db1477b74a183080755e87164052b4984d9e.tar.gz
gtimelog-9793db1477b74a183080755e87164052b4984d9e.tar.xz
Make double-clicking a category expand/contract it.
Currently double-clicking categories (as opposed to tasks) in the task list adds the category to the task entry, which is never what you want. This patch makes it expand/collapse the category instead.
-rwxr-xr-xsrc/gtimelog/gtimelog.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gtimelog/gtimelog.py b/src/gtimelog/gtimelog.py
index f496c1f..38c9d66 100755
--- a/src/gtimelog/gtimelog.py
+++ b/src/gtimelog/gtimelog.py
@@ -2339,13 +2339,21 @@ class MainWindow(object):
self.task_list.get_model().refilter()
def task_list_row_activated(self, treeview, path, view_column):
- """A task was selected in the task pane -- put it to the entry."""
model = treeview.get_model()
- task = model[path][1]
- self.task_entry.set_text(task + ": ")
- self.task_entry.grab_focus()
- self.task_entry.set_position(-1)
- # XXX: how does this integrate with history?
+
+ if model.iter_has_child(model.get_iter(path)):
+ """A category was clicked: expand or collapse it."""
+ if treeview.row_expanded(path):
+ treeview.collapse_row(path)
+ else:
+ treeview.expand_row(path, False)
+ else:
+ """A task was selected in the task pane -- put it to the entry."""
+ task = model[path][MainWindow.COL_TASK_PATH]
+ self.task_entry.set_text(task + ": ")
+ self.task_entry.grab_focus()
+ self.task_entry.set_position(-1)
+ # XXX: how does this integrate with history?
def task_list_button_press(self, menu, event):
if event.button == 3: