[tasque] Patch for adding tasks with one click
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque] Patch for adding tasks with one click
- Date: Sun, 9 Sep 2012 12:30:42 +0000 (UTC)
commit 649a5fe4a35d27699650fea932f077a891ac1e96
Author: Ahmad Sherif <ahmad sherif public gmail com>
Date: Sun Sep 9 14:28:24 2012 +0200
Patch for adding tasks with one click
src/TaskTreeView.cs | 5 +++++
src/TaskWindow.cs | 28 ++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/TaskTreeView.cs b/src/TaskTreeView.cs
index 56bb1ad..6da97b2 100644
--- a/src/TaskTreeView.cs
+++ b/src/TaskTreeView.cs
@@ -37,6 +37,11 @@ namespace Tasque
public event EventHandler NumberOfTasksChanged;
+ public ITask TaskBeingEdited
+ {
+ get { return taskBeingEdited; }
+ }
+
public TaskTreeView (Gtk.TreeModel model)
: base ()
{
diff --git a/src/TaskWindow.cs b/src/TaskWindow.cs
index eaedaf4..a69ba43 100644
--- a/src/TaskWindow.cs
+++ b/src/TaskWindow.cs
@@ -204,6 +204,7 @@ namespace Tasque
innerEb = new EventBox();
innerEb.BorderWidth = 0;
+ innerEb.ButtonPressEvent += OnTargetVBoxButtonPress;
Gdk.Color backgroundColor = GetBackgroundColor ();
innerEb.ModifyBg (StateType.Normal, backgroundColor);
innerEb.ModifyBase (StateType.Normal, backgroundColor);
@@ -1144,6 +1145,33 @@ namespace Tasque
}
}
+ void OnTargetVBoxButtonPress (object sender, Gtk.ButtonPressEventArgs args)
+ {
+ if (args.Event.Button == 1) {
+ Gtk.TreeIter iter;
+ if (!categoryComboBox.GetActiveIter (out iter))
+ return;
+
+ ICategory category =
+ categoryComboBox.Model.GetValue (iter, 0) as ICategory;
+
+ TaskTreeView tree = futureGroup.TreeView as TaskTreeView;
+
+ // Don't add a new empty task if we're still editing a task
+ if (tree.TaskBeingEdited != null)
+ return;
+
+ ITask task = CreateTask (String.Empty, category);
+ if (task == null)
+ return; // TODO: explain error to user
+
+ // Since we added an empty task, it'll always be on top
+ // Looks like a hack
+ Gtk.TreePath path = new Gtk.TreePath ("0");
+ tree.SetCursor (path, tree.GetColumn (2), true);
+ }
+ }
+
private void OnShowTaskNotes (object sender, EventArgs args)
{
if (clickedTask == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]