[f-spot] More tweaks based on resharper



commit 4578a17d5986ae8b20d68d8f407d8913aa32b939
Author: Stephen Shaw <sshaw decriptor com>
Date:   Fri Sep 14 00:05:47 2012 -0600

    More tweaks based on resharper

 src/Clients/MainApp/FSpot/ColorManagement.cs    |    6 +-
 src/Clients/MainApp/FSpot/FolderQueryWidget.cs  |    6 +-
 src/Clients/MainApp/FSpot/FullScreenView.cs     |   18 +-
 src/Clients/MainApp/FSpot/GroupSelector.cs      |   56 +++----
 src/Clients/MainApp/FSpot/Literal.cs            |   34 ++--
 src/Clients/MainApp/FSpot/MainWindow.cs         |  216 +++++++++++++----------
 src/Clients/MainApp/FSpot/MetaStore.cs          |    5 +-
 src/Clients/MainApp/FSpot/Photo.cs              |   13 +-
 src/Clients/MainApp/FSpot/PhotoEventArgs.cs     |    2 +-
 src/Clients/MainApp/FSpot/PhotoPopup.cs         |    2 +-
 src/Clients/MainApp/FSpot/PhotoQuery.cs         |   23 +--
 src/Clients/MainApp/FSpot/PhotoView.cs          |    2 +-
 src/Clients/MainApp/FSpot/PixbufCache.cs        |   11 +-
 src/Clients/MainApp/FSpot/Preferences.cs        |    2 +-
 src/Clients/MainApp/FSpot/PrintOperation.cs     |    4 +-
 src/Clients/MainApp/FSpot/ProgressItem.cs       |    5 +-
 src/Clients/MainApp/FSpot/SendEmail.cs          |   57 +++---
 src/Clients/MainApp/FSpot/SingleView.cs         |   45 +++--
 src/Clients/MainApp/FSpot/TagQueryWidget.cs     |    8 +-
 src/Clients/MainApp/FSpot/TagSelectionWidget.cs |    7 +-
 src/Clients/MainApp/FSpot/TagStore.cs           |    9 +-
 src/Clients/MainApp/FSpot/Term.cs               |   15 +-
 src/Clients/MainApp/FSpot/TimeAdaptor.cs        |    8 +-
 src/Clients/MainApp/FSpot/UriCollection.cs      |    4 +-
 src/Clients/MainApp/PhotoTagMenu.cs             |    3 +-
 src/Clients/MainApp/PhotoVersionMenu.cs         |    3 +-
 src/Clients/MainApp/TagCommands.cs              |   13 +-
 27 files changed, 289 insertions(+), 288 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot/ColorManagement.cs b/src/Clients/MainApp/FSpot/ColorManagement.cs
