tasque r199 - in branches/new_cache: . src



Author: bgmerrell
Date: Tue Dec 30 02:11:18 2008
New Revision: 199
URL: http://svn.gnome.org/viewvc/tasque?rev=199&view=rev

Log:
* src/ICategory.cs: Add ID property with a getter
* src/Category.cs: Uncomment a print statement for debugging
* src/TaskWindow.cs: More merging with the old caching code
* src/RemoteControl.cs: Change references from ICategory to Category and ITask to Task


Modified:
   branches/new_cache/ChangeLog
   branches/new_cache/src/Category.cs
   branches/new_cache/src/ICategory.cs
   branches/new_cache/src/RemoteControl.cs
   branches/new_cache/src/TaskWindow.cs

Modified: branches/new_cache/src/Category.cs
==============================================================================
--- branches/new_cache/src/Category.cs	(original)
+++ branches/new_cache/src/Category.cs	Tue Dec 30 02:11:18 2008
@@ -46,7 +46,7 @@
 			string command = String.Format("INSERT INTO Categories (Name, ExternalID) values ('{0}', '{1}')", name, string.Empty);
 			cache.Database.ExecuteScalar(command);
 			this.id = cache.Database.Connection.LastInsertRowId;
-			//Logger.Debug("Inserted category named: {0} with id {1}", name, id);
+			Logger.Debug("Inserted category named: {0} with id {1}", name, id);
 		}
 		
 		public Category (LocalCache cache, int id)

Modified: branches/new_cache/src/ICategory.cs
==============================================================================
--- branches/new_cache/src/ICategory.cs	(original)
+++ branches/new_cache/src/ICategory.cs	Tue Dec 30 02:11:18 2008
@@ -15,6 +15,11 @@
 			get;
 		}
 		
+		string ID
+		{
+			get;
+		}
+		
 		bool ContainsTask(ITask task);
 	}
 }

Modified: branches/new_cache/src/RemoteControl.cs
==============================================================================
--- branches/new_cache/src/RemoteControl.cs	(original)
+++ branches/new_cache/src/RemoteControl.cs	Tue Dec 30 02:11:18 2008
@@ -103,9 +103,9 @@
 				return string.Empty;
 			}
 			
-			ICategory category = null;
+			Category category = null;
 			do {
-				ICategory tempCategory = model.GetValue (iter, 0) as ICategory;
+				Category tempCategory = model.GetValue (iter, 0) as Category;
 				if (tempCategory.Name.ToLower ().CompareTo (categoryName.ToLower ()) == 0) {
 					// Found a match
 					category = tempCategory;
@@ -124,9 +124,9 @@
 				                         taskName,
 				                         out taskName,
 				                         out taskDueDate);
-			ITask task = null;
+			Task task = null;
 			try {
-				task = Application.Backend.CreateTask (taskName, category);
+				task = Application.LocalCache.CreateTask (taskName, category);
 				if (taskDueDate != DateTime.MinValue)
 					task.DueDate = taskDueDate;
 			} catch (Exception e) {
@@ -139,7 +139,7 @@
 			}
 			
 			if (enterEditMode) {
-				TaskWindow.SelectAndEdit (task as Task);
+				TaskWindow.SelectAndEdit (task);
 			}
 			
 			#if ENABLE_NOTIFY_SHARP
@@ -154,7 +154,7 @@
 			#endif
 			
 			
-			return task.Id;
+			return task.Id.ToString();
 		}
 		
 		/// <summary>
