summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-03-11 13:36:36 (GMT)
committerWill Thompson <will.thompson@collabora.co.uk>2011-03-11 13:36:36 (GMT)
commit05cbb5aa84ec57faf88942e7b274cd5f9e15c8fc (patch)
treeb9f2d91faa7182189d3439644f672191bb5a254b
parent1010da3fb4d201b93fb8df50c1728bf87ec893e6 (diff)
downloadgtimelog-05cbb5aa84ec57faf88942e7b274cd5f9e15c8fc.tar.gz
gtimelog-05cbb5aa84ec57faf88942e7b274cd5f9e15c8fc.tar.xz
Add a tickybox to show/hide grey things.
-rwxr-xr-xsrc/gtimelog/gtimelog.py18
-rw-r--r--src/gtimelog/gtimelog.ui8
2 files changed, 26 insertions, 0 deletions
diff --git a/src/gtimelog/gtimelog.py b/src/gtimelog/gtimelog.py
index 6a80dcb..f496c1f 100755
--- a/src/gtimelog/gtimelog.py
+++ b/src/gtimelog/gtimelog.py
@@ -1186,6 +1186,7 @@ class MainWindow(object):
# Initial view mode
chronological = True
show_tasks = True
+ show_unavailable_tasks = False
# URL to use for Help -> Online Documentation
help_url = "http://mg.pov.lt/gtimelog"
@@ -1231,6 +1232,11 @@ class MainWindow(object):
show_task_pane_item = tree.get_object("show_task_pane")
show_task_pane_item.set_active(self.show_tasks)
+ self.show_unavailable_tasks_item = tree.get_object(
+ "show_unavailable_tasks")
+ self.show_unavailable_tasks_item.set_active(self.show_unavailable_tasks)
+ self.show_unavailable_tasks_item.set_sensitive(self.show_tasks)
+
# Now hook up signals
tree.connect_signals(self)
@@ -1286,6 +1292,12 @@ class MainWindow(object):
txt = task_filter.set_text("")
def _task_filter_filter(model, iter):
+ # If the user hasn't ticked "Show unavailable tasks" and the task
+ # is unavailable, never show it, even when searching.
+ if not self.show_unavailable_tasks:
+ unavailable, = model.get(iter, MainWindow.COL_TASK_UNAVAILABLE)
+ if unavailable:
+ return False
txt = task_filter.get_text()
@@ -2317,8 +2329,14 @@ class MainWindow(object):
"""View -> Tasks"""
if self.task_pane.get_property("visible"):
self.task_pane.hide()
+ self.show_unavailable_tasks_item.set_sensitive(False)
else:
self.task_pane.show()
+ self.show_unavailable_tasks_item.set_sensitive(True)
+
+ def on_show_unavailable_tasks_toggled(self, item):
+ self.show_unavailable_tasks = item.get_active()
+ 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."""
diff --git a/src/gtimelog/gtimelog.ui b/src/gtimelog/gtimelog.ui
index 361030a..2c5a661 100644
--- a/src/gtimelog/gtimelog.ui
+++ b/src/gtimelog/gtimelog.ui
@@ -474,6 +474,14 @@ GTimeLog is a time tracking application.
<signal name="toggled" handler="on_show_task_pane_toggled"/>
</object>
</child>
+ <child>
+ <object class="GtkCheckMenuItem" id="show_unavailable_tasks">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Show _unavailable tasks</property>
+ <property name="use_underline">True</property>
+ <signal name="toggled" handler="on_show_unavailable_tasks_toggled"/>
+ </object>
+ </child>
</object>
</child>
</object>