tasque r8 - in trunk: . src



Author: calvinrg
Date: Thu Mar 13 05:04:56 2008
New Revision: 8
URL: http://svn.gnome.org/viewvc/tasque?rev=8&view=rev

Log:
* src/PreferencesDialog.cs, src/AllCategory.cs, src/TaskWindow.cs,
  src/Preferences.cs: Modified the preferences so there is a
  HideInAllCategory and any category listed will not be shown in the
  All Category.

Modified:
   trunk/ChangeLog
   trunk/src/AllCategory.cs
   trunk/src/Preferences.cs
   trunk/src/PreferencesDialog.cs
   trunk/src/TaskWindow.cs

Modified: trunk/src/AllCategory.cs
==============================================================================
--- trunk/src/AllCategory.cs	(original)
+++ trunk/src/AllCategory.cs	Thu Mar 13 05:04:56 2008
@@ -13,13 +13,13 @@
 		// category is selected in the TaskWindow.  If the list is empty, tasks
 		// from all categories will be shown.  Otherwise, only tasks from the
 		// specified lists will be shown.
-		List<string> categoriesToShow;
+		List<string> categoriesToHide;
 		
 		public AllCategory ()
 		{
 			Preferences preferences = Application.Preferences;
-			categoriesToShow =
-				preferences.GetStringList (Preferences.ShowInAllCategory);
+			categoriesToHide =
+				preferences.GetStringList (Preferences.HideInAllCategory);
 			Application.Preferences.SettingChanged += OnSettingChanged;
 		}
 		
@@ -34,21 +34,21 @@
 			// categories should be displayed in the AllCategory.
 			ICategory category = task.Category;
 			if (category == null)
-				return false;
-			
-			if (categoriesToShow.Count == 0)
 				return true;
 			
-			return categoriesToShow.Contains (category.Name);
+			//if (categoriesToHide.Count == 0)
+			//	return true;
+			
+			return (!categoriesToHide.Contains (category.Name));
 		}
 		
 		private void OnSettingChanged (Preferences preferences, string settingKey)
 		{
-			if (settingKey.CompareTo (Preferences.ShowInAllCategory) != 0)
+			if (settingKey.CompareTo (Preferences.HideInAllCategory) != 0)
 				return;
 			
-			categoriesToShow =
-				preferences.GetStringList (Preferences.ShowInAllCategory);
+			categoriesToHide =
+				preferences.GetStringList (Preferences.HideInAllCategory);
 		}
 	}
 }

Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs	(original)
+++ trunk/src/Preferences.cs	Thu Mar 13 05:04:56 2008
@@ -52,7 +52,7 @@
 		/// A list of category names to show in the TaskWindow when the "All"
 		/// category is selected.
 		/// </summary>
-		public static string ShowInAllCategory = "ShowInAllCategory";
+		public static string HideInAllCategory = "HideInAllCategory";
 		public static string ShowCompletedTasksKey = "ShowCompletedTasks";
 		public static string UserNameKey = "UserName";
 		public static string UserIdKey = "UserID";

Modified: trunk/src/PreferencesDialog.cs
==============================================================================
--- trunk/src/PreferencesDialog.cs	(original)
+++ trunk/src/PreferencesDialog.cs	Thu Mar 13 05:04:56 2008
@@ -51,7 +51,7 @@
 		int 					selectedBackend;
 		Gtk.CheckButton			showCompletedTasksCheckButton;
 		Gtk.TreeModelFilter		filteredCategories;
-		List<string>			categoriesToShow;
+		List<string>			categoriesToHide;
 		Gtk.TreeView			categoriesTree;
 		
 		//
@@ -304,10 +304,10 @@
 		private void LoadPreferences()
 		{
 			Logger.Debug("Loading preferences");
-			categoriesToShow =
-				Application.Preferences.GetStringList (Preferences.ShowInAllCategory);
-			if (categoriesToShow == null || categoriesToShow.Count == 0)
-				categoriesToShow = BuildNewCategoryList ();
+			categoriesToHide =
+				Application.Preferences.GetStringList (Preferences.HideInAllCategory);
+			//if (categoriesToHide == null || categoriesToHide.Count == 0)
+			//	categoriesToHide = BuildNewCategoryList ();
 		}
 
 		private void ConnectEvents()
