f-spot r4019 - trunk/src



Author: sdelcroix
Date: Fri May 30 10:42:49 2008
New Revision: 4019
URL: http://svn.gnome.org/viewvc/f-spot?rev=4019&view=rev

Log:
Preferences.Get<T> again

Modified:
   trunk/src/Core.cs
   trunk/src/DBusProxy.cs
   trunk/src/PhotoView.cs
   trunk/src/SendEmail.cs
   trunk/src/TagStore.cs

Modified: trunk/src/Core.cs
==============================================================================
--- trunk/src/Core.cs	(original)
+++ trunk/src/Core.cs	Fri May 30 10:42:49 2008
@@ -158,14 +158,14 @@
 				if (name != null)
 					tag = Database.Tags.GetTagByName (name);
 				else {
-					int id = (int) Preferences.Get (Preferences.SCREENSAVER_TAG);
+					int id = Preferences.Get<int> (Preferences.SCREENSAVER_TAG);
 					tag = Database.Tags.GetTagById (id);
 				}
 				
 				Photo [] photos;
 				if (tag != null)
 					photos = Database.Photos.Query (new Tag [] { tag } );
- 				else if ((int) Preferences.Get (Preferences.SCREENSAVER_TAG) == 0)
+ 				else if (Preferences.Get<int> (Preferences.SCREENSAVER_TAG) == 0)
  					photos = db.Photos.Query (new Tag [] {});
 				else
 					photos = new Photo [0];

Modified: trunk/src/DBusProxy.cs
==============================================================================
--- trunk/src/DBusProxy.cs	(original)
+++ trunk/src/DBusProxy.cs	Fri May 30 10:42:49 2008
@@ -65,7 +65,7 @@
 			if (photo_remote != null)
 			 	Bus.Session.Unregister (SERVICE_PATH, new ObjectPath (PHOTO_PROXY_PATH));
 
-			bool dbus_readonly = (bool)Preferences.Get (Preferences.DBUS_READ_ONLY);
+			bool dbus_readonly = Preferences.Get<bool> (Preferences.DBUS_READ_ONLY);
 
 			if (dbus_readonly)
 				tag_remote = new ReadOnlyTagRemoteControl (db.Tags);

Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs	(original)
+++ trunk/src/PhotoView.cs	Fri May 30 10:42:49 2008
@@ -334,7 +334,7 @@
 					Gdk.Rectangle area = new Gdk.Rectangle (x, y, width, height);
 					edited = PixbufUtils.RemoveRedeye (original_pixbuf, 
 									   area,
-									   (int) Preferences.Get (Preferences.EDIT_REDEYE_THRESHOLD));
+									   Preferences.Get<int> (Preferences.EDIT_REDEYE_THRESHOLD));
 				} else { // Crop (I told you it was ugly)
 					edited = new Pixbuf (original_pixbuf.Colorspace, 
 							     original_pixbuf.HasAlpha, original_pixbuf.BitsPerSample,
@@ -605,14 +605,12 @@
 	
 		private void LoadPreference (String key)
 		{
-			object val = Preferences.Get (key);
-	
 			switch (key) {
 			case Preferences.CUSTOM_CROP_RATIOS:
 				custom_constraints = new List<SelectionRatioDialog.SelectionConstraint> ();
-				if (val != null && val is string[]) {
+				if (Preferences.Get<string[]> (key) != null) {
 					XmlSerializer serializer = new XmlSerializer (typeof(SelectionRatioDialog.SelectionConstraint));
-					foreach (string xml in val as string[])
+					foreach (string xml in Preferences.Get<string[]> (key))
 						custom_constraints.Add ((SelectionRatioDialog.SelectionConstraint)serializer.Deserialize (new StringReader (xml)));
 				}
 				PopulateConstraints ();

Modified: trunk/src/SendEmail.cs
==============================================================================
--- trunk/src/SendEmail.cs	(original)
+++ trunk/src/SendEmail.cs	Fri May 30 10:42:49 2008
@@ -68,7 +68,7 @@
 				large_size.Sensitive = false;
 				x_large_size.Sensitive = false;
 			} else  
-				switch ((int) Preferences.Get (Preferences.EXPORT_EMAIL_SIZE)) {
+				switch (Preferences.Get<int> (Preferences.EXPORT_EMAIL_SIZE)) {
 					case 0 :  original_size.Active = true; break;
 					case 1 :  tiny_size.Active = true; break;
 					case 2 :  small_size.Active = true; break;
@@ -78,7 +78,7 @@
 					default: break;
 				}
 
-			rotate_check.Active = (bool) Preferences.Get (Preferences.EXPORT_EMAIL_ROTATE);
+			rotate_check.Active = Preferences.Get<bool> (Preferences.EXPORT_EMAIL_ROTATE);
 			rotate_check.Sensitive = original_size.Active && tiny_size.Sensitive;
 			
 			tray_scrolled.Add (new TrayView (selection));
@@ -243,7 +243,7 @@
 			
 			// evaluate mailto command and define attachment args for cli
 			System.Text.StringBuilder attach_arg = new System.Text.StringBuilder ();
-			switch (Preferences.Get (Preferences.GNOME_MAILTO_COMMAND) as string) {
+			switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
 				case "thunderbird %s":
 				case "mozilla-thunderbird %s":
 				case "seamonkey -mail -compose %s":
@@ -325,7 +325,7 @@
 			else {		
 				// Send the mail :)
 				string mail_subject = Catalog.GetString("my photos");
-				switch (Preferences.Get (Preferences.GNOME_MAILTO_COMMAND) as string) {
+				switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
 					// openSuSE
 					case "thunderbird %s":
 						System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
@@ -351,7 +351,7 @@
 				if (tmp_paths.Count > 0) {
 					// Fetch timeout value from preferences. In seconds. Needs to be multiplied with 1000 to get msec
 					uint delete_timeout;
-					delete_timeout = (uint) ( (int) Preferences.Get (Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC) );
+					delete_timeout = (uint) (Preferences.Get<int> (Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC));
 					delete_timeout = delete_timeout * 1000; // to get milliseconds.
 
 					// Start a timer and when it occurs, delete the temp files.

Modified: trunk/src/TagStore.cs
==============================================================================
--- trunk/src/TagStore.cs	(original)
+++ trunk/src/TagStore.cs	Fri May 30 10:42:49 2008
@@ -376,7 +376,7 @@
 		
 		EmitChanged (tag);
 
-		if (update_xmp && (bool)Preferences.Get(Preferences.METADATA_EMBED_IN_IMAGE)) {
+		if (update_xmp && Preferences.Get<bool> (Preferences.METADATA_EMBED_IN_IMAGE)) {
 			Photo [] photos = Core.Database.Photos.Query (new Tag [] { tag });
 			foreach (Photo p in photos) {
 				SyncMetadataJob.Create (Core.Database.Jobs, p);



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