f-spot r4017 - in trunk: . src



Author: sdelcroix
Date: Fri May 30 09:32:24 2008
New Revision: 4017
URL: http://svn.gnome.org/viewvc/f-spot?rev=4017&view=rev

Log:
2008-05-30  Stephane Delcroix  <sdelcroix novell com>

	* src/Preferences.cs: new Get<T> (string key) method. the other one
	is now deprecated.


Modified:
   trunk/ChangeLog
   trunk/src/MainWindow.cs
   trunk/src/Preferences.cs

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Fri May 30 09:32:24 2008
@@ -2667,11 +2667,7 @@
 			break;
 
 		case Preferences.SIDEBAR_TOP_ENTRY:
-			try {
-				sidebar.SwitchTo ((int) val);
-			} catch {
-				sidebar.SwitchTo (0);
-			}
+			sidebar.SwitchTo (Preferences.Get<int> (key));
 			break;
 
 		case Preferences.TAG_ICON_SIZE:

Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs	(original)
+++ trunk/src/Preferences.cs	Fri May 30 09:32:24 2008
@@ -147,7 +147,6 @@
 				return (int) Tag.IconSize.Large;
 		
 			case SIDEBAR_POSITION:
-			case SIDEBAR_TOP_ENTRY:
 			case ZOOM:
 				return null;
 
@@ -174,6 +173,7 @@
 
 			case PROXY_USE_PROXY:
 				return false;
+			case SIDEBAR_TOP_ENTRY:
 			case PROXY_PORT:
 				return 0;
 			case PROXY_USER:
@@ -185,6 +185,7 @@
 			}
 		}
 		
+		[Obsolete ("use Get<T> (string key) instead")]
 		public static object Get (string key)
 		{
 			lock (cache) {
@@ -203,6 +204,18 @@
 			}
 		}
 
+		public static T Get<T> (string key)
+		{
+					FSpot.Utils.Log.Debug (key);
+			T val;
+			try {
+				val = (T)Get (key);
+			} catch (InvalidCastException) {
+				val = (T)GetDefault (key);
+			}
+			return val;
+		}
+
 		public static void Set (string key, object value)
 		{
 			lock (cache) {



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