tasque r50 - in trunk: . src/Backends/EDS



Author: jjohnny
Date: Fri Mar 28 10:24:32 2008
New Revision: 50
URL: http://svn.gnome.org/viewvc/tasque?rev=50&view=rev

Log:
Fixed CreateTask in EDS Backend


Modified:
   trunk/ChangeLog
   trunk/src/Backends/EDS/EDSBackends.cs

Modified: trunk/src/Backends/EDS/EDSBackends.cs
==============================================================================
--- trunk/src/Backends/EDS/EDSBackends.cs	(original)
+++ trunk/src/Backends/EDS/EDSBackends.cs	Fri Mar 28 10:24:32 2008
@@ -88,18 +88,27 @@
                #region Public Methods
                public ITask CreateTask (string taskName, ICategory category)
                {
+		       Gtk.TreeIter taskIter;
+		       EDSTask edsTask;
 
-                       Console.WriteLine ("CreateTask reached");
-
+		       //FIXME : AllCategory
                        if (category == null || category is Tasque.AllCategory)
                                return null;
 
                        EDSCategory edsCategory = category as EDSCategory;
                        CalComponent task = new CalComponent (edsCategory.TaskList);
                        task.Summary = taskName;
+
+                       lock (taskLock) {
+			       edsTask = new EDSTask (task, edsCategory);
+			       taskIter = taskStore.AppendNode ();
+			       taskStore.SetValue (taskIter, 0, edsTask);
+			       taskIters [task.Uid] = taskIter;
+		       }
+
                        task.Commit ();
 
-                       return null;
+                       return edsTask;
                }
 
 	       public void DeleteTask(ITask task)
@@ -122,7 +131,7 @@
                        try {
                                UpdateCategories ();
                        } catch (Exception e) {
-                               Console.WriteLine ("Oops! : " + e);
+                               Logger.Debug ("Oops! : " + e);
                        }
 
                        initialized = true;
@@ -185,11 +194,13 @@
                                EDSTask edsTask;
                                EDSCategory edsCategory;
                                foreach (CalComponent task in addedTasks) {
-                                       edsCategory = new EDSCategory (task.Source);
-                                       edsTask = new EDSTask (task, edsCategory);
-                                       taskIter = taskStore.AppendNode ();
-                                       taskStore.SetValue (taskIter, 0, edsTask);
-                                       taskIters [task.Uid] = taskIter;
+				       if(!taskIters.ContainsKey(task.Uid)) {
+					       edsCategory = new EDSCategory (task.Source);
+					       edsTask = new EDSTask (task, edsCategory);
+					       taskIter = taskStore.AppendNode ();
+					       taskStore.SetValue (taskIter, 0, edsTask);
+					       taskIters [edsTask.Id] = taskIter;
+				       }
                                }
                        }
                }
@@ -203,10 +214,9 @@
                        CalComponent[] modifiedTasks = CalUtil.ICalToCalComponentArray (args.Objects.Handle, ((CalView) o).Client);
 
                        foreach (CalComponent task in modifiedTasks) {
-                               edsCategory = new EDSCategory (task.Source);
-                               edsTask = new EDSTask (task, edsCategory);
-
-                               if(taskIters.ContainsKey(edsTask.Id)) {
+                               if(taskIters.ContainsKey(task.Uid)) {
+				       edsCategory = new EDSCategory (task.Source);
+				       edsTask = new EDSTask (task, edsCategory);
                                        iter = taskIters[edsTask.Id];
                                        taskStore.SetValue (iter, 0, edsTask);
                                }
@@ -233,7 +243,6 @@
                                        taskStore.Remove (ref iter);
                                }
 
-                               Console.WriteLine (id.Uid);
                        }
 
                        Logger.Debug ("{0} Tasks removed in EDS", removedTasksList.Count);



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