tasque r98 - in trunk: . src



Author: bgmerrell
Date: Sun Aug 31 08:43:54 2008
New Revision: 98
URL: http://svn.gnome.org/viewvc/tasque?rev=98&view=rev

Log:
Show more information in the status bar.  Add temporary tooltip for the
tray icon.  Fixes Bug 533033.



Modified:
   trunk/ChangeLog
   trunk/src/Application.cs
   trunk/src/TaskTreeView.cs
   trunk/src/TaskWindow.cs

Modified: trunk/src/Application.cs
==============================================================================
--- trunk/src/Application.cs	(original)
+++ trunk/src/Application.cs	Sun Aug 31 08:43:54 2008
@@ -353,6 +353,8 @@
 
 			// showing the trayicon
 			trayIcon.Visible = true;
+
+			trayIcon.Tooltip = "Tasque Rocks";
 		}
 
 

Modified: trunk/src/TaskTreeView.cs
==============================================================================
--- trunk/src/TaskTreeView.cs	(original)
+++ trunk/src/TaskTreeView.cs	Sun Aug 31 08:43:54 2008
@@ -20,6 +20,8 @@
 		
 		private Gtk.TreeModelFilter modelFilter;
 		private ICategory filterCategory;		
+
+		private static string status;
 		
 		static TaskTreeView ()
 		{
@@ -265,7 +267,6 @@
 		#endregion // Public Methods
 		
 		#region Private Methods
-		
 		protected override void OnRealized ()
 		{
 			base.OnRealized ();
@@ -275,6 +276,11 @@
 			Refilter (filterCategory);
 		}
 
+		private static void ShowCompletedTaskStatus ()
+		{
+			status = Catalog.GetString ("Task Completed");
+			TaskWindow.ShowStatus (status);
+		}
 		
 		private void TaskToggleCellDataFunc (Gtk.TreeViewColumn column,
 										Gtk.CellRenderer cell,
@@ -553,6 +559,7 @@
 				// before marking the task completed.
 				if (showCompletedTasks == true) {
 					task.Complete ();
+					ShowCompletedTaskStatus ();
 				} else {
 					task.Inactivate ();
 					
@@ -565,6 +572,8 @@
 					timer.StartTimer ();
 				}
 			} else {
+				status = Catalog.GetString ("Action Canceled");
+				TaskWindow.ShowStatus (status);
 				task.Activate ();
 			}
 		}
@@ -735,7 +744,9 @@
 			private TaskTreeView tree;
 			private ITask task;
 			private uint delay;
+			private uint secondsLeft;
 			protected uint pulseTimeoutId;
+			private uint secondTimerId;
 			private Gtk.TreeIter iter;
 			private Gtk.TreePath path;
 			
@@ -748,6 +759,7 @@
 				iter = taskIter;
 				path = treeView.Model.GetPath (iter);
 				task = taskToComplete;
+				secondsLeft = delayInSeconds;
 				delay = delayInSeconds * 1000; // Convert to milliseconds
 				pulseTimeoutId = 0;
 			}
@@ -755,13 +767,14 @@
 			public void StartTimer ()
 			{
 				pulseTimeoutId = GLib.Timeout.Add (500, PulseAnimation);
+				StartSecondCountdown ();
 				task.TimerID = GLib.Timeout.Add (delay, CompleteTask);
 				timers [task.TimerID] = this;
 			}
-			
+		
 			public static void CancelTimer(ITask task)
 			{
-				Logger.Debug("Timeout Canceled for task: " + task.Name);
+				Logger.Debug ("Timeout Canceled for task: " + task.Name);
 				InactivateTimer timer = null;
 				uint timerId = task.TimerID;
 				if(timerId != 0) {
@@ -789,6 +802,7 @@
 					return false;
 					
 				task.Complete ();
+				ShowCompletedTaskStatus ();
 				tree.Refilter ();
 				return false; // Don't automatically call this handler again
 			}
@@ -809,6 +823,28 @@
 					return true;
 				}
 			}