@@ -385,9 +385,9 @@
 			Application.Preferences.Set (Preferences.CurrentBackend,
 										 newBackend.GetType ().ToString ());
 			
-			categoriesToShow = BuildNewCategoryList ();
-			Application.Preferences.SetStringList (Preferences.ShowInAllCategory,
-												   categoriesToShow);
+			//categoriesToHide = BuildNewCategoryList ();
+			//Application.Preferences.SetStringList (Preferences.HideInAllCategory,
+			//									   categoriesToHide);
 			RebuildCategoryTree ();
 		}
 		
@@ -399,23 +399,23 @@
 			Gtk.CellRendererToggle crt = cell as Gtk.CellRendererToggle;
 			ICategory category = model.GetValue (iter, 0) as ICategory;
 			if (category == null) {
-				crt.Active = false;
+				crt.Active = true;
 				return;
 			}
 			
 			// If the setting is null or empty, show all categories
-			if (categoriesToShow == null || categoriesToShow.Count == 0) {
+			if (categoriesToHide == null || categoriesToHide.Count == 0) {
 				crt.Active = true;
 				return;
 			}
 			
 			// Check to see if the category is specified in the list
-			if (categoriesToShow.Contains (category.Name) == true) {
-				crt.Active = true;
+			if (categoriesToHide.Contains (category.Name) == true) {
+				crt.Active = false;
 				return;
 			}
 			
-			crt.Active = false;
+			crt.Active = true;
 		}
 		
 		private void TextCellDataFunc (Gtk.TreeViewColumn treeColumn,
@@ -445,18 +445,19 @@
 			if (category == null)
 				return;
 			
-			if (categoriesToShow == null)
-				categoriesToShow = BuildNewCategoryList ();
+			//if (categoriesToHide == null)
+			//	categoriesToHide = BuildNewCategoryList ();
 			
-			if (categoriesToShow.Contains (category.Name))
-				categoriesToShow.Remove (category.Name);
+			if (categoriesToHide.Contains (category.Name))
+				categoriesToHide.Remove (category.Name);
 			else
-				categoriesToShow.Add (category.Name);
+				categoriesToHide.Add (category.Name);
 			
-			Application.Preferences.SetStringList (Preferences.ShowInAllCategory,
-												   categoriesToShow);
+			Application.Preferences.SetStringList (Preferences.HideInAllCategory,
+												   categoriesToHide);
 		}
 		
+/*
 		/// <summary>
 		/// Build a new category list setting from all the categories
 		/// </summary>
@@ -486,6 +487,7 @@
 			
 			return list;
 		}
+*/
 		
 		void RebuildCategoryTree ()
 		{

Modified: trunk/src/TaskWindow.cs
==============================================================================
--- trunk/src/TaskWindow.cs	(original)
+++ trunk/src/TaskWindow.cs	Thu Mar 13 05:04:56 2008
@@ -690,7 +690,7 @@
 		
 		void OnSettingChanged (Preferences preferences, string settingKey)
 		{
-			if (settingKey.CompareTo (Preferences.ShowInAllCategory) != 0)
+			if (settingKey.CompareTo (Preferences.HideInAllCategory) != 0)
 				return;
 			
 			OnCategoryChanged (this, EventArgs.Empty);
@@ -733,11 +733,10 @@
 					// See if the item.Category is currently being shown in
 					// the "All" category and if not, select the category
 					// specifically.
-					List<string> categoriesToShow =
+					List<string> categoriesToHide =
 						Application.Preferences.GetStringList (
-							Preferences.ShowInAllCategory);
-					if (categoriesToShow != null && categoriesToShow.Count > 0
-							&& categoriesToShow.Contains (item.Category.Name) == false) {
+							Preferences.HideInAllCategory);
+					if (categoriesToHide != null && categoriesToHide.Contains (item.Category.Name)) {
 						SelectCategory (item.Category.Name);
 					}
 				} else if (selectedCategory.Name.CompareTo (item.Category.Name) != 0) {



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