hipo r181 - in trunk: . help/el src



Author: bgarret
Date: Mon Mar 31 19:44:40 2008
New Revision: 181
URL: http://svn.gnome.org/viewvc/hipo?rev=181&view=rev

Log:
2008-03-31  Benoit Garret  <benoit garret_gnome gadz org>

        * src/Settings.cs: don't explode when the gconf
        keys do not exist.



Modified:
   trunk/ChangeLog
   trunk/help/el/   (props changed)
   trunk/src/Settings.cs

Modified: trunk/src/Settings.cs
==============================================================================
--- trunk/src/Settings.cs	(original)
+++ trunk/src/Settings.cs	Mon Mar 31 19:44:40 2008
@@ -43,7 +43,17 @@
 		public static Array TracksviewColumns
 		{
 			get {
-				return (Array) client.Get (SettingKeys.TracksviewColumns);
+				
+				try {
+					return (Array) client.Get (SettingKeys.TracksviewColumns);
+				}
+				catch (GConf.NoSuchKeyException) {
+					
+					string[] columns = {"Artist", "Album", "Title", "Genre"};
+					
+					client.Set (SettingKeys.TracksviewColumns, (object) columns);
+					return columns;
+				}
 			}
 			set {
 				// UGLY HACK: gconf-sharp does not seem to accept empty arrays
@@ -73,14 +83,28 @@
 		public static string LastPath
 		{
 			get {
-				return (string) client.Get (SettingKeys.LastPath);
+				
+				string path;
+				
+				try {
+					path = (string) client.Get (SettingKeys.LastPath);
+				}
+				catch (GConf.NoSuchKeyException) {
+					
+					path = Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
+					
+					client.Set (SettingKeys.LastPath, (object) path);
+				}
+				
+				return path;
 			}
 			set {
 				// always have a valid directory set
 				if (value != null)
 					client.Set (SettingKeys.LastPath, value);
 				else
-					client.Set (SettingKeys.LastPath, Environment.GetFolderPath (Environment.SpecialFolder.Desktop));
+					client.Set (SettingKeys.LastPath,
+					            Environment.GetFolderPath (Environment.SpecialFolder.Desktop));
 			}
 		}
 



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