@@ -175,7 +175,7 @@
 				return emptyArray;
 			
 			do {
-				ICategory category = model.GetValue (iter, 0) as ICategory;
+				Category category = model.GetValue (iter, 0) as Category;
 				if (category is AllCategory)
 					continue; // Prevent the AllCategory from being returned
 				categories.Add (category.Name);
@@ -201,7 +201,7 @@
 			Gtk.TreeIter iter;
 			Gtk.TreeModel model;
 			
-			ITask task;
+			Task task;
 			List<string> ids;
 			
 			ids = new List<string> ();
@@ -211,8 +211,8 @@
 				return new string[0];
 				
 			do {
-				task = model.GetValue (iter, 0) as ITask;
-				ids.Add (task.Id);
+				task = model.GetValue (iter, 0) as Task;
+				ids.Add (task.Id.ToString());
 			} while (model.IterNext (ref iter));
 			
 			return ids.ToArray ();
@@ -229,7 +229,7 @@
 		/// </returns>
 		public string GetNameForTaskById (string id)
 		{
-			ITask task = GetTaskById (id);
+			Task task = GetTaskById (id);
 			return task != null ? task.Name : string.Empty;
 		}
 		
@@ -244,7 +244,7 @@
 		/// </returns>
 		public string GetCategoryForTaskById (string id)
 		{
-			ITask task = GetTaskById (id);
+			Task task = GetTaskById (id);
 			return task != null ? task.Category.Name : string.Empty;
 		}
 		
@@ -259,7 +259,7 @@
 		/// </returns>
 		public int GetStateForTaskById (string id)
 		{
-			ITask task = GetTaskById (id);
+			Task task = GetTaskById (id);
 			return task != null ? (int) task.State : -1;
 		}
 
@@ -271,7 +271,7 @@
 		/// </param>
 		public void MarkTaskAsCompleteById (string id)
 		{
-			ITask task = GetTaskById (id);
+			Task task = GetTaskById (id);
 			if (task == null)
 				return;
 				
@@ -289,19 +289,19 @@
 		/// A <see cref="System.String"/> for the ID of the task
 		/// </param>
 		/// <returns>
-		/// A <see cref="ITask"/> having the given ID
+		/// A <see cref="Task"/> having the given ID
 		/// </returns>
-		private ITask GetTaskById (string id)
+		private Task GetTaskById (string id)
 		{
 			Gtk.TreeIter  iter;
 			Gtk.TreeModel model;
 			
-			ITask task = null;
+			Task task = null;
 			model = Application.LocalCache.Tasks;
 			
 			if (model.GetIterFirst (out iter)) {
 				do {
-					task = model.GetValue (iter, 0) as ITask;
+					task = model.GetValue (iter, 0) as Task;
 					if (task.Id.Equals (id)) {
 						return task;
 					}

Modified: branches/new_cache/src/TaskWindow.cs
==============================================================================
--- branches/new_cache/src/TaskWindow.cs	(original)
+++ branches/new_cache/src/TaskWindow.cs	Tue Dec 30 02:11:18 2008
@@ -244,16 +244,16 @@
 									 23, 59, 59);
 
 			//
-                        // Group TreeView
-                        //
-                        taskTreeView = new TaskTreeView (Application.LocalCache.Tasks);
-                        taskTreeView.Show ();
-                        targetVBox.PackStart (taskTreeView, true, true, 0);
+			// Group TreeView
+			//
+			taskTreeView = new TaskTreeView (Application.LocalCache.Tasks);
+			taskTreeView.Show ();
+			targetVBox.PackStart (taskTreeView, true, true, 0);
 			
 			/*
 			overdueGroup = new TaskGroup (Catalog.GetString ("Overdue"),
 										  rangeStart, rangeEnd,
-										  backend.Tasks);
+										  Application.LocalCache.Tasks);
 			overdueGroup.RowActivated += OnRowActivated;
 			overdueGroup.ButtonPressed += OnButtonPressed;
 			overdueGroup.Show ();
@@ -271,7 +271,7 @@
 									 rangeEnd.Day, 23, 59, 59);
 			todayGroup = new TaskGroup (Catalog.GetString ("Today"),
 										rangeStart, rangeEnd,
-										backend.Tasks);
+										Application.LocalCache.Tasks);
 			todayGroup.RowActivated += OnRowActivated;
 			todayGroup.ButtonPressed += OnButtonPressed;
 			todayGroup.Show ();
@@ -289,7 +289,7 @@
 									 rangeEnd.Day, 23, 59, 59);
 			tomorrowGroup = new TaskGroup (Catalog.GetString ("Tomorrow"),
 										   rangeStart, rangeEnd,
-										   backend.Tasks);
+										   Application.LocalCache.Tasks);
 			tomorrowGroup.RowActivated += OnRowActivated;
 			tomorrowGroup.ButtonPressed += OnButtonPressed;			
 			tomorrowGroup.Show ();
@@ -307,7 +307,7 @@
 									 rangeEnd.Day, 23, 59, 59);
 			nextSevenDaysGroup = new TaskGroup (Catalog.GetString ("Next 7 Days"),
 										   rangeStart, rangeEnd,
-										   backend.Tasks);
+										   Application.LocalCache.Tasks);
 			nextSevenDaysGroup.RowActivated += OnRowActivated;
 			nextSevenDaysGroup.ButtonPressed += OnButtonPressed;				
 			nextSevenDaysGroup.Show ();
@@ -323,7 +323,7 @@
 			rangeEnd = DateTime.MaxValue;
 			futureGroup = new TaskGroup (Catalog.GetString ("Future"),
 										 rangeStart, rangeEnd,
-										 backend.Tasks);
+										 Application.LocalCache.Tasks);
 			futureGroup.RowActivated += OnRowActivated;
 			futureGroup.ButtonPressed += OnButtonPressed;			
 			futureGroup.Show ();
@@ -338,15 +338,14 @@
 			completedTaskGroup = new CompletedTaskGroup (
 					Catalog.GetString ("Completed"),
 					rangeStart, rangeEnd,
-					backend.Tasks);
+					Application.LocalCache.Tasks);
 			completedTaskGroup.RowActivated += OnRowActivated;
 			completedTaskGroup.ButtonPressed += OnButtonPressed;
 			completedTaskGroup.Show ();
 			targetVBox.PackStart (completedTaskGroup, false, false, 0);
 			taskGroups.Add (completedTaskGroup);
-			*/
 			
-
+*/
 			//manualTarget = new TargetService();
 			//manualTarget.Show ();
 			//mainVBox.PackStart(manualTarget, false, false, 0);
@@ -400,7 +399,7 @@
 
 		}
 		
-		public static void ShowWindow ()
+		public static void ShowWindow()
 		{
 			ShowWindow (false);
 		}
@@ -528,7 +527,7 @@
 		}
 		
 		/*
-		public void HighlightTask (ITask task)
+		public void HighlightTask (Task task)
 		{
 			Gtk.TreeIter iter;
 			
@@ -549,15 +548,14 @@
 		}
 		*/
 		
-		/*
 		/// <summary>
 		/// Search through the TaskGroups looking for the specified task and
 		/// adjust the window so the new task is showing.
 		/// </summary>
 		/// <param name="task">
-		/// A <see cref="ITask"/>
+		/// A <see cref="Task"/>
 		/// </param>
-		public void ScrollToTask (ITask task)
+/*		public void ScrollToTask (Task task)
 		{
 			// TODO: NEED to add something to NOT scroll the window if the new
 			// task is already showing in the window!
@@ -632,13 +630,12 @@
 		
 		#region Private Methods
 		void CategoryComboBoxDataFunc (Gtk.CellLayout layout,
-									   Gtk.CellRenderer renderer,
-									   Gtk.TreeModel model,
-									   Gtk.TreeIter iter)
+					       Gtk.CellRenderer renderer,
+					       Gtk.TreeModel model,
+					       Gtk.TreeIter iter)
 		{
 			Gtk.CellRendererText crt = renderer as Gtk.CellRendererText;
 			Category category = model.GetValue (iter, 0) as Category;
-
 			// CRG: What?  I added this check for null and we don't crash
 			// but I never see anything called unknown
 			if(category != null && category.Name != null) {
@@ -646,8 +643,9 @@
 					string.Format ("{0} ({1})",
 								   category.Name,
 								   GetTaskCountInCategory (category));
-			} else
+			} else {
 				crt.Text = "unknown";
+			}
 		}
 		
 		// TODO: Move this method into a property of Category.TaskCount
@@ -902,7 +900,8 @@
 		
 		private void OnRealized (object sender, EventArgs args)
 		{
-			addTaskEntry.GrabFocus ();
+			//addTaskEntry.GrabFocus ();
+			PopulateWindow();
 		}
 		
 		private void WindowDeleted (object sender, DeleteEventArgs args)
@@ -1023,7 +1022,8 @@
 		
 		void OnNewTaskByCategory (object sender, EventArgs args)
 		{
-			/*
+			string newTaskText = addTaskEntry.Text.Trim ();
+
 			if (newTaskText.Length == 0)
 				return;
 			
@@ -1057,10 +1057,9 @@
 				}
 			}
 			
-			ITask task = CreateTask (newTaskText, item.Category);
+			Task task = CreateTask (newTaskText, item.Category);
 			
-			HighlightTask (task);
-			*/
+			//HighlightTask (task);
 			Logger.Debug("OnNewTaskByCategory Called");
 		}
 		



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