+
+			private void StartSecondCountdown ()
+			{
+				SecondCountdown();
+				secondTimerId = GLib.Timeout.Add (1000, SecondCountdown);
+			}
+
+			private bool SecondCountdown ()
+			{
+				if (tree.Model == null) {
+					// Widget has been closed, no need to call this again
+					return false;
+				}
+				if (secondsLeft > 0 && task.State == TaskState.Inactive) {
+					status = String.Format (Catalog.GetString ("Completing Task In: {0}"), secondsLeft--);
+					TaskWindow.ShowStatus (status);
+					return true;
+				} else {
+					return false;
+				}
+			}
+	
 		}
 		#endregion // Private Classes
 	}

Modified: trunk/src/TaskWindow.cs
==============================================================================
--- trunk/src/TaskWindow.cs	(original)
+++ trunk/src/TaskWindow.cs	Sun Aug 31 08:43:54 2008
@@ -66,6 +66,10 @@
 		private Gtk.Statusbar statusbar;
 		private uint statusContext;
 		private uint currentStatusMessageId;
+		private static uint ShowOriginalStatusId;
+		private static string status;
+		private static string lastLoadedTime;
+		private const uint DWELL_TIME_MS = 8000;
 		
 		private ITask clickedTask;
 		
@@ -465,24 +469,44 @@
 			taskWindow.EnterEditMode (task, true);
 			taskWindow.Present ();
 		}
+
+		public static bool ShowOriginalStatus ()
+		{
+			status = string.Format ("Tasks loaded: {0}", TaskWindow.lastLoadedTime);
+			TaskWindow.ShowStatus (status);
+			return false;
+		}
 		
 		public static void ShowStatus (string statusText)
 		{
+			// By default show the new status for 8 seconds
+			ShowStatus (statusText, DWELL_TIME_MS);
+		}
+
+		public static void ShowStatus (string statusText, uint dwellTime)
+		{
 			if (taskWindow == null) {
 				Logger.Warn ("Cannot set status when taskWindow is null");
 				return;
 			}
+
+			// remove old timer to show original status and then start another one
+			if (ShowOriginalStatusId > 0)
+				GLib.Source.Remove (ShowOriginalStatusId);
+			// any status will dwell for <dwellTime> seconds and then the original
+			//status will be shown
+			ShowOriginalStatusId = GLib.Timeout.Add (dwellTime, ShowOriginalStatus);
 			
 			if (taskWindow.currentStatusMessageId != 0) {
 				// Pop the old message
 				taskWindow.statusbar.Remove (taskWindow.statusContext,
-											 taskWindow.currentStatusMessageId);
+								taskWindow.currentStatusMessageId);
 				taskWindow.currentStatusMessageId = 0;
 			}
 			
 			taskWindow.currentStatusMessageId =
 				taskWindow.statusbar.Push (taskWindow.statusContext,
-										   statusText);
+								statusText);
 		}
 
 		public static bool IsOpen
@@ -771,9 +795,14 @@
 			ITask task = backend.CreateTask (taskText, category);
 			
 			if (task == null) {
-				// TODO: Change the status to say there was an error
 				Logger.Debug ("Error creating a new task!");
+				// Show error status
+				status = Catalog.GetString ("Error creating a new task");
+				TaskWindow.ShowStatus (status);
 			} else {
+				// Show successful status
+				status = Catalog.GetString ("Task created successfully");	
+				TaskWindow.ShowStatus (status);
 				// Clear out the entry
 				addTaskEntry.Text = string.Empty;
 				addTaskEntry.GrabFocus ();
@@ -1058,8 +1087,11 @@
 		{
 			if (clickedTask == null)
 				return;
-			
+		
 			Application.Backend.DeleteTask(clickedTask);
+			
+			status = Catalog.GetString ("Task deleted");
+			TaskWindow.ShowStatus (status);
 		}
 
 
@@ -1107,8 +1139,9 @@
 		{
 			Logger.Debug("Backend sync finished");
 			if (Application.Backend.Configured) {
-				string status =
-					string.Format ("Tasks loaded: {0}",DateTime.Now.ToString ());
+				string now = DateTime.Now.ToString ();
+				status = string.Format ("Tasks loaded: {0}", now);
+				TaskWindow.lastLoadedTime = now;
 				TaskWindow.ShowStatus (status);
 				RebuildAddTaskMenu (Application.Backend.Categories);
 				addTaskEntry.Sensitive = true;



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