[tasque/transition: 205/213] [Tasque.Gtk] Delete task only from selected category



commit ef81ee97c472e41c5067b467636bd27c670462c6
Author: Antonius Riha <antoniusriha gmail com>
Date:   Sun Aug 19 21:47:05 2012 +0200

    [Tasque.Gtk] Delete task only from selected category
    
    ... not totally from the backend

 src/Tasque.Gtk/TaskWindow.cs |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/Tasque.Gtk/TaskWindow.cs b/src/Tasque.Gtk/TaskWindow.cs
index 97e929f..a635bde 100644
--- a/src/Tasque.Gtk/TaskWindow.cs
+++ b/src/Tasque.Gtk/TaskWindow.cs
@@ -1123,8 +1123,23 @@ namespace Tasque
 		{
 			if (clickedTask == null)
 				return;
-		
-			GtkApplication.Instance.Backend.DeleteTask(clickedTask);
+			
+			// get category of item
+			Category cat = null;
+			var model = categoryComboBox.Model;
+			TreeIter iter;
+			categoryComboBox.GetActiveIter (out iter);
+			if (model.GetPath (iter).Indices [0] == TreePath.NewFirst ().Indices [0])
+				cat = null;
+			else {
+				var catName = model.GetValue (iter, 0) as string;
+				cat = GtkApplication.Instance.Backend.Categories.SingleOrDefault (c => c.Name == catName);
+			}
+			
+			if (cat != null)
+				cat.Remove (clickedTask);
+			else
+				GtkApplication.Instance.Backend.DeleteTaskFromAllCategories (clickedTask);
 			
 			status = Catalog.GetString ("Task deleted");
 			TaskWindow.ShowStatus (status);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]