index d530ab8..7d3501c 100644
--- a/src/Clients/MainApp/FSpot/ColorManagement.cs
+++ b/src/Clients/MainApp/FSpot/ColorManagement.cs
@@ -64,11 +64,7 @@ namespace FSpot {
 
 		static Cms.Profile x_profile;
 		public static Cms.Profile XProfile {
-			get {
-				if (x_profile == null)
-					x_profile = Cms.Profile.GetScreenProfile (Gdk.Screen.Default);
-				return x_profile;
-			}
+			get { return x_profile ?? (x_profile = Cms.Profile.GetScreenProfile(Gdk.Screen.Default)); }
 		}
 
 		private static void AddProfiles (string path, IDictionary<string, Cms.Profile> profs)
diff --git a/src/Clients/MainApp/FSpot/FolderQueryWidget.cs b/src/Clients/MainApp/FSpot/FolderQueryWidget.cs
index f845ea5..fb228a1 100644
--- a/src/Clients/MainApp/FSpot/FolderQueryWidget.cs
+++ b/src/Clients/MainApp/FSpot/FolderQueryWidget.cs
@@ -47,7 +47,7 @@ namespace FSpot
 		PhotoQuery query;
 		FolderSet folder_set;
 
-		public FolderQueryWidget (PhotoQuery query) : base ()
+		public FolderQueryWidget (PhotoQuery query)
 		{
 			folder_set = new FolderSet ();
 			this.query = query;
@@ -117,11 +117,11 @@ namespace FSpot
 		}
 
 		public bool Empty {
-			get { return folder_set.Folders == null || folder_set.Folders.Count () == 0; }
+			get { return folder_set.Folders == null || !folder_set.Folders.Any(); }
 		}
 
 		private static TargetEntry [] folder_query_widget_source_table =
-			new TargetEntry [] {
+			new[] {
 				DragDropTargets.UriQueryEntry
 		};
 
diff --git a/src/Clients/MainApp/FSpot/FullScreenView.cs b/src/Clients/MainApp/FSpot/FullScreenView.cs
index b2f749a..ba46f67 100644
--- a/src/Clients/MainApp/FSpot/FullScreenView.cs
+++ b/src/Clients/MainApp/FSpot/FullScreenView.cs
@@ -30,7 +30,7 @@
 //
 
 using System;
-
+using System.Linq;
 using Gtk;
 
 using FSpot.Core;
@@ -80,14 +80,14 @@ namespace FSpot {
 				//scroll = new Gtk.ScrolledWindow (null, null);
 				actions = new ActionGroup ("joe");
 
-				actions.Add (new ActionEntry [] {
+				actions.Add (new[] {
 					new ActionEntry (HideToolbar, Stock.Close,
 							 Catalog.GetString ("Hide"),
 							 null,
 							 Catalog.GetString ("Hide toolbar"),
 							 HideToolbarAction)});
 
-				actions.Add (new ToggleActionEntry [] {
+				actions.Add (new[] {
 					new ToggleActionEntry (Info,
 							       Stock.Info,
 							       Catalog.GetString ("Info"),
@@ -242,14 +242,12 @@ namespace FSpot {
 			if (combo == null)
 				return;
 			TreeIter iter;
-			if (combo.GetActiveIter (out iter)) {
-				string name = combo.Model.GetValue (iter, 0) as string;
-				foreach (var transition in display.Transitions)
-					if (transition.Name == name)
-						display.Transition = transition;
+			if (combo.GetActiveIter (out iter))
+			{
+			    string name = combo.Model.GetValue (iter, 0) as string;
+			    foreach (var transition in display.Transitions.Where(transition => transition.Name == name))
+			        display.Transition = transition;
 			}
-
-
 		}
 
 		protected override bool OnExposeEvent (Gdk.EventExpose args)
diff --git a/src/Clients/MainApp/FSpot/GroupSelector.cs b/src/Clients/MainApp/FSpot/GroupSelector.cs
index 0e6803b..b1e4993 100644
--- a/src/Clients/MainApp/FSpot/GroupSelector.cs
+++ b/src/Clients/MainApp/FSpot/GroupSelector.cs
@@ -30,7 +30,7 @@
 //
 
 using System;
-
+using System.Linq;
 using Mono.Unix;
 
 using Gtk;
@@ -39,6 +39,7 @@ using GLib;
 
 using FSpot.Utils;
 using FSpot.Widgets;
+using Layout = Pango.Layout;
 
 namespace FSpot {
 	public class GroupSelector : Fixed {
@@ -124,9 +125,9 @@ namespace FSpot {
 			int [] box_values = new int [adaptor.Count ()];
 
 			if (tick_layouts != null) {
-				foreach (Pango.Layout l in tick_layouts) {
-					if (l != null)
-						l.Dispose ();
+				foreach (Layout l in tick_layouts.Where(l => l != null))
+				{
+				    l.Dispose ();
 				}
 			}
 			tick_layouts = new Pango.Layout [adaptor.Count ()];
@@ -215,7 +216,7 @@ namespace FSpot {
 
 			Gdk.Rectangle box = new Box (this, position).Bounds;
 
-			// Only scroll to position if we are not dragging
+			// Only scroll to pos if we are not dragging
 			if (!glass.Dragging)
 			{
 				if (box.Right > background.Right)
@@ -299,11 +300,13 @@ namespace FSpot {
 			if (position < 0) {
 				position = 0;
 				return false;
-			} else if (position >= box_counts.Length) {
-				position = box_counts.Length -1;
-				return false;
 			}
-			return true;
+
+		    if (position >= box_counts.Length) {
+		        position = box_counts.Length -1;
+		        return false;
+		    }
+		    return true;
 		}
 
 		private bool BoxHit (double x, double y, out int position)
@@ -591,10 +594,7 @@ namespace FSpot {
 					}
 				}
 				get {
-					if (Dragging)
-						return drag_offset;
-					else
-						return 0;
+				    return Dragging ? drag_offset : 0;
 				}
 			}
 
@@ -618,15 +618,12 @@ namespace FSpot {
 				return true;
 			}
 
-			protected bool PositionValid (int position)
+			protected bool PositionValid (int pos)
 			{
-				if (position < 0 || position > selector.box_counts.Length - 1)
-					return false;
-
-				return true;
+			    return pos >= 0 && pos <= selector.box_counts.Length - 1;
 			}
 
-			public virtual void UpdateDrag (double x, double y)
+		    public virtual void UpdateDrag (double x, double y)
 			{
 				Rectangle bounds = Bounds ();
 				double drag_lower_limit = (selector.background.Left) - (bounds.Width/2);
@@ -698,7 +695,7 @@ namespace FSpot {
 					return;
 
 				Rectangle then = Bounds ();
-				this.position = position;
+				this.Position = position;
 				Rectangle now = Bounds ();
 
 				if (selector.Visible) {
@@ -711,14 +708,9 @@ namespace FSpot {
 					PositionChanged ();
 			}
 
-			private int position;
-			public int Position {
-				get {
-					return position;
-				}
-			}
+		    public int Position { get; private set; }
 
-			public abstract void Draw (Rectangle area);
+		    public abstract void Draw (Rectangle area);
 
 			public abstract void PositionChanged ();
 
@@ -744,7 +736,7 @@ namespace FSpot {
 			}
 
 			public int handle_height = 15;
-			private int border {
+			private int Border {
 				get {
 					return selector.box_spacing * 2;
 				}
@@ -831,7 +823,7 @@ namespace FSpot {
 			{
 				Rectangle box = InnerBounds ();
 
-				box.Inflate  (border, border);
+				box.Inflate  (Border, Border);
 				box.Height += handle_height;
 
 				return box;
@@ -853,7 +845,7 @@ namespace FSpot {
 				Rectangle box = inner;
 				box.Width -= 1;
 				box.Height -= 1;
-				while (i < border) {
+				while (i < Border) {
 					box.Inflate (1, 1);
 
 					selector.Style.BackgroundGC (State).ClipRectangle = area;
@@ -864,11 +856,11 @@ namespace FSpot {
 
 
 				Style.PaintFlatBox (selector.Style, selector.GdkWindow, State, ShadowType.In,
-						    area, selector, "glass", bounds.X, inner.Y + inner.Height + border,
+						    area, selector, "glass", bounds.X, inner.Y + inner.Height + Border,
 						    bounds.Width, handle_height);
 
 				Style.PaintHandle (selector.Style, selector.GdkWindow, State, ShadowType.In,
-						   area, selector, "glass", bounds.X, inner.Y + inner.Height + border,
+						   area, selector, "glass", bounds.X, inner.Y + inner.Height + Border,
 						   bounds.Width, handle_height, Orientation.Horizontal);
 
 				Style.PaintShadow (selector.Style, selector.GdkWindow, State, ShadowType.Out,
diff --git a/src/Clients/MainApp/FSpot/Literal.cs b/src/Clients/MainApp/FSpot/Literal.cs
index 67a7e00..c0ebbf5 100644
--- a/src/Clients/MainApp/FSpot/Literal.cs
+++ b/src/Clients/MainApp/FSpot/Literal.cs
@@ -48,7 +48,7 @@ namespace FSpot
 {
 	public abstract class AbstractLiteral : Term
 	{
-		public AbstractLiteral (Term parent, Literal after) : base (parent, after)
+	    protected AbstractLiteral (Term parent, Literal after) : base (parent, after)
 		{
 		}
 
@@ -268,14 +268,15 @@ else
 
 		public override string SqlCondition ()
 		{
-			StringBuilder ids = new StringBuilder (Tag.Id.ToString ());
+			var ids = new StringBuilder (Tag.Id.ToString ());
 
 			if (Tag is Category) {
-				List<Tag> tags = new List<Tag> ();
+				var tags = new List<Tag> ();
 				(Tag as Category).AddDescendentsTo (tags);
 
-				for (int i = 0; i < tags.Count; i++) {
-					ids.Append (", " + (tags [i] as Tag).Id.ToString ());
+                foreach (var t in tags)
+				{
+				    ids.Append (", " + t.Id.ToString ());
 				}
 			}
 
@@ -466,14 +467,15 @@ else
 
 		private void HandleDragMotion (object o, DragMotionArgs args)
 		{
-			if (!preview) {
-				if (preview_widget == null) {
-					preview_widget = new Gtk.Label (" | ");
-					box.Add (preview_widget);
-				}
+		    if (preview)
+                return;
 
-				preview_widget.Show ();
-			}
+		    if (preview_widget == null) {
+		        preview_widget = new Gtk.Label (" | ");
+		        box.Add (preview_widget);
+		    }
+
+		    preview_widget.Show ();
 		}
 
 		private void HandleDragLeave (object o, EventArgs args)
@@ -501,21 +503,21 @@ else
 		public void HandleRequireTag (object sender, EventArgs args)
 		{
 			if (RequireTag != null)
-				RequireTag (new Tag [] {this.Tag});
+				RequireTag (new[] {this.Tag});
 		}
 
 		public void HandleUnRequireTag (object sender, EventArgs args)
 		{
 			if (UnRequireTag != null)
-				UnRequireTag (new Tag [] {this.Tag});
+				UnRequireTag (new[] {this.Tag});
 		}
 
 		private const int ICON_SIZE = 24;
 		private const int overlay_size = (int)(.40 * ICON_SIZE);
 		private static TargetEntry[] tag_target_table =
-			new TargetEntry [] { DragDropTargets.TagQueryEntry };
+			new[] { DragDropTargets.TagQueryEntry };
 		private static TargetEntry[] tag_dest_target_table =
-			new TargetEntry [] {
+			new[] {
 				DragDropTargets.TagListEntry,
 				DragDropTargets.TagQueryEntry
 			};
diff --git a/src/Clients/MainApp/FSpot/MainWindow.cs b/src/Clients/MainApp/FSpot/MainWindow.cs
index 1e5f40c..4dd23e0 100644
--- a/src/Clients/MainApp/FSpot/MainWindow.cs
+++ b/src/Clients/MainApp/FSpot/MainWindow.cs
@@ -578,13 +578,10 @@ namespace FSpot
 		// Index into the PhotoQuery.  If -1, no photo is selected or multiple photos are selected.
 		private int ActiveIndex ()
 		{
-			if (Selection.Count == 1)
-				return SelectedIds() [0];
-			else
-				return PHOTO_IDX_NONE;
+		    return Selection.Count == 1 ? SelectedIds() [0] : PHOTO_IDX_NONE;
 		}
 
-		// Switching mode.
+	    // Switching mode.
 		public enum ModeType {
 			IconView,
 			PhotoView
@@ -675,23 +672,21 @@ namespace FSpot
 
 		private void HandleExportActivated (object o, EventArgs e)
 		{
-			FSpot.Extensions.ExportMenuItemNode.SelectedImages = delegate () {return new PhotoList (SelectedPhotos ()); };
+			FSpot.Extensions.ExportMenuItemNode.SelectedImages = () => new PhotoList(SelectedPhotos());
 		}
 
 		private void HandleDbItemsChanged (object sender, DbItemEventArgs<Photo> args)
 		{
-			foreach (Photo p in args.Items) {
-				if (p == null)
-					continue;
-				if (write_metadata)
-					FSpot.Jobs.SyncMetadataJob.Create (Database.Jobs, p);
-			}
+		    foreach (Photo p in args.Items.Where(p => p != null).Where(p => write_metadata))
+		    {
+		        FSpot.Jobs.SyncMetadataJob.Create (Database.Jobs, p);
+		    }
 
-			if (args is PhotoEventArgs && (args as PhotoEventArgs).Changes.TimeChanged)
+		    if (args is PhotoEventArgs && (args as PhotoEventArgs).Changes.TimeChanged)
 				query.RequestReload ();
 		}
 
-		private void HandleTagsChanged (object sender, DbItemEventArgs<Tag> args)
+	    private void HandleTagsChanged (object sender, DbItemEventArgs<Tag> args)
 		{
 			icon_view.QueueDraw ();
 			UpdateTagEntryFromSelection ();
@@ -769,7 +764,7 @@ namespace FSpot
 			{
 				switch (win.ViewMode) {
 				case ModeType.PhotoView:
-					return item == win.photo_view.Item.Current ? true : false;
+					return item == win.photo_view.Item.Current;
 				case ModeType.IconView:
 					return win.icon_view.Selection.Contains (item);
 				}
@@ -818,21 +813,20 @@ namespace FSpot
 
 			private void HandleQueryItemsChanged (IBrowsableCollection collection, BrowsableEventArgs args)
 			{
-				// FIXME for now we only listen to changes directly from the query
+			    // FIXME for now we only listen to changes directly from the query
 				// when we are in PhotoView mode because we presume that we'll get
 				// proper notification from the icon view selection in icon view mode
 				if (win.ViewMode != ModeType.PhotoView || ItemsChanged == null)
 					return;
 
-				foreach (int item in args.Items) {
-					if (win.photo_view.Item.Index == item ) {
-						ItemsChanged (this, new BrowsableEventArgs (item, args.Changes));
-						break;
-					}
-				}
+			    foreach (int item in args.Items.Where(item => win.photo_view.Item.Index == item))
+			    {
+			        ItemsChanged (this, new BrowsableEventArgs (item, args.Changes));
+			        break;
+			    }
 			}
 
-			private void HandlePhotoChanged (PhotoView sender)
+		    private void HandlePhotoChanged (PhotoView sender)
 			{
 				if (win.ViewMode == ModeType.PhotoView && Changed != null)
 					Changed (this);
@@ -1133,15 +1127,13 @@ namespace FSpot
 		{
 			// Drag'n drop import.
 			var controller = new ImportController (false);
-			controller.StatusEvent += (evnt) => {
-				ThreadAssist.ProxyToMain (() => {
-					if (evnt == ImportEvent.ImportFinished) {
-						if (controller.PhotosImported > 0) {
-							query.RollSet = new RollSet (Database.Rolls.GetRolls (1));
-						}
-					}
-				});
-			};
+			controller.StatusEvent += (evnt) => ThreadAssist.ProxyToMain (() => {
+			                                                                        if (evnt == ImportEvent.ImportFinished) {
+			                                                                            if (controller.PhotosImported > 0) {
+			                                                                                query.RollSet = new RollSet (Database.Rolls.GetRolls (1));
+			                                                                            }
+			                                                                        }
+			});
 
 			var source = new MultiFileImportSource (list.ToArray ());
 			controller.ActiveSource = source;
@@ -1156,6 +1148,7 @@ namespace FSpot
 			controller.StartImport ();
 		}
 
+        // XXX: never called
 		void HandleImportCommand (object obj, EventArgs args)
 		{
 			StartImport (null);
@@ -1169,7 +1162,7 @@ namespace FSpot
 		void StartImport (SafeUri uri)
 		{
 			var controller = new ImportController (true);
-			controller.StatusEvent += (evnt) => {
+			controller.StatusEvent += evnt => {
 				if (evnt == ImportEvent.ImportFinished) {
 					if (controller.PhotosImported > 0) {
 						query.RollSet = new RollSet (Database.Rolls.GetRolls (1));
@@ -1432,10 +1425,8 @@ namespace FSpot
 		public void HandleTagMenuActivate (object sender, EventArgs args)
 		{
 
-			MenuItem parent = sender as MenuItem;
-			if (parent == null) // We have a Gtk.Action for UI menus, so the "Edit > Remove tag" item needs special treatment
-				parent = uimanager.GetWidget("/ui/menubar1/edit2/remove_tag") as MenuItem;
-			if (parent != null && parent.Submenu is PhotoTagMenu) {
+			MenuItem parent = sender as MenuItem ?? uimanager.GetWidget("/ui/menubar1/edit2/remove_tag") as MenuItem;
+		    if (parent != null && parent.Submenu is PhotoTagMenu) {
 				PhotoTagMenu menu = (PhotoTagMenu) parent.Submenu;
 				menu.Populate (SelectedPhotos ());
 			}
@@ -1463,9 +1454,9 @@ namespace FSpot
 		public void HandleRemoveTagMenuSelected (Tag t)
 		{
 			Database.BeginTransaction ();
-			RemoveTags (SelectedIds (), new Tag [] {t});
+			RemoveTags (SelectedIds (), new[] {t});
 			Database.CommitTransaction ();
-			query_widget.PhotoTagsChanged (new Tag [] {t});
+			query_widget.PhotoTagsChanged (new[] {t});
 		}
 
 		//
@@ -1477,6 +1468,7 @@ namespace FSpot
 			FSpot.Core.Global.PageSetup = Print.RunPageSetupDialog (this.Window, FSpot.Core.Global.PageSetup, null);
 		}
 
+        // XXX: never called
 		void HandlePrintCommand (object sender, EventArgs e)
 		{
 			FSpot.PrintOperation print = new FSpot.PrintOperation (SelectedPhotos ());
@@ -1495,7 +1487,8 @@ namespace FSpot
 			Mono.Addins.Gui.AddinManagerWindow.Run (main_window);
 		}
 
-		void HandleSendMailCommand (object sender, EventArgs args)
+        // XXX: never called
+        void HandleSendMailCommand (object sender, EventArgs args)
 		{
 			//TestDisplay ();
 			new FSpot.SendEmail (new PhotoList (SelectedPhotos ()), Window);
@@ -1511,7 +1504,8 @@ namespace FSpot
 			FSpot.UI.Dialog.AboutDialog.ShowUp ();
 		}
 
-		void HandleTagSizeChange (object sender, EventArgs args)
+        // XXX: never called
+        void HandleTagSizeChange(object sender, EventArgs args)
 		{
 			RadioAction choice = sender as RadioAction;
 
@@ -1587,7 +1581,8 @@ namespace FSpot
 			args.RetVal = true;
 		}
 
-		void HandleCloseCommand (object sender, EventArgs args)
+        // XXX: never called
+        void HandleCloseCommand(object sender, EventArgs args)
 		{
 			Close();
 		}
@@ -1627,26 +1622,30 @@ namespace FSpot
 			this.Window.Destroy ();
 		}
 
-		void HandleCreateVersionCommand (object obj, EventArgs args)
+        // XXX: never called
+        void HandleCreateVersionCommand(object obj, EventArgs args)
 		{
 			PhotoVersionCommands.Create cmd = new PhotoVersionCommands.Create ();
 			cmd.Execute (Database.Photos, CurrentPhoto, GetToplevel (null));
 		}
 
-		void HandleDeleteVersionCommand (object obj, EventArgs args)
+        // XXX: never called
+        void HandleDeleteVersionCommand(object obj, EventArgs args)
 		{
 			PhotoVersionCommands.Delete cmd = new PhotoVersionCommands.Delete ();
 			cmd.Execute (Database.Photos, CurrentPhoto, GetToplevel (null));
 		}
 
-		void HandleDetachVersionCommand (object obj, EventArgs args)
+        // XXX: never called
+        void HandleDetachVersionCommand(object obj, EventArgs args)
 		{
 			PhotoVersionCommands.Detach cmd = new PhotoVersionCommands.Detach ();
 			cmd.Execute (Database.Photos, CurrentPhoto, GetToplevel (null));
 			UpdateQuery ();
 		}
 
-		void HandleRenameVersionCommand (object obj, EventArgs args)
+        // XXX: never called
+        void HandleRenameVersionCommand(object obj, EventArgs args)
 		{
 			PhotoVersionCommands.Rename cmd = new PhotoVersionCommands.Rename ();
 			cmd.Execute (Database.Photos, CurrentPhoto, main_window);
@@ -1733,7 +1732,7 @@ namespace FSpot
 
 		public void HandleMergeTagsCommand (object obj, EventArgs args)
 		{
-			Tag [] tags = this.tag_selection_widget.TagHighlight;
+			Tag [] tags = tag_selection_widget.TagHighlight;
 			if (tags.Length < 2)
 				return;
 
@@ -1799,7 +1798,8 @@ namespace FSpot
 			HandleEditSelectedTagWithTag (survivor);
 		}
 
-		void HandleAdjustTime (object sender, EventArgs args)
+        // XXX: never called
+        void HandleAdjustTime(object sender, EventArgs args)
 		{
 			PhotoList list = new PhotoList (Selection.Items);
 			list.Sort (new IPhotoComparer.CompareDateName ());
@@ -1811,7 +1811,8 @@ namespace FSpot
 			loupe_menu_item.Active = false;
 		}
 
-		void HandleLoupe (object sender, EventArgs args)
+        // XXX: never called
+        void HandleLoupe(object sender, EventArgs args)
 		{
 			// Don't steal characters from any text entries
 			if (Window.Focus is Gtk.Entry && Gtk.Global.CurrentEvent is Gdk.EventKey) {
@@ -1822,7 +1823,8 @@ namespace FSpot
 			photo_view.View.ShowHideLoupe ();
 		}
 
-		void HandleSharpen (object sender, EventArgs args)
+        // XXX: never called
+        void HandleSharpen(object sender, EventArgs args)
 		{
 			// Don't steal characters from any text entries
 			if (Window.Focus is Gtk.Entry && Gtk.Global.CurrentEvent is Gdk.EventKey) {
@@ -1833,7 +1835,8 @@ namespace FSpot
 			photo_view.View.ShowSharpener ();
 		}
 
-		void HandleDisplayToolbar (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayToolbar(object sender, EventArgs args)
 		{
 			if (display_toolbar.Active)
 				toolbar.Show ();
@@ -1841,12 +1844,14 @@ namespace FSpot
 				toolbar.Hide ();
 		}
 
-		void HandleDisplayTags (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayTags(object sender, EventArgs args)
 		{
 			icon_view.DisplayTags = !icon_view.DisplayTags;
 		}
 
-		void HandleDisplayDates (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayDates(object sender, EventArgs args)
 		{
 			// Peg the icon_view's value to the MenuItem's active state,
 			// as icon_view.DisplayDates's get won't always be equal to it's true value
@@ -1854,12 +1859,14 @@ namespace FSpot
 			icon_view.DisplayDates = display_dates_menu_item.Active;
 		}
 
-		void HandleDisplayRatings (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayRatings(object sender, EventArgs args)
 		{
 			icon_view.DisplayRatings = display_ratings_menu_item.Active;
 		}
 
-		void HandleDisplayGroupSelector (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayGroupSelector(object sender, EventArgs args)
 		{
 			if (group_selector.Visible)
 				group_selector.Hide ();
@@ -1867,14 +1874,16 @@ namespace FSpot
 				group_selector.Show ();
 		}
 
-		void HandleDisplayFilmstrip (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayFilmstrip(object sender, EventArgs args)
 		{
 			photo_view.FilmStripVisibility = display_filmstrip.Active;
 			if (ViewMode == ModeType.PhotoView)
 				photo_view.QueueDraw ();
 		}
 
-		void HandleDisplayInfoSidebar (object sender, EventArgs args)
+        // XXX: never called
+        void HandleDisplayInfoSidebar(object sender, EventArgs args)
 		{
 			if (info_vbox.Visible)
 				info_vbox.Hide ();
@@ -1904,12 +1913,14 @@ namespace FSpot
 				SetViewMode (ModeType.PhotoView);
 		}
 
-		void HandleViewBrowse (object sender, EventArgs args)
+        // XXX: never called
+        void HandleViewBrowse(object sender, EventArgs args)
 		{
 			SetViewMode (ModeType.IconView);
 		}
 
-		void HandleViewPhoto (object sender, EventArgs args)
+        // XXX: never called
+        void HandleViewPhoto(object sender, EventArgs args)
 		{
 			SetViewMode (ModeType.PhotoView);
 		}
@@ -2006,22 +2017,26 @@ namespace FSpot
 			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
 		}
 
-		void HandleZoomOut (object sender, ButtonPressEventArgs args)
+        // XXX: never called
+        void HandleZoomOut(object sender, ButtonPressEventArgs args)
 		{
 			ZoomOut ();
 		}
 
-		void HandleZoomOut (object sender, EventArgs args)
+        // XXX: never called
+        void HandleZoomOut(object sender, EventArgs args)
 		{
 			ZoomOut ();
 		}
 
-		void HandleZoomIn (object sender, ButtonPressEventArgs args)
+        // XXX: never called
+        void HandleZoomIn(object sender, ButtonPressEventArgs args)
 		{
 			ZoomIn ();
 		}
 
-		void HandleZoomIn (object sender, EventArgs args)
+        // XXX: never called
+        void HandleZoomIn(object sender, EventArgs args)
 		{
 			ZoomIn ();
 		}
@@ -2157,7 +2172,8 @@ namespace FSpot
 			}
 		}
 
-		void HandleSelectAllCommand (object sender, EventArgs args)
+        // XXX: never called
+        void HandleSelectAllCommand(object sender, EventArgs args)
 		{
 			if (Window.Focus is Editable) {
 				(Window.Focus as Editable).SelectRegion (0, -1); // select all in text box
@@ -2168,13 +2184,15 @@ namespace FSpot
 			UpdateStatusLabel ();
 		}
 
-		void HandleSelectNoneCommand (object sender, EventArgs args)
+        // XXX: never called
+        void HandleSelectNoneCommand(object sender, EventArgs args)
 		{
 			icon_view.Selection.Clear ();
 			UpdateStatusLabel ();
 		}
 
-		void HandleSelectInvertCommand (object sender, EventArgs args)
+        // XXX: never called
+        void HandleSelectInvertCommand(object sender, EventArgs args)
 		{
 			icon_view.Selection.SelectionInvert ();
 			UpdateStatusLabel ();
@@ -2355,7 +2373,9 @@ namespace FSpot
 			Desktop.SetBackgroundImage (current.DefaultVersion.Uri.LocalPath);
 		}
 
-		void HandleSetDateRange (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleSetDateRange(object sender, EventArgs args)
+        {
 			var date_range_dialog = new DateRangeDialog (query.Range, main_window);
 			if ((ResponseType)date_range_dialog.Run () == ResponseType.Ok)
 				query.Range = date_range_dialog.Range;
@@ -2373,19 +2393,27 @@ namespace FSpot
 			query.Range = null;
 		}
 
-		void HandleSelectLastRoll (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleSelectLastRoll(object sender, EventArgs args)
+        {
 			query.RollSet = new RollSet (Database.Rolls.GetRolls (1));
 		}
 
-		void HandleSelectRolls (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleSelectRolls(object sender, EventArgs args)
+        {
 			new LastRolls (query, Database.Rolls, main_window);
 		}
 
-		void HandleClearRollFilter (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleClearRollFilter(object sender, EventArgs args)
+        {
 			query.RollSet = null;
 		}
 
-		void HandleSetRatingFilter (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleSetRatingFilter(object sender, EventArgs args)
+        {
 			new RatingFilterDialog (query, main_window);
 		}
 
@@ -2393,7 +2421,9 @@ namespace FSpot
 			query.RatingRange = null;
 		}
 
-		void HandleFindUntagged (object sender, EventArgs args) {
+        // XXX: never called
+        void HandleFindUntagged(object sender, EventArgs args)
+        {
 			if (query.Untagged == find_untagged.Active)
 				return;
 
@@ -2518,7 +2548,7 @@ namespace FSpot
 
 		void UpdateForVersionChange (IPhotoVersion version)
 		{
-			IPhotoVersionable versionable = CurrentPhoto as IPhotoVersionable;
+			IPhotoVersionable versionable = CurrentPhoto;
 
 			if (versionable != null) {
 				versionable.SetDefaultVersion (version);
@@ -2567,7 +2597,8 @@ namespace FSpot
 			query_widget.UnInclude (tag_selection_widget.TagHighlight);
 		}
 
-		void HandleFindByTag (object sender, EventArgs args)
+        // XXX: never called
+        void HandleFindByTag(object sender, EventArgs args)
 		{
 			UpdateFindByTagMenu ();
 		}
@@ -2597,23 +2628,18 @@ namespace FSpot
 		{
 			MenuItem item = sender as MenuItem;
 
-			int item_pos = 0;
-			foreach (MenuItem i in (item.Parent as Menu).Children) {
-				if (item == i) {
-					break;
-				}
+		    if (item == null) return;
 
-				item_pos++;
-			}
-			// account for All and separator menu items
-			item_pos -= 2;
+		    int item_pos = (item.Parent as Menu).Children.Cast<MenuItem>().TakeWhile(i => item != i).Count();
+		    // account for All and separator menu items
+		    item_pos -= 2;
 
-			FSpot.Term parent_term = LogicWidget.Root.SubTerms [item_pos];
+		    FSpot.Term parent_term = LogicWidget.Root.SubTerms [item_pos];
 
-			if (FSpot.LogicWidget.Box != null) {
-				FSpot.Literal after = parent_term.Last as FSpot.Literal;
-				FSpot.LogicWidget.Box.InsertTerm (tag_selection_widget.TagHighlight, parent_term, after);
-			}
+		    if (FSpot.LogicWidget.Box != null) {
+		        FSpot.Literal after = parent_term.Last as FSpot.Literal;
+		        FSpot.LogicWidget.Box.InsertTerm (tag_selection_widget.TagHighlight, parent_term, after);
+		    }
 		}
 
 		//
@@ -2653,11 +2679,11 @@ namespace FSpot
 				}
 
 				versions_submenu = new PhotoVersionMenu (CurrentPhoto);
-				versions_submenu.VersionChanged += delegate (PhotoVersionMenu menu) { UpdateForVersionChange (menu.Version);};
+				versions_submenu.VersionChanged += menu => UpdateForVersionChange(menu.Version);
 				version_menu_item.Submenu = versions_submenu;
 
-				sharpen.Sensitive = (ViewMode == ModeType.IconView ? false : true);
-				loupe_menu_item.Sensitive = (ViewMode == ModeType.IconView ? false : true);
+				sharpen.Sensitive = (ViewMode != ModeType.IconView);
+				loupe_menu_item.Sensitive = (ViewMode != ModeType.IconView);
 			}
 
 			set_as_background.Sensitive = single_active;
@@ -2790,9 +2816,8 @@ namespace FSpot
 
 			bool support_xcf = false;;
 			if (application.Id == "gimp.desktop")
-				foreach (Gdk.PixbufFormat format in Gdk.Pixbuf.Formats)
-					if (format.Name == "xcf")
-						support_xcf = true;
+				foreach (PixbufFormat format in Gdk.Pixbuf.Formats.Where(format => format.Name == "xcf"))
+				    support_xcf = true;
 
 			//This allows creating a version with a .xcf extension.
 			//There's no need to convert the file to xcf file format, gimp will take care of this
@@ -2919,7 +2944,7 @@ namespace FSpot
 			foreach (string tagname in new_tags) {
 				Tag t = Database.Tags.GetTagByName (tagname);
 				if (t == null) {
-					t = Database.Tags.CreateCategory (default_category, tagname, true) as Tag;
+					t = Database.Tags.CreateCategory (default_category, tagname, true);
 					Database.Tags.Commit (t);
 				}
 				tags [i++] = t;
@@ -3001,7 +3026,6 @@ namespace FSpot
 			}
 
 			query_widget.ShowBar ();
-			return;
 		}
 
 		public void HideSidebar (object o, EventArgs args) {
diff --git a/src/Clients/MainApp/FSpot/MetaStore.cs b/src/Clients/MainApp/FSpot/MetaStore.cs
index 2281373..7ff395a 100644
--- a/src/Clients/MainApp/FSpot/MetaStore.cs
+++ b/src/Clients/MainApp/FSpot/MetaStore.cs
@@ -74,7 +74,7 @@ namespace FSpot {
     
     	private MetaItem GetByName (string name)
     	{
-    		foreach (MetaItem i in this.item_cache.Values)
+    		foreach (MetaItem i in item_cache.Values)
     			if (i.Name == name)
     				return i;
     
@@ -133,8 +133,7 @@ namespace FSpot {
     	private MetaItem Create (string name, string data)
     	{
     
-    		uint id = (uint)Database.Execute(new HyenaSqliteCommand("INSERT INTO meta (name, data) VALUES (?, ?)",
-    				name, (data == null) ? "NULL" : data ));
+    		uint id = (uint)Database.Execute(new HyenaSqliteCommand("INSERT INTO meta (name, data) VALUES (?, ?)", name, data ?? "NULL" ));
     
     		//FIXME This smells bad. This line used to be *before* the
     		//Command.executeNonQuery. It smells of a bug, but there might
diff --git a/src/Clients/MainApp/FSpot/Photo.cs b/src/Clients/MainApp/FSpot/Photo.cs
index 615cec1..69dcc6a 100644
--- a/src/Clients/MainApp/FSpot/Photo.cs
+++ b/src/Clients/MainApp/FSpot/Photo.cs
@@ -118,7 +118,7 @@ namespace FSpot
 		public uint Rating {
 			get { return rating; }
 			set {
-				if (rating == value || value < 0 || value > 5)
+				if (rating == value || value > 5)
 					return;
 				rating = value;
 				changes.RatingChanged = true;
@@ -222,10 +222,7 @@ namespace FSpot
 				return null;
 
 			PhotoVersion v = versions [version_id];
-			if (v != null)
-				return v.Uri;
-
-			return null;
+			return v != null ? v.Uri : null;
 		}
 
 		public IPhotoVersion DefaultVersion {
@@ -264,7 +261,7 @@ namespace FSpot
 					var versionUri = VersionUri (version);
 
 					PixbufUtils.CreateDerivedVersion (DefaultVersion.Uri, versionUri, 95, buffer);
-					(GetVersion (version) as PhotoVersion).ImportMD5 = HashUtils.GenerateMD5 (VersionUri (version));
+					GetVersion (version).ImportMD5 = HashUtils.GenerateMD5 (VersionUri (version));
 					DefaultVersionId = version;
 				} catch (System.Exception e) {
 					Log.Exception (e);
@@ -489,7 +486,7 @@ namespace FSpot
 				throw new Exception ("This name already exists");
 
 
-			(GetVersion (version_id) as PhotoVersion).Name = new_name;
+			GetVersion (version_id).Name = new_name;
 			changes.ChangeVersion (version_id);
 
 			//TODO: rename file too ???
@@ -615,7 +612,7 @@ namespace FSpot
 			if (result == 0)
 				return 0;
 
-			return (this as IPhoto).Compare (photo);
+			return this.Compare (photo);
 		}
 		#endregion
 	}
diff --git a/src/Clients/MainApp/FSpot/PhotoEventArgs.cs b/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
index 464b6b5..e5d592a 100644
--- a/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
+++ b/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
@@ -36,7 +36,7 @@ namespace FSpot
 	public class PhotoEventArgs : DbItemEventArgs<Photo> {
 		public PhotosChanges Changes { get; private set; }
 
-		public PhotoEventArgs (Photo photo, PhotosChanges changes) : this (new Photo[] {photo}, changes)
+		public PhotoEventArgs (Photo photo, PhotosChanges changes) : this (new[] {photo}, changes)
 		{
 		}
 
diff --git a/src/Clients/MainApp/FSpot/PhotoPopup.cs b/src/Clients/MainApp/FSpot/PhotoPopup.cs
index 13f5ec9..a635d1d 100644
--- a/src/Clients/MainApp/FSpot/PhotoPopup.cs
+++ b/src/Clients/MainApp/FSpot/PhotoPopup.cs
@@ -52,7 +52,7 @@ namespace FSpot
 		{
 		}
 
-		public PhotoPopup (Widget parent) : base ()
+		public PhotoPopup (Widget parent)
 		{
 			foreach (MenuNode node in AddinManager.GetExtensionNodes ("/FSpot/Menus/PhotoPopup"))
 				Append (node.GetMenuItem (parent));
diff --git a/src/Clients/MainApp/FSpot/PhotoQuery.cs b/src/Clients/MainApp/FSpot/PhotoQuery.cs
index 1ed8600..8201388 100644
--- a/src/Clients/MainApp/FSpot/PhotoQuery.cs
+++ b/src/Clients/MainApp/FSpot/PhotoQuery.cs
@@ -151,11 +151,7 @@ namespace FSpot {
 		//Query Conditions
 		private Dictionary<Type, IQueryCondition> conditions;
 		private Dictionary<Type, IQueryCondition> Conditions {
-			get {
-				if (conditions == null)
-					conditions = new Dictionary<Type, IQueryCondition> ();
-				return conditions;
-			}
+			get { return conditions ?? (conditions = new Dictionary<Type, IQueryCondition>()); }
 		}
 
 		internal bool SetCondition (IQueryCondition condition)
@@ -204,16 +200,17 @@ namespace FSpot {
 		public bool Untagged {
 			get { return untagged; }
 			set {
-				if (untagged != value) {
-					untagged = value;
+			    if (untagged == value)
+                    return;
 
-					if (untagged) {
-						UnSetCondition<ConditionWrapper> ();
-						UnSetCondition<HiddenTag> ();
-					}
+			    untagged = value;
 
-					RequestReload ();
-				}
+			    if (untagged) {
+			        UnSetCondition<ConditionWrapper> ();
+			        UnSetCondition<HiddenTag> ();
+			    }
+
+			    RequestReload ();
 			}
 		}
 
diff --git a/src/Clients/MainApp/FSpot/PhotoView.cs b/src/Clients/MainApp/FSpot/PhotoView.cs
index dba9bce..a842998 100644
--- a/src/Clients/MainApp/FSpot/PhotoView.cs
+++ b/src/Clients/MainApp/FSpot/PhotoView.cs
@@ -365,7 +365,7 @@ namespace FSpot {
 
 			vbox.ShowAll ();
 
-			Realized += delegate (object o, EventArgs e) {SetColors ();};
+			Realized += (o, e) => SetColors();
 			Preferences.SettingChanged += OnPreferencesChanged;
 		}
 
diff --git a/src/Clients/MainApp/FSpot/PixbufCache.cs b/src/Clients/MainApp/FSpot/PixbufCache.cs
index 8c67407..b1ab652 100644
--- a/src/Clients/MainApp/FSpot/PixbufCache.cs
+++ b/src/Clients/MainApp/FSpot/PixbufCache.cs
@@ -214,7 +214,6 @@ namespace FSpot
 			} catch (GLib.GException){
 				if (loaded != null)
 					loaded.Dispose ();
-				return;
 			}
 		}
 
@@ -324,15 +323,15 @@ namespace FSpot
 			public void SetPixbufExtended (Gdk.Pixbuf value, bool ignore_undead)
 			{
 				lock (this) {
-					if (IsDisposed) {
-						if (ignore_undead) {
+					if (IsDisposed)
+					{
+					    if (ignore_undead) {
 							return;
-						} else {
-							throw new System.Exception ("I don't want to be undead");
 						}
+					    throw new System.Exception ("I don't want to be undead");
 					}
 
-					Gdk.Pixbuf old = this.Pixbuf;
+				    Gdk.Pixbuf old = this.Pixbuf;
 					cache.total_size -= this.Size;
 					this.pixbuf = value;
 					if (pixbuf != null) {
diff --git a/src/Clients/MainApp/FSpot/Preferences.cs b/src/Clients/MainApp/FSpot/Preferences.cs
index 935c242..d92b0bd 100644
--- a/src/Clients/MainApp/FSpot/Preferences.cs
+++ b/src/Clients/MainApp/FSpot/Preferences.cs
@@ -241,7 +241,7 @@ namespace FSpot
 		public static T Get<T> (string key)
 		{
 			T val;
-			if (TryGet<T> (key, out val))
+			if (TryGet (key, out val))
 				return val;
 			try {
 				return (T) GetDefault (key);
diff --git a/src/Clients/MainApp/FSpot/PrintOperation.cs b/src/Clients/MainApp/FSpot/PrintOperation.cs
index e7e3d51..7b2925f 100644
--- a/src/Clients/MainApp/FSpot/PrintOperation.cs
+++ b/src/Clients/MainApp/FSpot/PrintOperation.cs
@@ -51,7 +51,7 @@ namespace FSpot
 		string print_label_format;
 		string comment;
 
-		public PrintOperation (IPhoto [] selected_photos) : base ()
+		public PrintOperation (IPhoto [] selected_photos)
 		{
 			this.selected_photos = selected_photos;
 			CustomTabLabel = Catalog.GetString ("Image Settings");
@@ -209,7 +209,7 @@ namespace FSpot
 
 		private static void DrawComment (Gtk.PrintContext context, double x, double y, double h, string comment, bool rotated)
 		{
-			if (comment == null || comment == String.Empty)
+			if (string.IsNullOrEmpty(comment))
 				return;
 
 			Context cr = context.CairoContext;
diff --git a/src/Clients/MainApp/FSpot/ProgressItem.cs b/src/Clients/MainApp/FSpot/ProgressItem.cs
index 1879151..56938e9 100644
--- a/src/Clients/MainApp/FSpot/ProgressItem.cs
+++ b/src/Clients/MainApp/FSpot/ProgressItem.cs
@@ -29,10 +29,7 @@
 
 namespace FSpot {
 	public class ProgressItem {
-		public ProgressItem () {
-		}
-
-		public delegate void ChangedHandler (ProgressItem item);
+	    public delegate void ChangedHandler (ProgressItem item);
 		public event ChangedHandler Changed;
 
 		double value;
diff --git a/src/Clients/MainApp/FSpot/SendEmail.cs b/src/Clients/MainApp/FSpot/SendEmail.cs
index 602e6db..7f4acf4 100644
--- a/src/Clients/MainApp/FSpot/SendEmail.cs
+++ b/src/Clients/MainApp/FSpot/SendEmail.cs
@@ -305,34 +305,35 @@ namespace FSpot
 			if (progress_dialog != null)
 				progress_dialog.Destroy (); // No need to keep this window
 
-			if (!UserCancelled) {
-				// Send the mail :)
-				string mail_subject = Catalog.GetString("My Photos");
-				switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
-				// openSuSE
-				case "thunderbird %s":
-					System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
-					break;
-				case "icedove %s":
-					System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
-					break;
-				case "mozilla-thunderbird %s":
-					System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
-					break;
-				case "seamonkey -mail -compose %s":
-					System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
-					break;
-				case "kmail %s":
-					System.Diagnostics.Process.Start("kmail", "  --composer --subject \"" + mail_subject + "\"" + mail_attach);
-					break;
-				case "evolution %s": //evo doesn't urldecode the subject
-					GtkBeans.Global.ShowUri (Screen, "mailto:?subject="; + mail_subject + mail_attach);
-					break;
-				default:
-					GtkBeans.Global.ShowUri (Screen, "mailto:?subject="; + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
-					break;
-				}
-			}
+		    if (UserCancelled)
+                return;
+
+		    // Send the mail :)
+		    string mail_subject = Catalog.GetString("My Photos");
+		    switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
+		            // openSuSE
+		        case "thunderbird %s":
+		            System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
+		            break;
+		        case "icedove %s":
+		            System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
+		            break;
+		        case "mozilla-thunderbird %s":
+		            System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
+		            break;
+		        case "seamonkey -mail -compose %s":
+		            System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
+		            break;
+		        case "kmail %s":
+		            System.Diagnostics.Process.Start("kmail", "  --composer --subject \"" + mail_subject + "\"" + mail_attach);
+		            break;
+		        case "evolution %s": //evo doesn't urldecode the subject
+		            GtkBeans.Global.ShowUri (Screen, "mailto:?subject="; + mail_subject + mail_attach);
+		            break;
+		        default:
+		            GtkBeans.Global.ShowUri (Screen, "mailto:?subject="; + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
+		            break;
+		    }
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot/SingleView.cs b/src/Clients/MainApp/FSpot/SingleView.cs
index 38e8733..bca8885 100644
--- a/src/Clients/MainApp/FSpot/SingleView.cs
+++ b/src/Clients/MainApp/FSpot/SingleView.cs
@@ -216,7 +216,7 @@ namespace FSpot {
 
 		void HandleExportActivated (object o, EventArgs e)
 		{
-			FSpot.Extensions.ExportMenuItemNode.SelectedImages = delegate () {return new PhotoList (directory_view.Selection.Items); };
+			FSpot.Extensions.ExportMenuItemNode.SelectedImages = () => new PhotoList(directory_view.Selection.Items);
 		}
 
 		public void HandleCollectionChanged (IBrowsableCollection collection)
@@ -317,7 +317,8 @@ namespace FSpot {
 			Desktop.SetBackgroundImage (current.DefaultVersion.Uri.LocalPath);
 		}
 
-		private void HandleViewToolbar (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleViewToolbar(object sender, System.EventArgs args)
 		{
 			ShowToolbar = toolbar_item.Active;
 		}
@@ -327,7 +328,8 @@ namespace FSpot {
 			ShowSidebar = false;
 		}
 
-		private void HandleViewSidePane (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleViewSidePane(object sender, System.EventArgs args)
 		{
 			ShowSidebar = side_pane_item.Active;
 		}
@@ -338,34 +340,40 @@ namespace FSpot {
 			fsview.PlayPause ();
 		}
 
-		private void HandleViewFilenames (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleViewFilenames(object sender, System.EventArgs args)
 		{
 			directory_view.DisplayFilenames = filenames_item.Active;
 			UpdateStatusLabel ();
 		}
 
-		private void HandleAbout (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleAbout(object sender, System.EventArgs args)
 		{
 			FSpot.UI.Dialog.AboutDialog.ShowUp ();
 		}
 
-		private void HandleNewWindow (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleNewWindow(object sender, System.EventArgs args)
 		{
 			/* FIXME this needs to register witth the core */
 			new SingleView (new SafeUri[] {uri});
 		}
 
-		private void HandlePreferences (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandlePreferences(object sender, System.EventArgs args)
 		{
 			SingleView.PreferenceDialog.Show ();
 		}
 
-		private void HandleOpenFolder (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleOpenFolder(object sender, System.EventArgs args)
 		{
 			Open (FileChooserAction.SelectFolder);
 		}
 
-		private void HandleOpen (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleOpen(object sender, System.EventArgs args)
 		{
 			Open (FileChooserAction.Open);
 		}
@@ -486,9 +494,7 @@ namespace FSpot {
 				collection.LoadItems (list.ToArray());
 
 				Gtk.Drag.Finish (args.Context, true, false, args.Time);
-
-				return;
-			}
+			    }
 		}
 
 		private void UpdateStatusLabel ()
@@ -525,7 +531,8 @@ namespace FSpot {
 			Preferences.Set (Preferences.VIEWER_SHOW_FILENAMES, filenames_item.Active);
 		}
 
-		private void HandleFileOpen (object sender, System.EventArgs args)
+        // XXX: never called
+        private void HandleFileOpen(object sender, System.EventArgs args)
 		{
 			FileChooserDialog file_selector =
 				new FileChooserDialog ("Open", this.Window,
@@ -624,12 +631,14 @@ namespace FSpot {
 				this.Destroyed += HandleDestroyed;
 			}
 
-			void InterpolationToggled (object sender, System.EventArgs args)
+            // XXX: never called
+            void InterpolationToggled(object sender, System.EventArgs args)
 			{
 				Preferences.Set (Preferences.VIEWER_INTERPOLATION, interpolation_check.Active);
 			}
 
-			void HandleTransparentColorSet (object sender, System.EventArgs args)
+            // XXX: never called
+            void HandleTransparentColorSet(object sender, System.EventArgs args)
 			{
 				Preferences.Set (Preferences.VIEWER_TRANS_COLOR,
 						"#" +
@@ -638,7 +647,8 @@ namespace FSpot {
 						(color_button.Color.Blue / 256 ).ToString("x").PadLeft (2, '0'));
 			}
 
-			void HandleTransparencyToggled (object sender, System.EventArgs args)
+            // XXX: never called
+            void HandleTransparencyToggled(object sender, System.EventArgs args)
 			{
 				if (as_background_radio.Active)
 					Preferences.Set (Preferences.VIEWER_TRANSPARENCY, "NONE");
@@ -662,7 +672,8 @@ namespace FSpot {
 				LoadPreference (args.Key);
 			}
 
-			void HandleClose (object sender, EventArgs args)
+            // XXX: never called
+            void HandleClose(object sender, EventArgs args)
 			{
 				this.Destroy ();
 			}
diff --git a/src/Clients/MainApp/FSpot/TagQueryWidget.cs b/src/Clients/MainApp/FSpot/TagQueryWidget.cs
index 6577d54..fb23fa4 100644
--- a/src/Clients/MainApp/FSpot/TagQueryWidget.cs
+++ b/src/Clients/MainApp/FSpot/TagQueryWidget.cs
@@ -196,7 +196,7 @@ namespace FSpot
 	public class LiteralBox : VBox {
 		private GrabHandle handle;
 
-		public LiteralBox () : base ()
+		public LiteralBox ()
 		{
 			handle = new GrabHandle (24, 8);
 
@@ -207,7 +207,7 @@ namespace FSpot
 	}
 
 	public class GrabHandle : DrawingArea {
-		public GrabHandle (int w, int h) : base ()
+		public GrabHandle (int w, int h)
 		{
 			Size (w, h);
 			Orientation = Gtk.Orientation.Horizontal;
@@ -273,7 +273,7 @@ namespace FSpot
 				DragDropTargets.TagQueryEntry
 			};
 
-		public LogicWidget (PhotoQuery query, TagStore tag_store) : base ()
+		public LogicWidget (PhotoQuery query, TagStore tag_store)
 		{
 			//SetFlag (WidgetFlags.NoWindow);
 			this.query = query;
@@ -471,8 +471,6 @@ namespace FSpot
 
 				// Prevent them from being removed again
 				Literal.FocusedLiterals = null;
-
-				return;
 			}
 		}
 
diff --git a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
index 494ef55..9078684 100644
--- a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
+++ b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
@@ -317,7 +317,7 @@ namespace FSpot {
 				//I have no desire to figure out a more performant sort over this...
 				GLib.Value value = new GLib.Value ();
 				store.GetValue(iter, IdColumn, ref value);
-				compare = (Tag) tag_store.Get ((uint) value);
+				compare = tag_store.Get ((uint) value);
 
 				if (compare.CompareTo (tag) > 0) {
 					iter = store.InsertNodeBefore (iter);
@@ -530,7 +530,6 @@ namespace FSpot {
 			text_render.Edited -= HandleTagNameEdited;
 
 			args.RetVal = true;
-			return;
 		}
 
         private static TargetList tagSourceTargetList = new TargetList();
@@ -650,7 +649,6 @@ namespace FSpot {
 		{
 			if (args.Info == DragDropTargets.TagListEntry.Info) {
 				args.SelectionData.SetTagsData (TagHighlight, args.Context.Targets[0]);
-				return;
 			}
 		}
 
@@ -765,7 +763,7 @@ namespace FSpot {
 				foreach (Tag child in TagHighlight) {
 	                // FIXME with this reparenting via dnd, you cannot move a tag to root.
 	                if (child != parent && child.Category != parent && !child.IsAncestorOf(parent)) {
-	                    child.Category = parent as Category;
+	                    child.Category = parent;
 
 	                    // Saving changes will automatically cause the TreeView to be updated
 	                    database.Tags.Commit (child);
@@ -777,7 +775,6 @@ namespace FSpot {
 	            TagHighlight = highlighted_tags;
 
 	            args.RetVal = moved_count > 0;
-				return;
 			}
 		}
 
diff --git a/src/Clients/MainApp/FSpot/TagStore.cs b/src/Clients/MainApp/FSpot/TagStore.cs
index a5d8062..ab3fc79 100644
--- a/src/Clients/MainApp/FSpot/TagStore.cs
+++ b/src/Clients/MainApp/FSpot/TagStore.cs
@@ -315,13 +315,10 @@ namespace FSpot {
 	
 		public override Tag Get (uint id)
 		{
-			if (id == 0)
-				return RootCategory;
-			else
-				return LookupInCache (id);
+		    return id == 0 ? RootCategory : LookupInCache (id);
 		}
-	
-		public override void Remove (Tag tag)
+
+	    public override void Remove (Tag tag)
 		{
 			Category category = tag as Category;
 			if (category != null &&
diff --git a/src/Clients/MainApp/FSpot/Term.cs b/src/Clients/MainApp/FSpot/Term.cs
index 4a0a692..01a1770 100644
--- a/src/Clients/MainApp/FSpot/Term.cs
+++ b/src/Clients/MainApp/FSpot/Term.cs
@@ -35,6 +35,7 @@
 // http://bugzilla-attachments.gnome.org/attachment.cgi?id=54566
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
 
 using Mono.Unix;
@@ -82,11 +83,9 @@ namespace FSpot
 		/// last Literal in term, else null
 		/// </value>
 		public Term Last {
-			get {
-				if (SubTerms.Count > 0)
-					return SubTerms [SubTerms.Count - 1];
-else
-					return null;
+			get
+			{
+			    return SubTerms.Count > 0 ? SubTerms [SubTerms.Count - 1] : null;
 			}
 		}
 
@@ -408,9 +407,9 @@ else
 				return null;
 
 			OrTerm or = new OrTerm (null, null);
-			foreach (Tag t in from_tags) {
-				Literal l = new Literal (t);
-				l.Parent = or;
+			foreach (Literal l in from_tags.Select(t => new Literal (t)))
+			{
+			    l.Parent = or;
 			}
 			return or;
 		}
diff --git a/src/Clients/MainApp/FSpot/TimeAdaptor.cs b/src/Clients/MainApp/FSpot/TimeAdaptor.cs
index 177c5a8..f8f6af8 100644
--- a/src/Clients/MainApp/FSpot/TimeAdaptor.cs
+++ b/src/Clients/MainApp/FSpot/TimeAdaptor.cs
@@ -61,10 +61,7 @@ namespace FSpot {
 
 			DateTime end = DateFromIndex(max);
 
-			if (order_ascending)
-				end = end.AddMonths (1);
-			else
-				end = end.AddMonths(-1);
+			end = order_ascending ? end.AddMonths (1) : end.AddMonths(-1);
 
 			SetLimits (start, end);
 		}
@@ -90,8 +87,7 @@ namespace FSpot {
 
 			if ((start.Month == 12 && !order_ascending) || (start.Month == 1 && order_ascending))
 				return start.Year.ToString ();
-			else
-				return null;
+		    return null;
 		}
 
 		public override int Value (int item)
diff --git a/src/Clients/MainApp/FSpot/UriCollection.cs b/src/Clients/MainApp/FSpot/UriCollection.cs
index 6e12a45..6d36ab6 100644
--- a/src/Clients/MainApp/FSpot/UriCollection.cs
+++ b/src/Clients/MainApp/FSpot/UriCollection.cs
@@ -151,9 +151,7 @@ namespace FSpot {
 					if (ImageFile.HasLoader (i))
 						items.Add (new FilePhoto (i));
 				}
-				ThreadAssist.ProxyToMain (() => {
-					collection.Add (items.ToArray ());
-				});
+				ThreadAssist.ProxyToMain (() => collection.Add (items.ToArray ()));
 			}
 		}
 
diff --git a/src/Clients/MainApp/PhotoTagMenu.cs b/src/Clients/MainApp/PhotoTagMenu.cs
index d338826..77d508c 100644
--- a/src/Clients/MainApp/PhotoTagMenu.cs
+++ b/src/Clients/MainApp/PhotoTagMenu.cs
@@ -42,7 +42,8 @@ public class PhotoTagMenu : Menu
 	public delegate void TagSelectedHandler (Tag t);
 	public event TagSelectedHandler TagSelected;
 
-	public PhotoTagMenu () : base () {
+	public PhotoTagMenu ()
+	{
 	}
 
 	protected PhotoTagMenu (IntPtr raw) : base (raw) {}
diff --git a/src/Clients/MainApp/PhotoVersionMenu.cs b/src/Clients/MainApp/PhotoVersionMenu.cs
index 9a5eabf..e8be8b0 100644
--- a/src/Clients/MainApp/PhotoVersionMenu.cs
+++ b/src/Clients/MainApp/PhotoVersionMenu.cs
@@ -48,7 +48,8 @@ public class PhotoVersionMenu : Menu
 
 	private Dictionary <MenuItem, IPhotoVersion> version_mapping;
 
-	private void HandleMenuItemActivated (object sender, EventArgs args)
+    // XXX: never called
+    private void HandleMenuItemActivated(object sender, EventArgs args)
 	{
 		MenuItem item = sender as MenuItem;
 
diff --git a/src/Clients/MainApp/TagCommands.cs b/src/Clients/MainApp/TagCommands.cs
index a19aa4e..e37d600 100644
--- a/src/Clients/MainApp/TagCommands.cs
+++ b/src/Clients/MainApp/TagCommands.cs
@@ -141,19 +141,20 @@ public class TagCommands {
 			}
 		}
 
-		private void HandleTagNameEntryChanged (object sender, EventArgs args)
+        // XXX: never called
+        private void HandleTagNameEntryChanged(object sender, EventArgs args)
 		{
 			Update ();
 		}
 
 		private Category Category {
-			get {
-				if (categories.Count == 0)
+			get
+			{
+			    if (categories.Count == 0)
 					return tag_store.RootCategory;
-				else
-					return categories [category_option_menu.Active] as Category;
+			    return categories [category_option_menu.Active] as Category;
 			}
-			set {
+		    set {
 				if ((value != null) && (categories.Count > 0)) {
 					//System.Console.WriteLine("TagCreateCommand.set_Category(" + value.Name + ")");
 					for (int i = 0; i < categories.Count; i++) {



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