[f-spot] Mostly converting some properties over to automatic properties



commit 3b1d28aeefdf9c9e315d34cb44c65b3cb70dba57
Author: Stephen Shaw <sshaw decriptor com>
Date:   Wed Nov 16 01:26:39 2011 -0700

    Mostly converting  some properties over to automatic properties
    
    Some code formatting and commenting as well

 src/Clients/MainApp/FSpot.Database/Db.cs           |  233 ++--
 src/Clients/MainApp/FSpot.Database/DbStore.cs      |  204 ++--
 .../FSpot.Database/FSpotDatabaseConnection.cs      |   26 +-
 src/Clients/MainApp/FSpot.Database/Updater.cs      |  176 +-
 src/Clients/MainApp/FSpot.Editors/Editor.cs        |    2 +
 src/Clients/MainApp/FSpot.Editors/RedEyeEditor.cs  |    1 +
 src/Clients/MainApp/FSpot.Filters/FilterRequest.cs |    9 +-
 src/Clients/MainApp/FSpot.Imaging/IOChannel.cs     |    9 +-
 src/Clients/MainApp/FSpot.Imaging/Tiff.cs          |   50 +-
 .../MainApp/FSpot.Import/FileImportSource.cs       |  288 ++--
 .../MainApp/FSpot.Import/MetadataImporter.cs       |   22 +-
 .../MainApp/FSpot.Loaders/AreaPreparedEventArgs.cs |    8 +-
 .../MainApp/FSpot.Loaders/AreaUpdatedEventArgs.cs  |    7 +-
 .../MainApp/FSpot.Loaders/GdkImageLoader.cs        |   53 +-
 src/Clients/MainApp/FSpot.UI.Dialog/AboutDialog.cs |    1 +
 src/Clients/MainApp/FSpot.Widgets/SlideShow.cs     |    4 +-
 src/Clients/MainApp/FSpot/Accelerometer.cs         |   16 +-
 src/Clients/MainApp/FSpot/ExportStore.cs           |   35 +-
 src/Clients/MainApp/FSpot/JobStore.cs              |  362 ++---
 src/Clients/MainApp/FSpot/MetaStore.cs             |  296 ++--
 src/Clients/MainApp/FSpot/PhotoEventArgs.cs        |    7 +-
 src/Clients/MainApp/FSpot/PhotoStore.cs            | 1781 ++++++++++----------
 src/Clients/MainApp/FSpot/PhotoVersion.cs          |    2 +
 src/Clients/MainApp/FSpot/PhotoView.cs             |   48 +-
 src/Clients/MainApp/FSpot/PixbufCache.cs           |   49 +-
 src/Clients/MainApp/FSpot/RollStore.cs             |    2 +-
 src/Clients/MainApp/FSpot/RotateCommand.cs         |  111 +-
 .../MainApp/FSpot/SelectionDataExtensions.cs       |   24 +-
 src/Clients/MainApp/FSpot/SendEmail.cs             |   31 +-
 src/Clients/MainApp/FSpot/SingleView.cs            |    6 +-
 src/Clients/MainApp/FSpot/TagSelectionWidget.cs    |    7 +-
 src/Clients/MainApp/FSpot/TagStore.cs              |  689 ++++----
 src/Clients/MainApp/FSpot/Term.cs                  |   19 +-
 src/Clients/MainApp/FSpot/ThumbnailCache.cs        |  224 ++--
 src/Clients/MainApp/FSpot/TimeAdaptor.cs           |   12 +-
 src/Clients/MainApp/ImageLoaderThread.cs           |  101 +-
 src/Clients/MainApp/TagPopup.cs                    |   16 +-
 src/Clients/MainApp/ThumbnailCommand.cs            |    3 +-
 src/Core/FSpot.Bling/FSpot.Bling/Animation.cs      |   36 +-
 src/Core/FSpot.Bling/FSpot.Bling/EasedAnimation.cs |   17 +-
 src/Core/FSpot.Bling/FSpot.Bling/EasingFunction.cs |   11 +-
 src/Core/FSpot.Bling/FSpot.Bling/EasingMode.cs     |    1 -
 src/Core/FSpot.Cms/Cms/GammaTable.cs               |   27 +-
 src/Core/FSpot.Cms/Cms/Profile.cs                  |   43 +-
 src/Core/FSpot.Cms/Cms/Transform.cs                |   21 +-
 .../FSpot.Core/FSpot.Core/BrowsableEventArgs.cs    |    7 +-
 .../FSpot.Core/BrowsablePointerChangedEventArgs.cs |   23 +-
 src/Core/FSpot.Core/FSpot.Core/DbItem.cs           |    9 +-
 src/Core/FSpot.Core/FSpot.Core/Global.cs           |   24 +-
 src/Core/FSpot.Core/FSpot.Core/Roll.cs             |    7 +-
 src/Core/FSpot.Core/FSpot.Core/Tag.cs              |   28 +-
 .../FSpot.Widgets/ApplicationActivatedEventArgs.cs |    7 +-
 src/Core/FSpot.Gui/FSpot.Widgets/CurveType.cs      |    2 -
 src/Core/FSpot.Gui/FSpot.Widgets/Layout.cs         |   24 +-
 src/Core/FSpot.Gui/FSpot.Widgets/MenuButton.cs     |   11 +-
 src/Core/FSpot.Gui/FSpot.Widgets/OpenWithMenu.cs   |    7 +-
 src/Core/FSpot.Gui/FSpot.Widgets/ScrolledView.cs   |   37 +-
 .../FSpot.Platform/PreferenceBackend.cs            |   15 +-
 src/Core/FSpot.Query/FSpot.Query/DateRange.cs      |   22 +-
 src/Core/FSpot.Query/FSpot.Query/LogicalTerm.cs    |   40 +-
 src/Core/FSpot.Query/FSpot.Query/OrderByTime.cs    |    9 +-
 src/Core/FSpot.Query/FSpot.Query/RatingRange.cs    |   23 +-
 src/Core/FSpot.Utils/FSpot.Utils/GdkUtils.cs       |    3 +-
 .../FSpot.Utils/RecursiveFileEnumerator.cs         |    6 +-
 .../FSpot.Utils/FSpot.Utils/SafeUriExtensions.cs   |    1 -
 65 files changed, 2556 insertions(+), 2839 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Database/Db.cs b/src/Clients/MainApp/FSpot.Database/Db.cs
index 06ec7e3..4de5eb5 100644
--- a/src/Clients/MainApp/FSpot.Database/Db.cs
+++ b/src/Clients/MainApp/FSpot.Database/Db.cs
@@ -26,7 +26,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using System.IO;
 using System;
 using Hyena;
@@ -37,147 +36,117 @@ namespace FSpot.Database
 {
 
 // The Database puts the stores together.
-
-    public class Db : IDisposable
-    {
-
-        TagStore tag_store;
-        PhotoStore photo_store;
-        RollStore roll_store;
-        ExportStore export_store;
-        JobStore job_store;
-        MetaStore meta_store;
-        bool empty;
-        string path;
-
-        public TagStore Tags {
-            get { return tag_store; }
-        }
-
-        public RollStore Rolls {
-            get { return roll_store; }
-        }
-
-        public ExportStore Exports {
-            get { return export_store; }
-        }
-
-        public JobStore Jobs {
-            get { return job_store; }
-        }
-
-        public PhotoStore Photos {
-            get { return photo_store; }
-        }
-
-        public MetaStore Meta {
-            get { return meta_store; }
-        }
-
-        // This affects how often the database writes data back to disk, and
-        // therefore how likely corruption is in the event of power loss.
-        public bool Sync {
-            set {
-                string query = "PRAGMA synchronous = " + (value ? "ON" : "OFF");
-                Database.Execute (query);
-            }
-        }
-
-        FSpotDatabaseConnection database;
-        public FSpotDatabaseConnection Database {
-            get { return database; }
-        }
-
-
-        public string Repair ()
-        {
-            string backup_path = path;
-            int i = 0;
+	public class Db : IDisposable
+	{
+		string path;
+
+		public bool Empty { get; private set; }
+		public TagStore Tags { get; private set; }
+		public RollStore Rolls { get; private set; }
+		public ExportStore Exports { get; private set; }
+		public JobStore Jobs { get; private set; }
+		public PhotoStore Photos { get; private set; }
+		public MetaStore Meta { get; private set; }
+
+		// This affects how often the database writes data back to disk, and
+		// therefore how likely corruption is in the event of power loss.
+		public bool Sync {
+			set {
+				string query = "PRAGMA synchronous = " + (value ? "ON" : "OFF");
+				Database.Execute (query);
+			}
+		}
+
+		public FSpotDatabaseConnection Database { get; private set; }
+
+		public string Repair ()
+		{
+			string backup_path = path;
+			int i = 0;
             
-            while (File.Exists (backup_path)) {
-                backup_path = String.Format ("{0}-{1}-{2}{3}", Path.GetFileNameWithoutExtension (path), System.DateTime.Now.ToString ("yyyyMMdd"), i++, Path.GetExtension (path));
-            }
+			while (File.Exists (backup_path)) {
+				backup_path = String.Format ("{0}-{1}-{2}{3}", Path.GetFileNameWithoutExtension (path), System.DateTime.Now.ToString ("yyyyMMdd"), i++, Path.GetExtension (path));
+			}
             
-            File.Move (path, backup_path);
-            Init (path, true);
+			File.Move (path, backup_path);
+			Init (path, true);
             
-            return backup_path;
-        }
-
-        public void Init (string path, bool create_if_missing)
-        {
-            uint timer = Log.DebugTimerStart ();
-            bool new_db = !File.Exists (path);
-            this.path = path;
+			return backup_path;
+		}
+
+		public void Init (string path, bool create_if_missing)
+		{
+			uint timer = Log.DebugTimerStart ();
+			bool new_db = !File.Exists (path);
+			this.path = path;
             
-            if (new_db && !create_if_missing)
-                throw new Exception (path + ": File not found");
+			if (new_db && !create_if_missing) {
+				throw new Exception (path + ": File not found");
+			}
             
-            database = new FSpotDatabaseConnection (path);
+			Database = new FSpotDatabaseConnection (path);
             
-            // Load or create the meta table
-            meta_store = new MetaStore (Database, new_db);
+			// Load or create the meta table
+			Meta = new MetaStore (Database, new_db);
             
-            // Update the database schema if necessary
-            FSpot.Database.Updater.Run (Database);
+			// Update the database schema if necessary
+			FSpot.Database.Updater.Run (Database);
             
-            Database.BeginTransaction ();
+			Database.BeginTransaction ();
             
-            tag_store = new TagStore (Database, new_db);
-            roll_store = new RollStore (Database, new_db);
-            export_store = new ExportStore (Database, new_db);
-            job_store = new JobStore (Database, new_db);
-            photo_store = new PhotoStore (Database, new_db);
+			Tags = new TagStore (Database, new_db);
+			Rolls = new RollStore (Database, new_db);
+			Exports = new ExportStore (Database, new_db);
+			Jobs = new JobStore (Database, new_db);
+			Photos = new PhotoStore (Database, new_db);
             
-            Database.CommitTransaction ();
+			Database.CommitTransaction ();
             
-            empty = new_db;
-            Log.DebugTimerPrint (timer, "Db Initialization took {0}");
-        }
-
-        public bool Empty {
-            get { return empty; }
-        }
-
-        public void Dispose ()
-        {
-            Dispose (true);
-            GC.SuppressFinalize (this);
-        }
-
-        bool already_disposed = false;
-        protected virtual void Dispose (bool is_disposing)
-        {
-            if (already_disposed)
-                return;
-            if (is_disposing) {
-                //Free managed resources
-                Database.Dispose ();
-            }
-            //Free unmanaged resources
+			Empty = new_db;
+			Log.DebugTimerPrint (timer, "Db Initialization took {0}");
+		}
+
+		public void Dispose ()
+		{
+			Dispose (true);
+			GC.SuppressFinalize (this);
+		}
+
+		bool already_disposed = false;
+
+		protected virtual void Dispose (bool is_disposing)
+		{
+			if (already_disposed) {
+				return;
+			}
+			if (is_disposing) {
+				//Free managed resources
+				Database.Dispose ();
+			}
+			//Free unmanaged resources
             
-            already_disposed = true;
-        }
-
-        ~Db ()
-        {
-            Log.DebugFormat ("Finalizer called on {0}. Should be Disposed", GetType ());
-            Dispose (false);
-        }
-
-        public void BeginTransaction ()
-        {
-            Database.BeginTransaction ();
-        }
-
-        public void CommitTransaction ()
-        {
-            Database.CommitTransaction ();
-        }
-
-        public void RollbackTransaction ()
-        {
-            Database.RollbackTransaction ();
-        }
-    }
+			already_disposed = true;
+		}
+
+		~Db ()
+		{
+			Log.DebugFormat ("Finalizer called on {0}. Should be Disposed", GetType ());
+			Dispose (false);
+		}
+
+		public void BeginTransaction ()
+		{
+			Database.BeginTransaction ();
+		}
+
+		public void CommitTransaction ()
+		{
+			Database.CommitTransaction ();
+		}
+
+		public void RollbackTransaction ()
+		{
+			Database.RollbackTransaction ();
+		}
+	}
 }
diff --git a/src/Clients/MainApp/FSpot.Database/DbStore.cs b/src/Clients/MainApp/FSpot.Database/DbStore.cs
index 28fc9b6..710a80f 100644
--- a/src/Clients/MainApp/FSpot.Database/DbStore.cs
+++ b/src/Clients/MainApp/FSpot.Database/DbStore.cs
@@ -26,7 +26,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using System;
 using System.Collections.Generic;
 using Hyena;
@@ -34,117 +33,120 @@ using FSpot.Core;
 
 namespace FSpot.Database
 {
-    public abstract class DbStore<T> where T : DbItem
-    {
-        // DbItem cache.
-
-        public event EventHandler<DbItemEventArgs<T>> ItemsAdded;
-        public event EventHandler<DbItemEventArgs<T>> ItemsRemoved;
-        public event EventHandler<DbItemEventArgs<T>> ItemsChanged;
-
-        protected Dictionary<uint, object> item_cache;
-        bool cache_is_immortal;
-
-        protected void AddToCache (T item)
-        {
-            if (item_cache.ContainsKey (item.Id))
-                item_cache.Remove (item.Id);
+	public abstract class DbStore<T> where T : DbItem
+	{
+		// DbItem cache.
+
+		public event EventHandler<DbItemEventArgs<T>> ItemsAdded;
+		public event EventHandler<DbItemEventArgs<T>> ItemsRemoved;
+		public event EventHandler<DbItemEventArgs<T>> ItemsChanged;
+
+		protected Dictionary<uint, object> item_cache;
+		bool cache_is_immortal;
+
+		protected void AddToCache (T item)
+		{
+			if (item_cache.ContainsKey (item.Id)) {
+				item_cache.Remove (item.Id);
+			}
             
-            if (cache_is_immortal)
-                item_cache.Add (item.Id, item);
-            else
-                item_cache.Add (item.Id, new WeakReference (item));
-        }
-
-        protected T LookupInCache (uint id)
-        {
-            if (!item_cache.ContainsKey (id))
-                return null;
+			if (cache_is_immortal) {
+				item_cache.Add (item.Id, item);
+			} else {
+				item_cache.Add (item.Id, new WeakReference (item));
+			}
+		}
+
+		protected T LookupInCache (uint id)
+		{
+			if (!item_cache.ContainsKey (id)) {
+				return null;
+			}
             
-            if (cache_is_immortal)
-                return item_cache[id] as T;
+			if (cache_is_immortal) {
+				return item_cache [id] as T;
+			}
             
-            WeakReference weakref = item_cache[id] as WeakReference;
-            return (T)weakref.Target;
-        }
-
-        protected void RemoveFromCache (T item)
-        {
-            item_cache.Remove (item.Id);
-        }
-
-        protected void EmitAdded (T item)
-        {
-            EmitAdded (new T[] { item });
-        }
-
-        protected void EmitAdded (T[] items)
-        {
-            EmitEvent (ItemsAdded, new DbItemEventArgs<T> (items));
-        }
-
-        protected void EmitChanged (T item)
-        {
-            EmitChanged (new T[] { item });
-        }
-
-        protected void EmitChanged (T[] items)
-        {
-            EmitChanged (items, new DbItemEventArgs<T> (items));
-        }
-
-        protected void EmitChanged (T[] items, DbItemEventArgs<T> args)
-        {
-            EmitEvent (ItemsChanged, args);
-        }
-
-        protected void EmitRemoved (T item)
-        {
-            EmitRemoved (new T[] { item });
-        }
-
-        protected void EmitRemoved (T[] items)
-        {
-            EmitEvent (ItemsRemoved, new DbItemEventArgs<T> (items));
-        }
-
-        private void EmitEvent (EventHandler<DbItemEventArgs<T>> evnt, DbItemEventArgs<T> args)
-        {
-            if (evnt == null)
-                // No subscribers.
-                return;
+			WeakReference weakref = item_cache [id] as WeakReference;
+			return (T)weakref.Target;
+		}
+
+		protected void RemoveFromCache (T item)
+		{
+			item_cache.Remove (item.Id);
+		}
+
+		protected void EmitAdded (T item)
+		{
+			EmitAdded (new T[] { item });
+		}
+
+		protected void EmitAdded (T[] items)
+		{
+			EmitEvent (ItemsAdded, new DbItemEventArgs<T> (items));
+		}
+
+		protected void EmitChanged (T item)
+		{
+			EmitChanged (new T[] { item });
+		}
+
+		protected void EmitChanged (T[] items)
+		{
+			EmitChanged (items, new DbItemEventArgs<T> (items));
+		}
+
+		protected void EmitChanged (T[] items, DbItemEventArgs<T> args)
+		{
+			EmitEvent (ItemsChanged, args);
+		}
+
+		protected void EmitRemoved (T item)
+		{
+			EmitRemoved (new T[] { item });
+		}
+
+		protected void EmitRemoved (T[] items)
+		{
+			EmitEvent (ItemsRemoved, new DbItemEventArgs<T> (items));
+		}
+
+		private void EmitEvent (EventHandler<DbItemEventArgs<T>> evnt, DbItemEventArgs<T> args)
+		{
+			if (evnt == null) {
+				// No subscribers.
+				return;
+			}
             
-            ThreadAssist.ProxyToMain (() => { evnt (this, args); });
-        }
-
-        public bool CacheEmpty {
-            get { return item_cache.Count == 0; }
-        }
+			ThreadAssist.ProxyToMain (() => {
+				evnt (this, args); });
+		}
 
+		public bool CacheEmpty {
+			get { return item_cache.Count == 0; }
+		}
 
-        FSpotDatabaseConnection database;
-        protected FSpotDatabaseConnection Database {
-            get { return database; }
-        }
+		protected FSpotDatabaseConnection Database { get; private set; }
 
 
-        // Constructor.
+		// Constructor.
 
-        public DbStore (FSpotDatabaseConnection database, bool cache_is_immortal)
-        {
-            this.database = database;
-            this.cache_is_immortal = cache_is_immortal;
+		public DbStore (FSpotDatabaseConnection database, bool cache_is_immortal)
+		{
+			Database = database;
+			this.cache_is_immortal = cache_is_immortal;
             
-            item_cache = new Dictionary<uint, object> ();
-        }
+			item_cache = new Dictionary<uint, object> ();
+		}
+
 
+		// Abstract methods.
 
-        // Abstract methods.
+		public abstract T Get (uint id);
 
-        public abstract T Get (uint id);
-        public abstract void Remove (T item);
-        // If you have made changes to "obj", you have to invoke Commit() to have the changes
-        // saved into the database.
-        public abstract void Commit (T item);
-    }
+		public abstract void Remove (T item);
+		// If you have made changes to "obj", you have to invoke Commit() to have the changes
+		// saved into the database.
+		public abstract void Commit (T item);
+	}
 }
diff --git a/src/Clients/MainApp/FSpot.Database/FSpotDatabaseConnection.cs b/src/Clients/MainApp/FSpot.Database/FSpotDatabaseConnection.cs
index 1771f25..4e92bcc 100644
--- a/src/Clients/MainApp/FSpot.Database/FSpotDatabaseConnection.cs
+++ b/src/Clients/MainApp/FSpot.Database/FSpotDatabaseConnection.cs
@@ -26,7 +26,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using System;
 
 using Hyena;
@@ -34,18 +33,17 @@ using Hyena.Data.Sqlite;
 
 namespace FSpot.Database
 {
-    public class FSpotDatabaseConnection : HyenaSqliteConnection
-    {
-        public FSpotDatabaseConnection (string dbpath) : base(dbpath)
-        {
-            //Execute ("PRAGMA synchronous = OFF");
-            //Execute ("PRAGMA temp_store = MEMORY");
-            //Execute ("PRAGMA count_changes = OFF");
+	public class FSpotDatabaseConnection : HyenaSqliteConnection
+	{
+		public FSpotDatabaseConnection (string dbpath) : base(dbpath)
+		{
+			//Execute ("PRAGMA synchronous = OFF");
+			//Execute ("PRAGMA temp_store = MEMORY");
+			//Execute ("PRAGMA count_changes = OFF");
 
-            if (ApplicationContext.CommandLine.Contains("debug-sql"))
-            {
-                Hyena.Data.Sqlite.HyenaSqliteCommand.LogAll = true;
-            }
-        }
-    }
+			if (ApplicationContext.CommandLine.Contains ("debug-sql")) {
+				Hyena.Data.Sqlite.HyenaSqliteCommand.LogAll = true;
+			}
+		}
+	}
 }
diff --git a/src/Clients/MainApp/FSpot.Database/Updater.cs b/src/Clients/MainApp/FSpot.Database/Updater.cs
index 4a0a0eb..c430979 100644
--- a/src/Clients/MainApp/FSpot.Database/Updater.cs
+++ b/src/Clients/MainApp/FSpot.Database/Updater.cs
@@ -44,28 +44,29 @@ using FSpot.UI.Dialog;
 using Hyena;
 using Hyena.Data.Sqlite;
 
-
-namespace FSpot.Database {
-	public static class Updater {
+namespace FSpot.Database
+{
+	public static class Updater
+	{
 		private static ProgressDialog dialog;
 		private static Hashtable updates = new Hashtable ();
 		private static Version db_version;
 		private static FSpotDatabaseConnection db;
-
 		public static bool silent = false;
 
-
 		public static Version LatestVersion {
 			get {
 				if (updates == null || updates.Count == 0)
 					return new Version (0, 0);
+
 				ArrayList keys = new ArrayList (updates.Keys);
 				keys.Sort ();
-				return keys[keys.Count - 1] as Version;
+				return keys [keys.Count - 1] as Version;
 			}
 		}
 
-		static Updater () {
+		static Updater ()
+		{
 			// Update from version 0 to 1: Remove empty Other tags
 			AddUpdate (new Version ("1"), delegate () {
 				string other_id = SelectSingleString ("SELECT id FROM tags WHERE name = 'Other'");
@@ -102,8 +103,8 @@ namespace FSpot.Database {
 				int id = ExecuteScalar ("INSERT INTO tags (name, category_id, is_category, icon) VALUES ('Other', 0, 1, 'stock_icon:f-spot-other.png')");
 
 				Execute (String.Format (
-					"UPDATE tags SET category_id = {0} WHERE id IN "		+
-					"(SELECT id FROM tags WHERE category_id != 0 AND category_id "	+
+					"UPDATE tags SET category_id = {0} WHERE id IN " +
+					"(SELECT id FROM tags WHERE category_id != 0 AND category_id " +
 					"NOT IN (SELECT id FROM tags))",
 					id));
 
@@ -140,7 +141,7 @@ namespace FSpot.Database {
 					"       roll_id            INTEGER NOT NULL,		   " +
 					"       default_version_id INTEGER NOT NULL		   " +
 					")");
-				ExecuteScalar (String.Format("INSERT INTO photos SELECT id, time, directory_path, name, description, 0, default_version_id FROM {0}", tmp_photos));
+				ExecuteScalar (String.Format ("INSERT INTO photos SELECT id, time, directory_path, name, description, 0, default_version_id FROM {0}", tmp_photos));
 
 				Log.Debug ("Will rename imports to rolls!");
 				string tmp_rolls = MoveTableToTemp ("imports");
@@ -149,7 +150,7 @@ namespace FSpot.Database {
 					"	id                 INTEGER PRIMARY KEY NOT NULL,   " +
 					"       time               INTEGER NOT NULL	   	   " +
 					")");
-				ExecuteScalar (String.Format("INSERT INTO rolls SELECT id, time FROM {0}", tmp_rolls));
+				ExecuteScalar (String.Format ("INSERT INTO rolls SELECT id, time FROM {0}", tmp_rolls));
 
 				Log.Debug ("Cleaning weird descriptions, fixes bug #324425.");
 				Execute ("UPDATE photos SET description = \"\" WHERE description LIKE \"Invalid size of entry%\"");
@@ -157,13 +158,13 @@ namespace FSpot.Database {
 
 
 			//Version 6.0, change tag icon f-spot-tag-other to emblem-generic
-			AddUpdate (new Version (6,0), delegate () {
+			AddUpdate (new Version (6, 0), delegate () {
 				ExecuteScalar ("UPDATE tags SET icon = \"stock_icon:emblem-generic\" " +
 						" WHERE icon LIKE \"stock_icon:f-spot-other.png\"");
 			});
 
 			//Update to version 7.0, keep photo uri instead of path
-			AddUpdate (new Version (7,0), delegate () {
+			AddUpdate (new Version (7, 0), delegate () {
 				string tmp_photos = MoveTableToTemp ("photos");
 				Execute (
 					"CREATE TABLE photos (" +
@@ -181,7 +182,7 @@ namespace FSpot.Database {
 			}, true);
 
 			// Update to version 8.0, store full version uri
-			AddUpdate (new Version (8,0),delegate () {
+			AddUpdate (new Version (8, 0), delegate () {
 				string tmp_versions = MoveTableToTemp ("photo_versions");
 				Execute (
 					"CREATE TABLE photo_versions (          " +
@@ -218,7 +219,7 @@ namespace FSpot.Database {
 			}, true);
 
 			// Update to version 9.0
-			AddUpdate (new Version (9,0),delegate () {
+			AddUpdate (new Version (9, 0), delegate () {
 				string tmp_versions = MoveTableToTemp ("photo_versions");
 				Execute (
 					"CREATE TABLE photo_versions (          " +
@@ -235,7 +236,7 @@ namespace FSpot.Database {
 			});
 
 			// Update to version 10.0, make id autoincrement
-			AddUpdate (new Version (10,0),delegate () {
+			AddUpdate (new Version (10, 0), delegate () {
 				string tmp_photos = MoveTableToTemp ("photos");
 				Execute (
 					"CREATE TABLE photos (                                     " +
@@ -254,7 +255,7 @@ namespace FSpot.Database {
 			}, false);
 
 			// Update to version 11.0, rating
-			AddUpdate (new Version (11,0),delegate () {
+			AddUpdate (new Version (11, 0), delegate () {
 				string tmp_photos = MoveTableToTemp ("photos");
 				Execute (
 					"CREATE TABLE photos (                                     " +
@@ -279,17 +280,17 @@ namespace FSpot.Database {
 			});
 
 			// Update to version 13.0
-			AddUpdate (new Version (13,0), delegate () {
+			AddUpdate (new Version (13, 0), delegate () {
 				Execute ("UPDATE photos SET rating = 0 WHERE rating IS NULL");
 			});
 
 			// Update to version 14.0
-			AddUpdate (new Version (14,0), delegate () {
+			AddUpdate (new Version (14, 0), delegate () {
 				Execute ("UPDATE photos SET rating = 0 WHERE rating IS NULL");
 			});
 
 			// Update to version 15.0
-			AddUpdate (new Version (15,0), delegate () {
+			AddUpdate (new Version (15, 0), delegate () {
 				string tmp_photo_tags = MoveTableToTemp ("photo_tags");
 				Execute (
 					"CREATE TABLE photo_tags (        " +
@@ -302,7 +303,7 @@ namespace FSpot.Database {
 					"SELECT photo_id, tag_id FROM {0}", tmp_photo_tags));
 				string tmp_photo_versions = MoveTableToTemp ("photo_versions");
 				Execute (
-					"CREATE TABLE photo_versions (		"+
+					"CREATE TABLE photo_versions (		" +
 					"	photo_id	INTEGER,	" +
 					"	version_id	INTEGER,	" +
 					"	name		STRING,		" +
@@ -317,10 +318,10 @@ namespace FSpot.Database {
 			});
 
 			// Update to version 16.0
-			 AddUpdate (new Version (16,0), delegate () {
-				 string temp_table = MoveTableToTemp ("photos");
+			AddUpdate (new Version (16, 0), delegate () {
+				string temp_table = MoveTableToTemp ("photos");
 
-				 Execute ("CREATE TABLE photos ( " +
+				Execute ("CREATE TABLE photos ( " +
 					  "	id                 INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,   " +
 					  "	time               INTEGER NOT NULL,	   	   " +
 					  "	uri		   STRING NOT NULL,		   " +
@@ -332,7 +333,7 @@ namespace FSpot.Database {
 					  ")"
 				 );
 
-				 Execute (string.Format ("INSERT INTO photos (id, time, uri, description, roll_id, " +
+				Execute (string.Format ("INSERT INTO photos (id, time, uri, description, roll_id, " +
 							 "default_version_id, rating, md5_sum) " +
 							 "SELECT id, time, uri, description, roll_id, " +
 							 "       default_version_id, rating, '' " +
@@ -342,9 +343,9 @@ namespace FSpot.Database {
 				 );
 
 
-				 string temp_versions_table = MoveTableToTemp ("photo_versions");
+				string temp_versions_table = MoveTableToTemp ("photo_versions");
 
-				 Execute ("CREATE TABLE photo_versions (    	" +
+				Execute ("CREATE TABLE photo_versions (    	" +
 					  "      photo_id        INTEGER,  	" +
 					  "      version_id      INTEGER,  	" +
 					  "      name            STRING,    	" +
@@ -353,18 +354,18 @@ namespace FSpot.Database {
 					  "	protected	BOOLEAN		" +
 					  ")");
 
-				 Execute (String.Format ("INSERT INTO photo_versions (photo_id, version_id, name, uri, md5_sum, protected) " +
+				Execute (String.Format ("INSERT INTO photo_versions (photo_id, version_id, name, uri, md5_sum, protected) " +
 							 "SELECT photo_id, version_id, name, uri, '', protected " +
 							 "FROM   {0} ",
 							 temp_versions_table
 							)
 				 );
 
-				 JobStore.CreateTable (db);
+				JobStore.CreateTable (db);
 
-				 // This is kind of hacky but should be a lot faster on
-				 // large photo databases
-				 Execute (string.Format ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) " +
+				// This is kind of hacky but should be a lot faster on
+				// large photo databases
+				Execute (string.Format ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) " +
 							 "SELECT '{0}', id, {1}, {2} " +
 							 "FROM   photos ",
 							 typeof(Jobs.CalculateHashJob).ToString (),
@@ -372,25 +373,25 @@ namespace FSpot.Database {
 							 0
 							)
 				 );
-			 }, true);
+			}, true);
 
 			// Update to version 16.1
-			 AddUpdate (new Version (16,1), delegate () {
-				 Execute ("CREATE INDEX idx_photo_versions_id ON photo_versions(photo_id)");
-			 }, false);
+			AddUpdate (new Version (16, 1), delegate () {
+				Execute ("CREATE INDEX idx_photo_versions_id ON photo_versions(photo_id)");
+			}, false);
 
 			// Update to version 16.2
-			 AddUpdate (new Version (16,2), delegate () {
-				 Execute ("CREATE INDEX idx_photos_roll_id ON photos(roll_id)");
-			 }, false);
+			AddUpdate (new Version (16, 2), delegate () {
+				Execute ("CREATE INDEX idx_photos_roll_id ON photos(roll_id)");
+			}, false);
 
 			// Update to version 16.3
-			AddUpdate (new Version (16,3), delegate () {
+			AddUpdate (new Version (16, 3), delegate () {
 				Execute (String.Format ("DELETE FROM jobs WHERE job_type = '{0}'", typeof(Jobs.CalculateHashJob).ToString ()));
 			}, false);
 
 			// Update to version 16.4
-			AddUpdate (new Version (16,4), delegate () { //fix the tables schema EOL
+			AddUpdate (new Version (16, 4), delegate () { //fix the tables schema EOL
 				string temp_table = MoveTableToTemp ("exports");
 				Execute (
 					"CREATE TABLE exports (\n" +
@@ -449,7 +450,7 @@ namespace FSpot.Database {
 					"FROM {0}", temp_table));
 
 				temp_table = MoveTableToTemp ("photo_tags");
-				Execute(
+				Execute (
 					"CREATE TABLE photo_tags (\n" +
 					"	photo_id	INTEGER, \n" +
 					"       tag_id		INTEGER, \n" +
@@ -462,7 +463,7 @@ namespace FSpot.Database {
 
 				temp_table = MoveTableToTemp ("photo_versions");
 				Execute (
-					"CREATE TABLE photo_versions (\n"+
+					"CREATE TABLE photo_versions (\n" +
 					"	photo_id	INTEGER, \n" +
 					"	version_id	INTEGER, \n" +
 					"	name		STRING, \n" +
@@ -507,10 +508,10 @@ namespace FSpot.Database {
 			});
 
 			// Update to version 16.5
-			AddUpdate (new Version (16,5), delegate () { //fix md5 null in photos and photo_versions table
+			AddUpdate (new Version (16, 5), delegate () { //fix md5 null in photos and photo_versions table
 				string temp_table = MoveTableToTemp ("photo_versions");
 				Execute (
-					"CREATE TABLE photo_versions (\n"+
+					"CREATE TABLE photo_versions (\n" +
 					"	photo_id	INTEGER, \n" +
 					"	version_id	INTEGER, \n" +
 					"	name		STRING, \n" +
@@ -531,7 +532,7 @@ namespace FSpot.Database {
 			});
 
 			// Update to version 17.0, split uri and filename
-			AddUpdate (new Version (17,0),delegate () {
+			AddUpdate (new Version (17, 0), delegate () {
 				string tmp_photos = MoveTableToTemp ("photos");
 				string tmp_versions = MoveTableToTemp ("photo_versions");
 
@@ -549,7 +550,7 @@ namespace FSpot.Database {
 					")");
 
 				Execute (
-					"CREATE TABLE photo_versions (\n"+
+					"CREATE TABLE photo_versions (\n" +
 					"	photo_id	INTEGER, \n" +
 					"	version_id	INTEGER, \n" +
 					"	name		STRING, \n" +
@@ -570,23 +571,23 @@ namespace FSpot.Database {
 					string filename = photo_uri.GetFilename ();
 					Uri base_uri = photo_uri.GetDirectoryUri ();
 
-					string md5 = reader["md5_sum"] != null ? reader ["md5_sum"].ToString () : null;
+					string md5 = reader ["md5_sum"] != null ? reader ["md5_sum"].ToString () : null;
 
 					Execute (new HyenaSqliteCommand (
-						"INSERT INTO photos (id, time, base_uri, filename, description, roll_id, default_version_id, rating, md5_sum) "	+
+						"INSERT INTO photos (id, time, base_uri, filename, description, roll_id, default_version_id, rating, md5_sum) " +
 						"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
 						Convert.ToUInt32 (reader ["id"]),
 						reader ["time"],
 						base_uri.ToString (),
 						filename,
-						reader["description"].ToString (),
+						reader ["description"].ToString (),
 						Convert.ToUInt32 (reader ["roll_id"]),
 						Convert.ToUInt32 (reader ["default_version_id"]),
 						Convert.ToUInt32 (reader ["rating"]),
 						String.IsNullOrEmpty (md5) ? null : md5));
 				}
 
-                reader.Dispose();
+				reader.Dispose ();
 
 				reader = ExecuteReader (String.Format (
 						"SELECT photo_id, version_id, name, uri, md5_sum, protected " +
@@ -598,17 +599,17 @@ namespace FSpot.Database {
 					string filename = photo_uri.GetFilename ();
 					Uri base_uri = photo_uri.GetDirectoryUri ();
 
-					string md5 = reader["md5_sum"] != null ? reader ["md5_sum"].ToString () : null;
+					string md5 = reader ["md5_sum"] != null ? reader ["md5_sum"].ToString () : null;
 
 					Execute (new HyenaSqliteCommand (
 						"INSERT INTO photo_versions (photo_id, version_id, name, base_uri, filename, protected, md5_sum) " +
 						"VALUES (?, ?, ?, ?, ?, ?, ?)",
 						Convert.ToUInt32 (reader ["photo_id"]),
 						Convert.ToUInt32 (reader ["version_id"]),
-						reader["name"].ToString (),
+						reader ["name"].ToString (),
 						base_uri.ToString (),
 						filename,
-						Convert.ToBoolean (reader["protected"]),
+						Convert.ToBoolean (reader ["protected"]),
 						String.IsNullOrEmpty (md5) ? null : md5));
 				}
 
@@ -619,12 +620,12 @@ namespace FSpot.Database {
 			}, true);
 
 			// Update to version 17.1, Rename 'Import Tags' to 'Imported Tags'
-			AddUpdate (new Version (17,1),delegate () {
+			AddUpdate (new Version (17, 1), delegate () {
 				Execute ("UPDATE tags SET name = 'Imported Tags' WHERE name = 'Import Tags'");
 			});
 
 			// Update to version 17.2, Make sure every photo has an Original version in photo_versions
-			AddUpdate (new Version(17,2),delegate () {
+			AddUpdate (new Version (17, 2), delegate () {
 				// Find photos that have no original version;
 				var have_original_query = "SELECT id FROM photos LEFT JOIN photo_versions AS pv ON pv.photo_id = id WHERE pv.version_id = 1";
 				var no_original_query = String.Format ("SELECT id, base_uri, filename FROM photos WHERE id NOT IN ({0})", have_original_query);
@@ -638,15 +639,15 @@ namespace FSpot.Database {
 						Convert.ToUInt32 (reader ["id"]),
 						1,
 						"Original",
-						reader["base_uri"].ToString (),
-						reader["filename"].ToString (),
+						reader ["base_uri"].ToString (),
+						reader ["filename"].ToString (),
 						1,
 						""));
 				}
 			}, true);
 
 			// Update to version 18.0, Import MD5 hashes
-			AddUpdate (new Version(18,0),delegate () {
+			AddUpdate (new Version (18, 0), delegate () {
 				string tmp_photos = MoveTableToTemp ("photos");
 				string tmp_versions = MoveTableToTemp ("photo_versions");
 
@@ -663,7 +664,7 @@ namespace FSpot.Database {
 					")");
 
 				Execute (
-					"CREATE TABLE photo_versions (\n"+
+					"CREATE TABLE photo_versions (\n" +
 					"	photo_id	INTEGER, \n" +
 					"	version_id	INTEGER, \n" +
 					"	name		STRING, \n" +
@@ -680,19 +681,19 @@ namespace FSpot.Database {
 
 				while (reader.Read ()) {
 					Execute (new HyenaSqliteCommand (
-						"INSERT INTO photos (id, time, base_uri, filename, description, roll_id, default_version_id, rating) "	+
+						"INSERT INTO photos (id, time, base_uri, filename, description, roll_id, default_version_id, rating) " +
 						"VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
 						Convert.ToUInt32 (reader ["id"]),
 						reader ["time"],
 						reader ["base_uri"].ToString (),
 						reader ["filename"].ToString (),
-						reader["description"].ToString (),
+						reader ["description"].ToString (),
 						Convert.ToUInt32 (reader ["roll_id"]),
 						Convert.ToUInt32 (reader ["default_version_id"]),
 						Convert.ToUInt32 (reader ["rating"])));
 				}
 
-				reader.Dispose();
+				reader.Dispose ();
 
 				reader = ExecuteReader (String.Format (
 						"SELECT photo_id, version_id, name, base_uri, filename, protected " +
@@ -704,10 +705,10 @@ namespace FSpot.Database {
 						"VALUES (?, ?, ?, ?, ?, ?, ?)",
 						Convert.ToUInt32 (reader ["photo_id"]),
 						Convert.ToUInt32 (reader ["version_id"]),
-						reader["name"].ToString (),
-						reader["base_uri"].ToString (),
-						reader["filename"].ToString (),
-						Convert.ToBoolean (reader["protected"]),
+						reader ["name"].ToString (),
+						reader ["base_uri"].ToString (),
+						reader ["filename"].ToString (),
+						Convert.ToBoolean (reader ["protected"]),
 						""));
 				}
 
@@ -752,9 +753,9 @@ namespace FSpot.Database {
 			// marked as being slow
 			bool slow = false;
 			foreach (Version version in updates.Keys) {
-				if (version > db_version && (updates[version] as Update).IsSlow)
+				if (version > db_version && (updates [version] as Update).IsSlow)
 					slow = true;
-					break;
+				break;
 			}
 
 			if (slow && !silent) {
@@ -776,9 +777,8 @@ namespace FSpot.Database {
 				foreach (Version version in keys) {
 					if (version <= db_version)
 						continue;
-
 					Pulse ();
-					(updates[version] as Update).Execute (db, db_version);
+					(updates [version] as Update).Execute (db, db_version);
 				}
 
 				db.CommitTransaction ();
@@ -808,7 +808,7 @@ namespace FSpot.Database {
 
 		private static void AddUpdate (Version version, UpdateCode code, bool is_slow)
 		{
-			updates[version] = new Update (version, code, is_slow);
+			updates [version] = new Update (version, code, is_slow);
 		}
 
 		public static void Pulse ()
@@ -831,7 +831,7 @@ namespace FSpot.Database {
 
 		private static int ExecuteScalar (string statement)
 		{
-			return db.Execute(statement);
+			return db.Execute (statement);
 		}
 
 		private static IDataReader ExecuteReader (string statement)
@@ -850,9 +850,9 @@ namespace FSpot.Database {
 
 			try {
 				result = db.Query<string> (statement);
-			} catch (Exception) {}
-
-			return result;
+			} catch (Exception) {
+			}
+				return result;
 		}
 
 		private static string MoveTableToTemp (string table_name)
@@ -879,7 +879,8 @@ namespace FSpot.Database {
 
 		private delegate void UpdateCode ();
 
-		private class Update {
+		private class Update
+		{
 			public Version Version;
 			private UpdateCode code;
 			public bool IsSlow = false;
@@ -901,17 +902,19 @@ namespace FSpot.Database {
 			{
 				code ();
 
-				if (!silent)
+				if (!silent) {
 					Log.DebugFormat ("Updated database from version {0} to {1}",
 							db_version.ToString (),
 							Version.ToString ());
+				}
 
 				db_version = Version;
-				db.Execute(new HyenaSqliteCommand("UPDATE meta SET data = ? WHERE name = ?", db_version.ToString (), meta_db_version_string));
+				db.Execute (new HyenaSqliteCommand ("UPDATE meta SET data = ? WHERE name = ?", db_version.ToString (), meta_db_version_string));
 			}
 		}
 
-		public class Version : IComparable {
+		public class Version : IComparable
+		{
 			int maj = 0;
 			int min = 0;
 
@@ -926,20 +929,19 @@ namespace FSpot.Database {
 				string [] parts = version.Split (new char [] {'.'}, 2);
 				try {
 					this.maj = Convert.ToInt32 (parts [0]);
-				}
-				catch (Exception) {
+				} catch (Exception) {
 					this.maj = 0;
 				}
 				try {
 					this.min = Convert.ToInt32 (parts [1]);
-				}
-				catch (Exception) {
+				} catch (Exception) {
 					this.min = 0;
 				}
 			}
 
 			//IComparable
-			public int CompareTo (object obj) {
+			public int CompareTo (object obj)
+			{
 				if (this.GetType () == obj.GetType ())
 					return Compare (this, (Version)obj);
 				else
@@ -987,12 +989,12 @@ namespace FSpot.Database {
 
 			public static bool operator < (Version v1, Version v2)
 			{
-				return Compare (v1,v2) < 0;
+				return Compare (v1, v2) < 0;
 			}
 
 			public static bool operator > (Version v1, Version v2)
 			{
-				return Compare (v1,v2) > 0;
+				return Compare (v1, v2) > 0;
 			}
 
 			public static bool operator <= (Version v1, Version v2)
diff --git a/src/Clients/MainApp/FSpot.Editors/Editor.cs b/src/Clients/MainApp/FSpot.Editors/Editor.cs
index a67e45a..a07a037 100644
--- a/src/Clients/MainApp/FSpot.Editors/Editor.cs
+++ b/src/Clients/MainApp/FSpot.Editors/Editor.cs
@@ -42,6 +42,8 @@ using Mono.Unix;
 using System;
 
 namespace FSpot.Editors {
+
+	// Move EditorNode to FSpot.Extionsions
 	[ExtensionNode ("Editor")]
 	public class EditorNode : ExtensionNode {
 		[NodeAttribute (Required=true)]
diff --git a/src/Clients/MainApp/FSpot.Editors/RedEyeEditor.cs b/src/Clients/MainApp/FSpot.Editors/RedEyeEditor.cs
index 0d484e1..72224fc 100644
--- a/src/Clients/MainApp/FSpot.Editors/RedEyeEditor.cs
+++ b/src/Clients/MainApp/FSpot.Editors/RedEyeEditor.cs
@@ -39,6 +39,7 @@ using System;
 namespace FSpot.Editors {
 	class RedEyeEditor : Editor {
 		public RedEyeEditor () : base (Catalog.GetString ("Red-eye Reduction"), "red-eye-remove") {
+			// FIXME: ??? need tooltip Catalog.GetString ("Remove red-eye form the photo")
 			NeedsSelection = true;
 			ApplyLabel = Catalog.GetString ("Fix!");
 		}
diff --git a/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs b/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
index 3be1046..a44b8e1 100644
--- a/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
+++ b/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
@@ -41,14 +41,13 @@ namespace FSpot.Filters {
 
 	public class FilterRequest : IDisposable
 	{
-		SafeUri source;
 		SafeUri current;
 
 		ArrayList temp_uris;
 
 		public FilterRequest (SafeUri source)
 		{
-			this.source = source;
+			Source = source;
 			this.current = source;
 			temp_uris = new ArrayList ();
 		}
@@ -58,14 +57,12 @@ namespace FSpot.Filters {
 			Close ();
 		}
 
-		public SafeUri Source {
-			get { return source; }
-		}
+		public SafeUri Source { get; private set; }
 
 		public SafeUri Current {
 			get { return current; }
 			set {
-				if (!value.Equals (source) && !temp_uris.Contains (value))
+				if (!value.Equals (Source) && !temp_uris.Contains (value))
 					temp_uris.Add (value);
 				current = value;
 			}
diff --git a/src/Clients/MainApp/FSpot.Imaging/IOChannel.cs b/src/Clients/MainApp/FSpot.Imaging/IOChannel.cs
index bb48122..043ccff 100644
--- a/src/Clients/MainApp/FSpot.Imaging/IOChannel.cs
+++ b/src/Clients/MainApp/FSpot.Imaging/IOChannel.cs
@@ -66,15 +66,12 @@ namespace FSpot.Imaging {
 
 	public class DataReadEventArgs : EventArgs {
 		public bool Continue;
-		IOCondition condition;
 
-		public IOCondition Condition {
-			get { return condition; }
-		}
+		public IOCondition Condition { get; private set; }
 
 		public DataReadEventArgs (IOCondition condition)
 		{
-			this.condition = condition;
+			Condition = condition;
 			Continue = true;
 		}
 	}
@@ -264,7 +261,7 @@ namespace FSpot.Imaging {
 
 		public override long Seek (long position, SeekOrigin origin)
 		{
-            throw new NotSupportedException ();
+      		      throw new NotSupportedException ();
 		}
 
 		[DllImport("libglib-2.0-0.dll")]
diff --git a/src/Clients/MainApp/FSpot.Imaging/Tiff.cs b/src/Clients/MainApp/FSpot.Imaging/Tiff.cs
index 22716c0..5f026c5 100644
--- a/src/Clients/MainApp/FSpot.Imaging/Tiff.cs
+++ b/src/Clients/MainApp/FSpot.Imaging/Tiff.cs
@@ -28,7 +28,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using FSpot;
 using FSpot.Utils;
 using System;
@@ -41,7 +40,8 @@ using TagLib.IFD;
 using TagLib.IFD.Entries;
 using TagLib.IFD.Tags;
 
-namespace FSpot.Imaging {
+namespace FSpot.Imaging
+{
 	/*
 		public Cms.Profile GetProfile ()
 		{
@@ -130,8 +130,8 @@ namespace FSpot.Imaging {
 			return new Cms.Profile (whitepoint, primaries, transfer);
 		}
 	}*/
-
-	public class DngFile : BaseImageFile {
+	public class DngFile : BaseImageFile
+	{
 		uint offset;
 
 		public DngFile (SafeUri uri) : base (uri)
@@ -140,17 +140,17 @@ namespace FSpot.Imaging {
 
 		protected override void ExtractMetadata (TagLib.Image.File metadata)
 		{
-            base.ExtractMetadata (metadata);
+			base.ExtractMetadata (metadata);
 
-            if (metadata == null)
-                return;
+			if (metadata == null)
+				return;
 
 			try {
 				var tag = metadata.GetTag (TagTypes.TiffIFD) as IFDTag;
 				var structure = tag.Structure;
-				var sub_entries = (structure.GetEntry (0, (ushort) IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries;
+				var sub_entries = (structure.GetEntry (0, (ushort)IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries;
 				var subimage_structure = sub_entries [sub_entries.Length - 1];
-				var entry = subimage_structure.GetEntry (0, (ushort) IFDEntryTag.StripOffsets);
+				var entry = subimage_structure.GetEntry (0, (ushort)IFDEntryTag.StripOffsets);
 				offset = (entry as StripOffsetsIFDEntry).Values [0];
 			} catch (Exception e) {
 				Log.DebugException (e);
@@ -169,8 +169,9 @@ namespace FSpot.Imaging {
 		}
 	}
 
-	public class NefFile : BaseImageFile {
-		byte [] jpeg_data;
+	public class NefFile : BaseImageFile
+	{
+		byte[] jpeg_data;
 
 		public NefFile (SafeUri uri) : base (uri)
 		{
@@ -178,16 +179,16 @@ namespace FSpot.Imaging {
 
 		protected override void ExtractMetadata (TagLib.Image.File metadata)
 		{
-            base.ExtractMetadata (metadata);
+			base.ExtractMetadata (metadata);
 
-            if (metadata == null)
-                return;
+			if (metadata == null)
+				return;
 
 			try {
 				var tag = metadata.GetTag (TagTypes.TiffIFD) as IFDTag;
 				var structure = tag.Structure;
-				var SubImage1_structure = (structure.GetEntry (0, (ushort) IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries [0];
-				var entry = SubImage1_structure.GetEntry (0, (ushort) IFDEntryTag.JPEGInterchangeFormat);
+				var SubImage1_structure = (structure.GetEntry (0, (ushort)IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries [0];
+				var entry = SubImage1_structure.GetEntry (0, (ushort)IFDEntryTag.JPEGInterchangeFormat);
 				jpeg_data = (entry as ThumbnailDataIFDEntry).Data.Data;
 			} catch (Exception e) {
 				Log.DebugException (e);
@@ -197,16 +198,15 @@ namespace FSpot.Imaging {
 
 		public override System.IO.Stream PixbufStream ()
 		{
-			if (jpeg_data != null) {
+			if (jpeg_data != null)
 				return new MemoryStream (jpeg_data);
-			} else {
+			else
 				return DCRawFile.RawPixbufStream (Uri);
-			}
 		}
 	}
 
-
-	public class Cr2File : BaseImageFile {
+	public class Cr2File : BaseImageFile
+	{
 		uint offset;
 
 		public Cr2File (SafeUri uri) : base (uri)
@@ -215,15 +215,15 @@ namespace FSpot.Imaging {
 
 		protected override void ExtractMetadata (TagLib.Image.File metadata)
 		{
-            base.ExtractMetadata (metadata);
+			base.ExtractMetadata (metadata);
 
-            if (metadata == null)
-                return;
+			if (metadata == null)
+				return;
 
 			try {
 				var tag = metadata.GetTag (TagTypes.TiffIFD) as IFDTag;
 				var structure = tag.Structure;
-				var entry = structure.GetEntry (0, (ushort) IFDEntryTag.StripOffsets);
+				var entry = structure.GetEntry (0, (ushort)IFDEntryTag.StripOffsets);
 				offset = (entry as StripOffsetsIFDEntry).Values [0];
 			} catch (Exception e) {
 				Log.DebugException (e);
diff --git a/src/Clients/MainApp/FSpot.Import/FileImportSource.cs b/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
index eaaa4f7..4cea7a5 100644
--- a/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
+++ b/src/Clients/MainApp/FSpot.Import/FileImportSource.cs
@@ -26,7 +26,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using Hyena;
 using System;
 using System.Threading;
@@ -39,145 +38,150 @@ using Mono.Unix.Native;
 
 namespace FSpot.Import
 {
-    internal class FileImportSource : ImportSource {
-        public string Name { get; set; }
-        public string IconName { get; set; }
-        public SafeUri Root { get; set; }
-
-        public Thread PhotoScanner;
-        bool run_photoscanner = false;
-
-        public FileImportSource (SafeUri root, string name, string icon_name)
-        {
-            Root = root;
-            Name = name;
-
-            if (root != null) {
-                if (IsIPodPhoto) {
-                    IconName = "multimedia-player";
-                } else if (IsCamera) {
-                    IconName = "media-flash";
-                } else {
-                    IconName = icon_name;
-                }
-            }
-        }
-
-        public void StartPhotoScan (ImportController controller, PhotoList photo_list)
-        {
-            if (PhotoScanner != null) {
-                run_photoscanner = false;
-                PhotoScanner.Join ();
-            }
-
-            run_photoscanner = true;
-            PhotoScanner = ThreadAssist.Spawn (() => ScanPhotos (controller, photo_list));
-        }
-
-        protected virtual void ScanPhotos (ImportController controller, PhotoList photo_list)
-        {
-            ScanPhotoDirectory (controller, Root, photo_list);
-            ThreadAssist.ProxyToMain (() => controller.PhotoScanFinished ());
-        }
-
-        protected void ScanPhotoDirectory (ImportController controller, SafeUri uri, PhotoList photo_list)
-        {
-            var enumerator = new RecursiveFileEnumerator (uri) {
-                Recurse = controller.RecurseSubdirectories,
-                CatchErrors = true,
-                IgnoreSymlinks = true
-            };
-            var infos = new List<FileImportInfo> ();
-            foreach (var file in enumerator) {
-                if (ImageFile.HasLoader (new SafeUri (file.Uri, true))) {
-                    infos.Add (new FileImportInfo (new SafeUri(file.Uri, true)));
-                }
-
-                if (infos.Count % 10 == 0 || infos.Count < 10) {
-                    var to_add = infos; // prevents race condition
-                    ThreadAssist.ProxyToMain (() => photo_list.Add (to_add.ToArray ()));
-                    infos = new List<FileImportInfo> ();
-                }
-
-                if (!run_photoscanner)
-                    return;
-            }
-
-            if (infos.Count > 0) {
-                var to_add = infos; // prevents race condition
-                ThreadAssist.ProxyToMain (() => photo_list.Add (to_add.ToArray ()));
-            }
-        }
-
-        public void Deactivate ()
-        {
-            if (PhotoScanner != null) {
-                run_photoscanner = false;
-                PhotoScanner.Join ();
-
-                // Make sure all photos are added. This is needed to prevent
-                // a race condition where a source is deactivated, yet photos
-                // are still added to the collection because they are
-                // queued on the mainloop.
-                while (Application.EventsPending ())
-                    Application.RunIteration (false);
-
-                PhotoScanner = null;
-            }
-        }
-
-        private bool IsCamera {
-            get {
-                try {
-                    var file = GLib.FileFactory.NewForUri (Root.Append ("DCIM"));
-                    return file.Exists;
-                } catch {
-                    return false;
-                }
-            }
-        }
-
-        private bool IsIPodPhoto {
-            get {
-                try {
-                    var file = GLib.FileFactory.NewForUri (Root.Append ("Photos"));
-                    var file2 = GLib.FileFactory.NewForUri (Root.Append ("iPod_Control"));
-                    return file.Exists && file2.Exists;
-                } catch {
-                    return false;
-                }
-            }
-        }
-    }
-
-    // Multi root version for drag and drop import.
-    internal class MultiFileImportSource : FileImportSource {
-        private IEnumerable<SafeUri> uris;
-
-        public MultiFileImportSource (IEnumerable<SafeUri> uris)
-            : base (null, String.Empty, String.Empty)
-        {
-            this.uris = uris;
-        }
-
-        protected override void ScanPhotos (ImportController controller, PhotoList photo_list)
-        {
-            foreach (var uri in uris) {
-                Log.Debug ("Scanning "+uri);
-                ScanPhotoDirectory (controller, uri, photo_list);
-            }
-            ThreadAssist.ProxyToMain (() => controller.PhotoScanFinished ());
-        }
-    }
-
-    internal class FileImportInfo : FilePhoto {
-        public FileImportInfo (SafeUri original) : base (original)
-        {
-        }
-
-
-        public SafeUri DestinationUri { get; set; }
-
-        internal uint PhotoId { get; set; }
-    }
+	internal class FileImportSource : ImportSource
+	{
+		public string Name { get; set; }
+
+		public string IconName { get; set; }
+
+		public SafeUri Root { get; set; }
+
+		public Thread PhotoScanner;
+		bool run_photoscanner = false;
+
+		public FileImportSource (SafeUri root, string name, string icon_name)
+		{
+			Root = root;
+			Name = name;
+
+			if (root != null) {
+				if (IsIPodPhoto) {
+					IconName = "multimedia-player";
+				} else if (IsCamera) {
+					IconName = "media-flash";
+				} else {
+					IconName = icon_name;
+				}
+			}
+		}
+
+		public void StartPhotoScan (ImportController controller, PhotoList photo_list)
+		{
+			if (PhotoScanner != null) {
+				run_photoscanner = false;
+				PhotoScanner.Join ();
+			}
+
+			run_photoscanner = true;
+			PhotoScanner = ThreadAssist.Spawn (() => ScanPhotos (controller, photo_list));
+		}
+
+		protected virtual void ScanPhotos (ImportController controller, PhotoList photo_list)
+		{
+			ScanPhotoDirectory (controller, Root, photo_list);
+			ThreadAssist.ProxyToMain (() => controller.PhotoScanFinished ());
+		}
+
+		protected void ScanPhotoDirectory (ImportController controller, SafeUri uri, PhotoList photo_list)
+		{
+			var enumerator = new RecursiveFileEnumerator (uri) {
+						Recurse = controller.RecurseSubdirectories,
+						CatchErrors = true,
+						IgnoreSymlinks = true
+			};
+			var infos = new List<FileImportInfo> ();
+			foreach (var file in enumerator) {
+				if (ImageFile.HasLoader (new SafeUri (file.Uri, true))) {
+					infos.Add (new FileImportInfo (new SafeUri (file.Uri, true)));
+				}
+
+				if (infos.Count % 10 == 0 || infos.Count < 10) {
+					var to_add = infos; // prevents race condition
+					ThreadAssist.ProxyToMain (() => photo_list.Add (to_add.ToArray ()));
+					infos = new List<FileImportInfo> ();
+				}
+
+				if (!run_photoscanner)
+					return;
+			}
+
+			if (infos.Count > 0) {
+				var to_add = infos; // prevents race condition
+				ThreadAssist.ProxyToMain (() => photo_list.Add (to_add.ToArray ()));
+			}
+		}
+
+		public void Deactivate ()
+		{
+			if (PhotoScanner != null) {
+				run_photoscanner = false;
+				PhotoScanner.Join ();
+
+				// Make sure all photos are added. This is needed to prevent
+				// a race condition where a source is deactivated, yet photos
+				// are still added to the collection because they are
+				// queued on the mainloop.
+				while (Application.EventsPending ()) {
+					Application.RunIteration (false);
+				}
+
+				PhotoScanner = null;
+			}
+		}
+
+		private bool IsCamera {
+			get {
+				try {
+					var file = GLib.FileFactory.NewForUri (Root.Append ("DCIM"));
+					return file.Exists;
+				} catch {
+					return false;
+				}
+			}
+		}
+
+		private bool IsIPodPhoto {
+			get {
+				try {
+					var file = GLib.FileFactory.NewForUri (Root.Append ("Photos"));
+					var file2 = GLib.FileFactory.NewForUri (Root.Append ("iPod_Control"));
+					return file.Exists && file2.Exists;
+				} catch {
+					return false;
+				}
+			}
+		}
+	}
+
+	// Multi root version for drag and drop import.
+	internal class MultiFileImportSource : FileImportSource
+	{
+		private IEnumerable<SafeUri> uris;
+
+		public MultiFileImportSource (IEnumerable<SafeUri> uris)
+			: base (null, String.Empty, String.Empty)
+		{
+			this.uris = uris;
+		}
+
+		protected override void ScanPhotos (ImportController controller, PhotoList photo_list)
+		{
+			foreach (var uri in uris) {
+				Log.Debug ("Scanning " + uri);
+				ScanPhotoDirectory (controller, uri, photo_list);
+			}
+			ThreadAssist.ProxyToMain (() => controller.PhotoScanFinished ());
+		}
+	}
+
+	internal class FileImportInfo : FilePhoto
+	{
+		public FileImportInfo (SafeUri original) : base (original)
+		{
+		}
+
+		public SafeUri DestinationUri { get; set; }
+
+		internal uint PhotoId { get; set; }
+	}
 }
diff --git a/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs b/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
index ce6ecc7..b170f91 100644
--- a/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
+++ b/src/Clients/MainApp/FSpot.Import/MetadataImporter.cs
@@ -42,31 +42,23 @@ namespace FSpot.Import {
 
         private class TagInfo {
             // This class contains the Root tag name, and its Icon name (if any)
-            string tag_name;
-            string icon_name;
-
-            public string TagName {
-                get { return tag_name; }
-            }
-
-            public string IconName {
-                get { return icon_name; }
-            }
+            public string TagName { get; private set; }
+            public string IconName { get; private set; }
 
             public bool HasIcon {
-                get { return icon_name != null; }
+                get { return IconName != null; }
             }
 
             public TagInfo (string t_name, string i_name)
             {
-                tag_name = t_name;
-                icon_name = i_name;
+                TagName = t_name;
+                IconName = i_name;
             }
 
             public TagInfo (string t_name)
             {
-                tag_name = t_name;
-                icon_name = null;
+                TagName = t_name;
+                IconName = null;
             }
         } // TagInfo
 
diff --git a/src/Clients/MainApp/FSpot.Loaders/AreaPreparedEventArgs.cs b/src/Clients/MainApp/FSpot.Loaders/AreaPreparedEventArgs.cs
index 10240df..31d4a1b 100644
--- a/src/Clients/MainApp/FSpot.Loaders/AreaPreparedEventArgs.cs
+++ b/src/Clients/MainApp/FSpot.Loaders/AreaPreparedEventArgs.cs
@@ -33,15 +33,11 @@ using Gdk;
 namespace FSpot.Loaders {
 	public class AreaPreparedEventArgs : EventArgs
 	{
-		bool reduced_resolution;
-
-		public bool ReducedResolution {
-			get { return reduced_resolution; }
-		}
+		public bool ReducedResolution { get; private set; }
 
 		public AreaPreparedEventArgs (bool reduced_resolution) : base ()
 		{
-			this.reduced_resolution = reduced_resolution;
+			ReducedResolution = reduced_resolution;
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot.Loaders/AreaUpdatedEventArgs.cs b/src/Clients/MainApp/FSpot.Loaders/AreaUpdatedEventArgs.cs
index 0559836..cb48789 100644
--- a/src/Clients/MainApp/FSpot.Loaders/AreaUpdatedEventArgs.cs
+++ b/src/Clients/MainApp/FSpot.Loaders/AreaUpdatedEventArgs.cs
@@ -33,14 +33,11 @@ using Gdk;
 namespace FSpot.Loaders {
 	public class AreaUpdatedEventArgs : EventArgs
 	{
-		Gdk.Rectangle area;
-		public Gdk.Rectangle Area {
-			get { return area; }
-		}
+		public Gdk.Rectangle Area { get; private set; }
 
 		public AreaUpdatedEventArgs (Gdk.Rectangle area) : base ()
 		{
-			this.area = area;
+			Area = area;
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs b/src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs
index 9c9c07a..ab5300b 100644
--- a/src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs
+++ b/src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs
@@ -28,7 +28,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using System;
 using System.Threading;
 using Gdk;
@@ -38,7 +37,8 @@ using FSpot.Imaging;
 using Hyena;
 using TagLib.Image;
 
-namespace FSpot.Loaders {
+namespace FSpot.Loaders
+{
 	public class GdkImageLoader : Gdk.PixbufLoader, IImageLoader
 	{
 #region public api
@@ -46,11 +46,12 @@ namespace FSpot.Loaders {
 		{
 		}
 
-        ~GdkImageLoader ()
-        {
-            if (!is_disposed)
-                Dispose ();
-        }
+		~GdkImageLoader ()
+		{
+			if (!is_disposed) {
+				Dispose ();
+			}
+		}
 
 		public void Load (SafeUri uri)
 		{
@@ -61,11 +62,13 @@ namespace FSpot.Loaders {
 			if ((thumb = XdgThumbnailSpec.LoadThumbnail (uri, ThumbnailSize.Large, null)) != null) {
 				pixbuf_orientation = ImageOrientation.TopLeft;
 				EventHandler<AreaPreparedEventArgs> prep = AreaPrepared;
-				if (prep != null)
+				if (prep != null) {
 					prep (this, new AreaPreparedEventArgs (true));
+				}
 				EventHandler<AreaUpdatedEventArgs> upd = AreaUpdated;
-				if (upd != null)
+				if (upd != null) {
 					upd (this, new AreaUpdatedEventArgs (new Rectangle (0, 0, thumb.Width, thumb.Height)));
+				}
 			}
 
 			using (var image_file = ImageFile.Create (uri)) {
@@ -77,7 +80,8 @@ namespace FSpot.Loaders {
 			// The ThreadPool.QueueUserWorkItem hack is there cause, as the bytes to read are present in the stream,
 			// the Read is CompletedAsynchronously, blocking the mainloop
 			image_stream.BeginRead (buffer, 0, count, delegate (IAsyncResult r) {
-				ThreadPool.QueueUserWorkItem (delegate {HandleReadDone (r);});
+				ThreadPool.QueueUserWorkItem (delegate {
+					HandleReadDone (r);});
 			}, null);
 		}
 
@@ -85,42 +89,47 @@ namespace FSpot.Loaders {
 		new public event EventHandler<AreaUpdatedEventArgs> AreaUpdated;
 		public event EventHandler Completed;
 
-
 		Pixbuf thumb;
+
 		new public Pixbuf Pixbuf {
 			get {
-				if (thumb != null)
+				if (thumb != null) {
 					return thumb;
+				}
 				return base.Pixbuf;
 			}
 		}
 
 		bool loading = false;
+
 		public bool Loading {
 			get { return loading; }
 		}
 
 		bool notify_prepared = false;
 		bool prepared = false;
+
 		public bool Prepared {
 			get { return prepared; }
 		}
 
 		ImageOrientation pixbuf_orientation = ImageOrientation.TopLeft;
+
 		public ImageOrientation PixbufOrientation {
 			get { return pixbuf_orientation; }
 		}
 
 		bool is_disposed = false;
+
 		public override void Dispose ()
 		{
 			is_disposed = true;
-			if (image_stream != null)
+			if (image_stream != null) {
 				try {
 					image_stream.Close ();
-				} catch (GLib.GException)
-				{
+				} catch (GLib.GException) {
 				}
+			}
 			Close ();
 			if (thumb != null) {
 				thumb.Dispose ();
@@ -164,8 +173,9 @@ namespace FSpot.Loaders {
 				return;
 
 			EventHandler eh = Completed;
-			if (eh != null)
+			if (eh != null) {
 				eh (this, EventArgs.Empty);
+			}
 			Close ();
 		}
 #endregion
@@ -173,7 +183,7 @@ namespace FSpot.Loaders {
 #region private stuffs
 		System.IO.Stream image_stream;
 		const int count = 1 << 16;
-		byte [] buffer = new byte [count];
+		byte[] buffer = new byte [count];
 		bool notify_completed = false;
 		Rectangle damage;
 		object sync_handle = new object ();
@@ -192,8 +202,9 @@ namespace FSpot.Loaders {
 					notify_completed = true;
 				} else {
 					try {
-						if (!is_disposed && Write (buffer, (ulong)byte_read))
+						if (!is_disposed && Write (buffer, (ulong)byte_read)) {
 							image_stream.BeginRead (buffer, 0, count, HandleReadDone, null);
+						}
 					} catch (System.ObjectDisposedException) {
 					} catch (GLib.GException) {
 					}
@@ -210,15 +221,17 @@ namespace FSpot.Loaders {
 					}
 
 					EventHandler<AreaPreparedEventArgs> eh = AreaPrepared;
-					if (eh != null)
+					if (eh != null) {
 						eh (this, new AreaPreparedEventArgs (false));
+					}
 				}
 
 				//Send the AreaUpdated events
 				if (damage != Rectangle.Zero) {
 					EventHandler<AreaUpdatedEventArgs> eh = AreaUpdated;
-					if (eh != null)
+					if (eh != null) {
 						eh (this, new AreaUpdatedEventArgs (damage));
+					}
 					damage = Rectangle.Zero;
 				}
 
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/AboutDialog.cs b/src/Clients/MainApp/FSpot.UI.Dialog/AboutDialog.cs
index 131c259..da370cf 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/AboutDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/AboutDialog.cs
@@ -48,6 +48,7 @@ namespace FSpot.UI.Dialog
                     "\tLawrence Ewing",
                     "\tStephane Delcroix",
                     "\tRuben Vermeersch",
+		    "\tStephen  Shaw",
                     "",
                     "Active Contributors to this release",
                     "\tAdemir Mendoza",
diff --git a/src/Clients/MainApp/FSpot.Widgets/SlideShow.cs b/src/Clients/MainApp/FSpot.Widgets/SlideShow.cs
index 01ff240..bd20866 100644
--- a/src/Clients/MainApp/FSpot.Widgets/SlideShow.cs
+++ b/src/Clients/MainApp/FSpot.Widgets/SlideShow.cs
@@ -77,7 +77,7 @@ namespace FSpot.Widgets
 
 		SlideShowTransition transition;
 		public SlideShowTransition Transition {
-			get { return transition; }
+            get { return transition; }
 			set {
 				if (value == transition)
 					return;
@@ -203,4 +203,4 @@ namespace FSpot.Widgets
 		}
 #endregion
 	}
-}
+}
\ No newline at end of file
diff --git a/src/Clients/MainApp/FSpot/Accelerometer.cs b/src/Clients/MainApp/FSpot/Accelerometer.cs
index 536d754..77ac544 100644
--- a/src/Clients/MainApp/FSpot/Accelerometer.cs
+++ b/src/Clients/MainApp/FSpot/Accelerometer.cs
@@ -53,13 +53,7 @@ namespace FSpot {
 			TiltCounterclockwise,
 		}
 
-		private static Orient current_orientation;
-
-		public static Orient CurrentOrientation {
-			get {
-				return current_orientation;
-			}
-		}
+		public static Orient CurrentOrientation { get; set; }
 
 		public Accelerometer ()
 		{
@@ -70,10 +64,10 @@ namespace FSpot {
 			if (timer == 0 && available)
 				SetupAccelerometer ();
 
-			if (current_orientation == Orient.TiltCounterclockwise)
+			if (CurrentOrientation == Orient.TiltCounterclockwise)
 				return FSpot.Utils.PixbufUtils.Rotate90 (po);
 
-			if (current_orientation == Orient.TiltClockwise)
+			if (CurrentOrientation == Orient.TiltClockwise)
 				return FSpot.Utils.PixbufUtils.Rotate270 (po);
 
 			return po;
@@ -103,8 +97,8 @@ namespace FSpot {
 		{
 			Orient new_orient = GetScreenOrientation ();
 
-			if (new_orient != current_orientation) {
-				current_orientation = new_orient;
+			if (new_orient != CurrentOrientation) {
+				CurrentOrientation = new_orient;
 
 				EventHandler eh = OrientationChanged;
 				if (eh != null)
diff --git a/src/Clients/MainApp/FSpot/ExportStore.cs b/src/Clients/MainApp/FSpot/ExportStore.cs
index 6b3bc89..2387e29 100644
--- a/src/Clients/MainApp/FSpot/ExportStore.cs
+++ b/src/Clients/MainApp/FSpot/ExportStore.cs
@@ -44,36 +44,17 @@ using Hyena.Data.Sqlite;
 namespace FSpot {
 public class ExportItem : DbItem {
 
-    private uint image_id;
-    public uint ImageId {
-        get { return image_id; }
-        set { image_id = value; }
-    }
-
-    private uint image_version_id;
-    public uint ImageVersionId {
-        get { return image_version_id; }
-        set { image_version_id = value; }
-    }
-
-    private string export_type;
-    public string ExportType {
-        get { return export_type; }
-        set { export_type = value; }
-    }
-
-    private string export_token;
-    public string ExportToken {
-        get { return export_token; }
-        set { export_token = value; }
-    }
+    public uint ImageId { get; set; }
+    public uint ImageVersionId { get; set; }
+    public string ExportType { get; set; }
+    public string ExportToken { get; set; }
 
     public ExportItem (uint id, uint image_id, uint image_version_id, string export_type, string export_token) : base (id)
     {
-        this.image_id = image_id;
-        this.image_version_id = image_version_id;
-        this.export_type = export_type;
-        this.export_token = export_token;
+        ImageId = image_id;
+        ImageVersionId = image_version_id;
+        ExportType = export_type;
+        ExportToken = export_token;
     }
 }
 
diff --git a/src/Clients/MainApp/FSpot/JobStore.cs b/src/Clients/MainApp/FSpot/JobStore.cs
index 0a7155a..ca50335 100644
--- a/src/Clients/MainApp/FSpot/JobStore.cs
+++ b/src/Clients/MainApp/FSpot/JobStore.cs
@@ -41,194 +41,176 @@ using Hyena;
 using Hyena.Data.Sqlite;
 
 namespace FSpot {
-public abstract class Job : DbItem, IJob
-{
-	public Job (uint id, string job_options, JobPriority job_priority, DateTime run_at, bool persistent) : base (id)
-	{
-		this.job_options = job_options;
-		this.job_priority = job_priority;
-		this.run_at = run_at;
-		this.persistent = persistent;
-	}
-
-	private string job_options;
-	public string JobOptions {
-		get { return job_options; }
-		set { job_options = value; }
-	}
-
-	private JobPriority job_priority;
-	internal JobPriority JobPriority {
-		get { return job_priority; }
-		set { job_priority = value; }
-	}
-
-	//Not in use yet !
-	private DateTime run_at;
-	public DateTime RunAt {
-		get { return run_at; }
-//		set { run_at = value; }
-	}
-
-	private bool persistent;
-	public bool Persistent {
-		get { return persistent; }
-	}
-
-	public event EventHandler Finished;
-
-	private JobStatus status;
-	public JobStatus Status
-	{
-		get { return status; }
-		set {
-			status = value;
-			switch (value) {
-			case JobStatus.Finished:
-			case JobStatus.Failed:
-				if (Finished != null)
-					Finished (this, new EventArgs ());
-				break;
-			default:
-				break;
-			}
-		}
-	}
-
-	public void Run ()
-	{
-		Status = JobStatus.Running;
-		if (Execute ())
-			Status = JobStatus.Finished;
-		else
-			Status = JobStatus.Failed;
-	}
-
-	protected abstract bool Execute ();
-}
-
-public class JobStore : DbStore<Job> {
-
-	internal static void CreateTable (FSpotDatabaseConnection database)
-	{
-		if (database.TableExists ("jobs")) {
-			return;
-		}
-
-		database.Execute (
-			"CREATE TABLE jobs (\n" +
-			"	id		INTEGER PRIMARY KEY NOT NULL, \n" +
-			"	job_type	TEXT NOT NULL, \n" +
-			"	job_options	TEXT NOT NULL, \n" +
-			"	run_at		INTEGER, \n" +
-			"	job_priority	INTEGER NOT NULL\n" +
-			")");
-	}
-
-	private Job LoadItem (IDataReader reader)
-	{
-		return (Job) Activator.CreateInstance (
-				Type.GetType (reader ["job_type"].ToString ()),
-				Convert.ToUInt32 (reader["id"]),
-				reader["job_options"].ToString (),
-				Convert.ToInt32 (reader["run_at"]),
-				(JobPriority) Convert.ToInt32 (reader["job_priority"]),
-				true);
-	}
-
-	private void LoadAllItems ()
-	{
-		IDataReader reader = Database.Query ("SELECT id, job_type, job_options, run_at, job_priority FROM jobs");
-
-		Scheduler.Suspend ();
-		while (reader.Read ()) {
-			Job job = LoadItem (reader);
-			AddToCache (job);
-			job.Finished += HandleRemoveJob;
-			Scheduler.Schedule (job, job.JobPriority);
-			job.Status = JobStatus.Scheduled;
-		}
-
-		reader.Dispose ();
-	}
-
-	public Job Create (Type job_type, string job_options)
-	{
-		return Create (job_type, job_options, DateTime.Now, JobPriority.Lowest, false);
-	}
-
-	public Job CreatePersistent (Type job_type, string job_options)
-	{
-		return Create (job_type, job_options, DateTime.Now, JobPriority.Lowest, true);
-	}
-
-	internal Job Create (Type job_type, string job_options, DateTime run_at, JobPriority job_priority, bool persistent)
-	{
-		int id = 0;
-		if (persistent)
-			id = Database.Execute (new HyenaSqliteCommand ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) VALUES (?, ?, ?, ?)",
-						job_type.ToString (),
-						job_options,
-						DateTimeUtil.FromDateTime (run_at),
-						Convert.ToInt32 (job_priority)));
-
-                Job job = (Job) Activator.CreateInstance (job_type, (uint)id, job_options, run_at, job_priority, true);
-
-		AddToCache (job);
-		job.Finished += HandleRemoveJob;
-		Scheduler.Schedule (job, job.JobPriority);
-		job.Status = JobStatus.Scheduled;
-		EmitAdded (job);
-
-		return job;
-	}
-
-	public override void Commit (Job item)
-	{
-		if (item.Persistent)
-			Database.Execute(new HyenaSqliteCommand("UPDATE jobs " 					+
-									"SET job_type = ? "		+
-									"SET job_options = ? "	+
-									"SET run_at = ? "			+
-									"SET job_priority = ? "	+
-									"WHERE id = ?",
-									"Empty", //FIXME
-									item.JobOptions,
-									DateTimeUtil.FromDateTime (item.RunAt),
-									item.JobPriority,
-									item.Id));
-
-		EmitChanged (item);
-	}
-
-	public override Job Get (uint id)
-	{
-            // we never use this
-            return null;
-	}
-
-	public override void Remove (Job item)
-	{
-		RemoveFromCache (item);
-
-		if ((item as Job).Persistent)
-			Database.Execute (new HyenaSqliteCommand ("DELETE FROM jobs WHERE id = ?", item.Id));
-
-		EmitRemoved (item);
-	}
-
-	public void HandleRemoveJob (Object o, EventArgs e)
-	{
-		Remove (o as Job);
-	}
-
-	public JobStore (FSpotDatabaseConnection database, bool is_new) : base (database, true)
-	{
-		if (is_new || !Database.TableExists ("jobs")) {
-			CreateTable (database);
-		} else {
-			LoadAllItems ();
-                }
-	}
-}
+    public abstract class Job : DbItem, IJob
+    {
+    	public Job (uint id, string job_options, JobPriority job_priority, DateTime run_at, bool persistent) : base (id)
+    	{
+    		JobOptions = job_options;
+    		JobPriority = job_priority;
+    		RunAt = run_at;
+    		Persistent = persistent;
+    	}
+    
+    	public string JobOptions { get; set; }
+    	internal JobPriority JobPriority { get; set; }
+    	//Not in use yet !
+    	public DateTime RunAt { get; private set; }
+    	public bool Persistent { get; private set; }
+    
+    	public event EventHandler Finished;
+    
+    	private JobStatus status;
+    	public JobStatus Status
+    	{
+    		get { return status; }
+    		set {
+    			status = value;
+    			switch (value) {
+    			case JobStatus.Finished:
+    			case JobStatus.Failed:
+    				if (Finished != null)
+    					Finished (this, new EventArgs ());
+    				break;
+    			default:
+    				break;
+    			}
+    		}
+    	}
+    
+    	public void Run ()
+    	{
+    		Status = JobStatus.Running;
+    		if (Execute ())
+    			Status = JobStatus.Finished;
+    		else
+    			Status = JobStatus.Failed;
+    	}
+    
+    	protected abstract bool Execute ();
+    }
+
+    public class JobStore : DbStore<Job> {
+    
+    	internal static void CreateTable (FSpotDatabaseConnection database)
+    	{
+    		if (database.TableExists ("jobs")) {
+    			return;
+    		}
+    
+    		database.Execute (
+    			"CREATE TABLE jobs (\n" +
+    			"	id		INTEGER PRIMARY KEY NOT NULL, \n" +
+    			"	job_type	TEXT NOT NULL, \n" +
+    			"	job_options	TEXT NOT NULL, \n" +
+    			"	run_at		INTEGER, \n" +
+    			"	job_priority	INTEGER NOT NULL\n" +
+    			")");
+    	}
+    
+    	private Job LoadItem (IDataReader reader)
+    	{
+    		return (Job) Activator.CreateInstance (
+    				Type.GetType (reader ["job_type"].ToString ()),
+    				Convert.ToUInt32 (reader["id"]),
+    				reader["job_options"].ToString (),
+    				Convert.ToInt32 (reader["run_at"]),
+    				(JobPriority) Convert.ToInt32 (reader["job_priority"]),
+    				true);
+    	}
+    
+    	private void LoadAllItems ()
+    	{
+    		IDataReader reader = Database.Query ("SELECT id, job_type, job_options, run_at, job_priority FROM jobs");
+    
+    		Scheduler.Suspend ();
+    		while (reader.Read ()) {
+    			Job job = LoadItem (reader);
+    			AddToCache (job);
+    			job.Finished += HandleRemoveJob;
+    			Scheduler.Schedule (job, job.JobPriority);
+    			job.Status = JobStatus.Scheduled;
+    		}
+    
+    		reader.Dispose ();
+    	}
+    
+    	public Job Create (Type job_type, string job_options)
+    	{
+    		return Create (job_type, job_options, DateTime.Now, JobPriority.Lowest, false);
+    	}
+    
+    	public Job CreatePersistent (Type job_type, string job_options)
+    	{
+    		return Create (job_type, job_options, DateTime.Now, JobPriority.Lowest, true);
+    	}
+    
+    	internal Job Create (Type job_type, string job_options, DateTime run_at, JobPriority job_priority, bool persistent)
+    	{
+    		int id = 0;
+    		if (persistent)
+    			id = Database.Execute (new HyenaSqliteCommand ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) VALUES (?, ?, ?, ?)",
+    						job_type.ToString (),
+    						job_options,
+    						DateTimeUtil.FromDateTime (run_at),
+    						Convert.ToInt32 (job_priority)));
+    
+                    Job job = (Job) Activator.CreateInstance (job_type, (uint)id, job_options, run_at, job_priority, true);
+    
+    		AddToCache (job);
+    		job.Finished += HandleRemoveJob;
+    		Scheduler.Schedule (job, job.JobPriority);
+    		job.Status = JobStatus.Scheduled;
+    		EmitAdded (job);
+    
+    		return job;
+    	}
+    
+    	public override void Commit (Job item)
+    	{
+    		if (item.Persistent)
+    			Database.Execute(new HyenaSqliteCommand("UPDATE jobs " 					+
+    									"SET job_type = ? "		+
+    									"SET job_options = ? "	+
+    									"SET run_at = ? "			+
+    									"SET job_priority = ? "	+
+    									"WHERE id = ?",
+    									"Empty", //FIXME
+    									item.JobOptions,
+    									DateTimeUtil.FromDateTime (item.RunAt),
+    									item.JobPriority,
+    									item.Id));
+    
+    		EmitChanged (item);
+    	}
+    
+    	public override Job Get (uint id)
+    	{
+                // we never use this
+                return null;
+    	}
+    
+    	public override void Remove (Job item)
+    	{
+    		RemoveFromCache (item);
+    
+    		if ((item as Job).Persistent)
+    			Database.Execute (new HyenaSqliteCommand ("DELETE FROM jobs WHERE id = ?", item.Id));
+    
+    		EmitRemoved (item);
+    	}
+    
+    	public void HandleRemoveJob (Object o, EventArgs e)
+    	{
+    		Remove (o as Job);
+    	}
+    
+    	public JobStore (FSpotDatabaseConnection database, bool is_new) : base (database, true)
+    	{
+    		if (is_new || !Database.TableExists ("jobs")) {
+    			CreateTable (database);
+    		} else {
+    			LoadAllItems ();
+            }
+    	}
+    }
 }
diff --git a/src/Clients/MainApp/FSpot/MetaStore.cs b/src/Clients/MainApp/FSpot/MetaStore.cs
index 37489ca..643bcb9 100644
--- a/src/Clients/MainApp/FSpot/MetaStore.cs
+++ b/src/Clients/MainApp/FSpot/MetaStore.cs
@@ -40,156 +40,148 @@ using FSpot.Database;
 using Hyena.Data.Sqlite;
 
 namespace FSpot {
-public class MetaItem : DbItem {
-	private string name;
-	public string Name {
-		get { return name; }
-		set { name = value; }
-	}
-
-	private string data;
-	public string Value {
-		get { return data; }
-		set { data = value; }
-	}
-
-	public int ValueAsInt {
-		get { return System.Int32.Parse (Value); }
-		set { Value = value.ToString (); }
-	}
-
-	public MetaItem (uint id, string name, string data) : base (id)
-	{
-		this.name = name;
-		this.data = data;
-	}
-}
-
-public class MetaStore : DbStore<MetaItem> {
-	private const string version = "F-Spot Version";
-	private const string db_version = "F-Spot Database Version";
-	private const string hidden = "Hidden Tag Id";
-
-	public MetaItem FSpotVersion {
-		get { return GetByName (version); }
-	}
-
-	public MetaItem DatabaseVersion {
-		get { return GetByName (db_version); }
-	}
-
-	public MetaItem HiddenTagId {
-		get { return GetByName (hidden); }
-	}
-
-	private MetaItem GetByName (string name)
-	{
-		foreach (MetaItem i in this.item_cache.Values)
-			if (i.Name == name)
-				return i;
-
-		// Otherwise make it and return it
-		return Create (name, null);
-	}
-
-	private void CreateTable ()
-	{
-		Database.Execute (
-			"CREATE TABLE meta (\n" +
-			"	id	INTEGER PRIMARY KEY NOT NULL, \n" +
-			"	name	TEXT UNIQUE NOT NULL, \n" +
-			"	data	TEXT\n" +
-			")");
-	}
-
-	private void CreateDefaultItems (bool is_new)
-	{
-		Create (version, Defines.VERSION);
-		Create (db_version, (is_new) ? FSpot.Database.Updater.LatestVersion.ToString () : "0");
-
-		// Get the hidden tag id, if it exists
-		try {
-			string id = Database.Query<string> ("SELECT id FROM tags WHERE name = 'Hidden'");
-			Create (hidden, id);
-		} catch (Exception) {}
-	}
-
-	private void LoadAllItems ()
-	{
-		IDataReader reader = Database.Query("SELECT id, name, data FROM meta");
-
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["id"]);
-
-			string name = reader ["name"].ToString ();
-
-			string data = null;
-			if (reader ["data"] != null)
-				data = reader ["data"].ToString ();
-
-			MetaItem item = new MetaItem (id, name, data);
-
-			AddToCache (item);
-		}
-
-		reader.Dispose ();
-
-		if (FSpotVersion.Value != Defines.VERSION) {
-			FSpotVersion.Value = Defines.VERSION;
-			Commit (FSpotVersion);
-		}
-	}
-
-	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 ));
-
-		//FIXME This smells bad. This line used to be *before* the
-		//Command.executeNonQuery. It smells of a bug, but there might
-		//have been a reason for this
-
-		MetaItem item = new MetaItem (id, name, data);
-
-
-		AddToCache (item);
-		EmitAdded (item);
-
-		return item;
-	}
-
-	public override void Commit (MetaItem item)
-	{
-		Database.Execute(new HyenaSqliteCommand("UPDATE meta SET data = ? WHERE name = ?", item.Value, item.Name));
-
-		EmitChanged (item);
-	}
-
-	public override MetaItem Get (uint id)
-	{
-		return LookupInCache (id);
-	}
-
-	public override void Remove (MetaItem item)
-	{
-		RemoveFromCache (item);
-
-		Database.Execute (new HyenaSqliteCommand ("DELETE FROM meta WHERE id = ?", item.Id));
-
-		EmitRemoved (item);
-	}
-
-	// Constructor
-
-	public MetaStore (FSpotDatabaseConnection database, bool is_new)
-		: base (database, true)
-	{
-		if (is_new || !Database.TableExists ("meta")) {
-			CreateTable ();
-			CreateDefaultItems (is_new);
-		} else
-			LoadAllItems ();
-	}
-}
+    public class MetaItem : DbItem {
+    
+    	public string Name { get; set; }
+    	public string Value { get; set; }
+
+    	public int ValueAsInt {
+    		get { return System.Int32.Parse (Value); }
+    		set { Value = value.ToString (); }
+    	}
+    
+    	public MetaItem (uint id, string name, string data) : base (id)
+    	{
+    		Name = name;
+    		Value = data;
+    	}
+    }
+
+    public class MetaStore : DbStore<MetaItem> {
+    	private const string version = "F-Spot Version";
+    	private const string db_version = "F-Spot Database Version";
+    	private const string hidden = "Hidden Tag Id";
+    
+    	public MetaItem FSpotVersion {
+    		get { return GetByName (version); }
+    	}
+    
+    	public MetaItem DatabaseVersion {
+    		get { return GetByName (db_version); }
+    	}
+    
+    	public MetaItem HiddenTagId {
+    		get { return GetByName (hidden); }
+    	}
+    
+    	private MetaItem GetByName (string name)
+    	{
+    		foreach (MetaItem i in this.item_cache.Values)
+    			if (i.Name == name)
+    				return i;
+    
+    		// Otherwise make it and return it
+    		return Create (name, null);
+    	}
+    
+    	private void CreateTable ()
+    	{
+    		Database.Execute (
+    			"CREATE TABLE meta (\n" +
+    			"	id	INTEGER PRIMARY KEY NOT NULL, \n" +
+    			"	name	TEXT UNIQUE NOT NULL, \n" +
+    			"	data	TEXT\n" +
+    			")");
+    	}
+    
+    	private void CreateDefaultItems (bool is_new)
+    	{
+    		Create (version, Defines.VERSION);
+    		Create (db_version, (is_new) ? FSpot.Database.Updater.LatestVersion.ToString () : "0");
+    
+    		// Get the hidden tag id, if it exists
+    		try {
+    			string id = Database.Query<string> ("SELECT id FROM tags WHERE name = 'Hidden'");
+    			Create (hidden, id);
+    		} catch (Exception) {}
+    	}
+    
+    	private void LoadAllItems ()
+    	{
+    		IDataReader reader = Database.Query("SELECT id, name, data FROM meta");
+    
+    		while (reader.Read ()) {
+    			uint id = Convert.ToUInt32 (reader ["id"]);
+    
+    			string name = reader ["name"].ToString ();
+    
+    			string data = null;
+    			if (reader ["data"] != null)
+    				data = reader ["data"].ToString ();
+    
+    			MetaItem item = new MetaItem (id, name, data);
+    
+    			AddToCache (item);
+    		}
+    
+    		reader.Dispose ();
+    
+    		if (FSpotVersion.Value != Defines.VERSION) {
+    			FSpotVersion.Value = Defines.VERSION;
+    			Commit (FSpotVersion);
+    		}
+    	}
+    
+    	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 ));
+    
+    		//FIXME This smells bad. This line used to be *before* the
+    		//Command.executeNonQuery. It smells of a bug, but there might
+    		//have been a reason for this
+    
+    		MetaItem item = new MetaItem (id, name, data);
+    
+    
+    		AddToCache (item);
+    		EmitAdded (item);
+    
+    		return item;
+    	}
+    
+    	public override void Commit (MetaItem item)
+    	{
+    		Database.Execute(new HyenaSqliteCommand("UPDATE meta SET data = ? WHERE name = ?", item.Value, item.Name));
+    
+    		EmitChanged (item);
+    	}
+    
+    	public override MetaItem Get (uint id)
+    	{
+    		return LookupInCache (id);
+    	}
+    
+    	public override void Remove (MetaItem item)
+    	{
+    		RemoveFromCache (item);
+    
+    		Database.Execute (new HyenaSqliteCommand ("DELETE FROM meta WHERE id = ?", item.Id));
+    
+    		EmitRemoved (item);
+    	}
+    
+    	// Constructor
+    
+    	public MetaStore (FSpotDatabaseConnection database, bool is_new)
+    		: base (database, true)
+    	{
+    		if (is_new || !Database.TableExists ("meta")) {
+    			CreateTable ();
+    			CreateDefaultItems (is_new);
+    		} else
+    			LoadAllItems ();
+    	}
+    }
 }
diff --git a/src/Clients/MainApp/FSpot/PhotoEventArgs.cs b/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
index 51c68e7..464b6b5 100644
--- a/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
+++ b/src/Clients/MainApp/FSpot/PhotoEventArgs.cs
@@ -34,10 +34,7 @@ using FSpot.Core;
 namespace FSpot
 {
 	public class PhotoEventArgs : DbItemEventArgs<Photo> {
-		PhotosChanges changes;
-		public PhotosChanges Changes {
-			get { return changes; }
-		}
+		public PhotosChanges Changes { get; private set; }
 
 		public PhotoEventArgs (Photo photo, PhotosChanges changes) : this (new Photo[] {photo}, changes)
 		{
@@ -45,7 +42,7 @@ namespace FSpot
 
 		public PhotoEventArgs (Photo[] photos, PhotosChanges changes) : base (photos)
 		{
-			this.changes = changes;
+			Changes = changes;
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot/PhotoStore.cs b/src/Clients/MainApp/FSpot/PhotoStore.cs
index 36d647a..66c8161 100644
--- a/src/Clients/MainApp/FSpot/PhotoStore.cs
+++ b/src/Clients/MainApp/FSpot/PhotoStore.cs
@@ -56,895 +56,894 @@ using Hyena;
 using Hyena.Data.Sqlite;
 
 namespace FSpot {
-public class PhotoStore : DbStore<Photo> {
-	public int TotalPhotos {
-		get {
-			IDataReader reader = Database.Query("SELECT COUNT(*) AS photo_count FROM photos");
-			reader.Read ();
-			int total = Convert.ToInt32 (reader ["photo_count"]);
-			reader.Dispose ();
-			return total;
-		}
-	}
-
-	// FIXME this is a hack.  Since we don't have Gnome.ThumbnailFactory.SaveThumbnail() in
-	// GTK#, and generate them by ourselves directly with Gdk.Pixbuf, we have to make sure here
-	// that the "large" thumbnail directory exists.
-	private static void EnsureThumbnailDirectory ()
-	{
-		string large_thumbnail_file_name_template = Gnome.Thumbnail.PathForUri ("file:///boo", Gnome.ThumbnailSize.Large);
-		string large_thumbnail_directory_path = System.IO.Path.GetDirectoryName (large_thumbnail_file_name_template);
-
-		if (! System.IO.File.Exists (large_thumbnail_directory_path))
-			System.IO.Directory.CreateDirectory (large_thumbnail_directory_path);
-	}
-
-	// Constructor
-
-	public PhotoStore (FSpotDatabaseConnection database, bool is_new)
-		: base (database, false)
-	{
-		EnsureThumbnailDirectory ();
-
-		if (! is_new)
-			return;
-
-		Database.Execute (
-			"CREATE TABLE photos (\n" +
-			"	id			INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \n" +
-			"	time			INTEGER NOT NULL, \n" +
-			"	base_uri		STRING NOT NULL, \n" +
-		    "	filename		STRING NOT NULL, \n" +
-			"	description		TEXT NOT NULL, \n" +
-			"	roll_id			INTEGER NOT NULL, \n" +
-			"	default_version_id	INTEGER NOT NULL, \n" +
-			"	rating			INTEGER NULL \n" +
-			")");
-
-		Database.Execute (
-			"CREATE TABLE photo_tags (\n" +
-			"	photo_id	INTEGER, \n" +
-			"       tag_id		INTEGER, \n" +
-			"       UNIQUE (photo_id, tag_id)\n" +
-			")");
-
-		Database.Execute (
-			"CREATE TABLE photo_versions (\n"+
-			"	photo_id	INTEGER, \n" +
-			"	version_id	INTEGER, \n" +
-			"	name		STRING, \n" +
-			"	base_uri		STRING NOT NULL, \n" +
-		    "	filename		STRING NOT NULL, \n" +
-			"	import_md5		TEXT NULL, \n" +
-			"	protected	BOOLEAN, \n" +
-			"	UNIQUE (photo_id, version_id)\n" +
-			")");
-
-		Database.Execute ("CREATE INDEX idx_photo_versions_id ON photo_versions(photo_id)");
-		Database.Execute ("CREATE INDEX idx_photo_versions_import_md5 ON photo_versions(import_md5)");
-		Database.Execute ("CREATE INDEX idx_photos_roll_id ON photos(roll_id)");
-	}
-
-	public bool HasDuplicate (IPhoto item) {
-		var uri = item.DefaultVersion.Uri;
-
-		// Check if the exact given uri already exists.
-		var query = "SELECT COUNT(*) AS count FROM photo_versions WHERE base_uri = ? AND filename = ?";
-		var reader = Database.Query (new HyenaSqliteCommand (query, uri.GetBaseUri ().ToString (), uri.GetFilename ()));
-		reader.Read ();
-		int count = Convert.ToInt32 (reader ["count"]);
-		reader.Dispose();
-		if (count > 0)
-			return true;
-
-		// Check by MD5. Won't import if there are photos with the same ImportMD5.
-		string hash = item.DefaultVersion.ImportMD5;
-		var condition = new ConditionWrapper (String.Format ("import_md5 = \"{0}\"", hash));
-		var dupes_by_hash = Count ("photo_versions", condition);
-		if (dupes_by_hash > 0)
-			return true;
-
-		// This is a very lame check to overcome the lack of duplicate detect data right after transition.
-		//
-		// Does filename matching if there are files with no hash for the original version.
-		condition = new ConditionWrapper ("version_id = 1 AND (import_md5 = \"\" OR import_md5 IS NULL)");
-		var have_no_hashes = Count ("photo_versions", condition);
-		if (have_no_hashes > 0) {
-			var name = uri.GetFilename ();
-			DateTime? time = null;
-
-			// Look for a filename match.
-			reader = Database.Query (new HyenaSqliteCommand ("SELECT photos.id, photos.time, pv.filename FROM photos LEFT JOIN photo_versions AS pv ON pv.photo_id = photos.id WHERE pv.filename = ?", name));
-			while (reader.Read ()) {
-				Log.DebugFormat ("Found one possible duplicate for {0}", reader["filename"].ToString ());
-				if (!time.HasValue) {
-					// Only read time when needed
-					time = item.Time;
-				}
-
-				if (reader["time"].ToString () == DateTimeUtil.FromDateTime (time.Value).ToString ()) {
-					Log.Debug ("Skipping duplicate", uri);
-
-					// Schedule a hash calculation job on the existing file.
-					CalculateHashJob.Create (FSpot.App.Instance.Database.Jobs, Convert.ToUInt32 (reader["id"]));
-
-					return true;
-				}
-			}
-			reader.Dispose ();
-		}
-
-		// No matches
-		return false;
-	}
-
-	public Photo CreateFrom (IPhoto item, uint roll_id)
-	{
-		Photo photo;
-
-		long unix_time = DateTimeUtil.FromDateTime (item.Time);
-		string description = item.Description ?? String.Empty;
-
-		uint id = (uint) Database.Execute (
-			new HyenaSqliteCommand (
-				"INSERT INTO photos (time, base_uri, filename, description, roll_id, default_version_id, rating) "	+
-				"VALUES (?, ?, ?, ?, ?, ?, ?)",
-				unix_time,
-				item.DefaultVersion.BaseUri.ToString (),
-				item.DefaultVersion.Filename,
-				description,
-				roll_id,
-				Photo.OriginalVersionId,
-				"0"
-			)
-		);
-
-		photo = new Photo (id, unix_time);
-		photo.AddVersionUnsafely (Photo.OriginalVersionId, item.DefaultVersion.BaseUri, item.DefaultVersion.Filename, item.DefaultVersion.ImportMD5, Catalog.GetString ("Original"), true);
-		photo.AllVersionsLoaded = true;
-
-		InsertVersion (photo, photo.DefaultVersion as PhotoVersion);
-		EmitAdded (photo);
-		return photo;
-	}
-
-	private void InsertVersion (Photo photo, PhotoVersion version)
-	{
-		Database.Execute (new HyenaSqliteCommand (
-			"INSERT OR IGNORE INTO photo_versions (photo_id, version_id, name, base_uri, filename, protected, import_md5) " +
-			"VALUES (?, ?, ?, ?, ?, ?, ?)",
-			photo.Id,
-			version.VersionId,
-			version.Name,
-			version.BaseUri.ToString (),
-			version.Filename,
-			version.IsProtected,
-			(version.ImportMD5 != String.Empty ? version.ImportMD5 : null)));
-	}
-
-
-	private void GetVersions (Photo photo)
-	{
-		IDataReader reader = Database.Query(
-			new HyenaSqliteCommand("SELECT version_id, name, base_uri, filename, import_md5, protected " +
-				      "FROM photo_versions " +
-				      "WHERE photo_id = ?",
-				      photo.Id
-			)
-		);
-
-		while (reader.Read ()) {
-			uint version_id = Convert.ToUInt32 (reader ["version_id"]);
-			string name = reader["name"].ToString ();
-			var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
-			var filename = reader ["filename"].ToString ();
-			string import_md5 = reader["import_md5"] != null ? reader ["import_md5"].ToString () : null;
-			bool is_protected = Convert.ToBoolean (reader["protected"]);
-
-			photo.AddVersionUnsafely (version_id, base_uri, filename, import_md5, name, is_protected);
-		}
-		reader.Dispose();
-	}
-
-	private void GetTags (Photo photo)
-	{
-		IDataReader reader = Database.Query(new HyenaSqliteCommand("SELECT tag_id FROM photo_tags WHERE photo_id = ?", photo.Id));
-
-		while (reader.Read ()) {
-			uint tag_id = Convert.ToUInt32 (reader ["tag_id"]);
-			Tag tag = App.Instance.Database.Tags.Get (tag_id) as Tag;
-			photo.AddTagUnsafely (tag);
-		}
-		reader.Dispose();
-	}
-
-	private void GetAllVersions  (string ids) {
-		IDataReader reader = Database.Query ("SELECT photo_id, version_id, name, base_uri, filename, import_md5, protected FROM photo_versions WHERE photo_id IN " + ids);
-
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["photo_id"]);
-			Photo photo = LookupInCache (id);
-
-			if (photo == null) {
-				//Console.WriteLine ("Photo {0} not found", id);
-				continue;
-			}
-
-			if (photo.AllVersionsLoaded) {
-				//Console.WriteLine ("Photo {0} already Loaded", photo);
-				continue;
-			}
-
-			if (reader ["version_id"] != null) {
-				uint version_id = Convert.ToUInt32 (reader ["version_id"]);
-				string name = reader["name"].ToString ();
-				var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
-				var filename = reader ["filename"].ToString ();
-				string import_md5 = reader["import_md5"] != null ? reader ["import_md5"].ToString () : null;
-				bool is_protected = Convert.ToBoolean (reader["protected"]);
-
-				photo.AddVersionUnsafely (version_id, base_uri, filename, import_md5, name, is_protected);
-			}
-
-			/*
-			string directory_path = null;
-			if (reader [3] != null)
-				directory_path = reader [3].ToString ();
-			System.Console.WriteLine ("directory_path = {0}", directory_path);
-			*/
-		}
-		reader.Dispose();
-	}
-
-	private void GetAllTags (string ids) {
-		IDataReader reader = Database.Query ("SELECT photo_id, tag_id FROM photo_tags WHERE photo_id IN " + ids);
-
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["photo_id"]);
-			Photo photo = LookupInCache (id);
-
-			if (photo == null) {
-				//Console.WriteLine ("Photo {0} not found", id);
-				continue;
-			}
-
-			if (photo.AllVersionsLoaded) {
-				//Console.WriteLine ("Photo {0} already Loaded", photo.Id);
-				continue;
-			}
-
-			if (reader [1] != null) {
-				uint tag_id = Convert.ToUInt32 (reader ["tag_id"]);
-				Tag tag = App.Instance.Database.Tags.Get (tag_id) as Tag;
-				photo.AddTagUnsafely (tag);
-			}
-		}
-		reader.Dispose();
-	}
-
-	public override Photo Get (uint id)
-	{
-		Photo photo = LookupInCache (id);
-		if (photo != null)
-			return photo;
-
-		IDataReader reader = Database.Query(
-			new HyenaSqliteCommand("SELECT time, description, roll_id, default_version_id, rating " +
-				      "FROM photos " +
-				      "WHERE id = ?", id
-				     )
-		);
-
-		if (reader.Read ()) {
-			photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
-			photo.Description = reader["description"].ToString ();
-			photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
-			photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
-			photo.Rating = Convert.ToUInt32 (reader ["rating"]);
-			AddToCache (photo);
-		}
-		reader.Dispose();
-
-		if (photo == null)
-			return null;
-
-		GetTags (photo);
-		GetVersions (photo);
-
-		return photo;
-	}
-
-	public Photo GetByUri (SafeUri uri)
-	{
-		Photo photo = null;
-
-		var base_uri = uri.GetBaseUri ();
-		var filename = uri.GetFilename ();
-
-		IDataReader reader =
-			Database.Query (new HyenaSqliteCommand ("SELECT id, time, description, roll_id, default_version_id, rating " +
-			                               " FROM photos " +
-			                               " LEFT JOIN photo_versions AS pv ON photos.id = pv.photo_id" +
-			                               " WHERE (photos.base_uri = ? AND photos.filename = ?)" +
-			                               " OR (pv.base_uri = ? AND pv.filename = ?)",
-			                               base_uri.ToString (), filename,
-			                               base_uri.ToString (), filename));
-
-		if (reader.Read ()) {
-			photo = new Photo (Convert.ToUInt32 (reader ["id"]),
-					   Convert.ToInt64 (reader ["time"]));
-
-			photo.Description = reader["description"].ToString ();
-			photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
-			photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
-			photo.Rating = Convert.ToUInt32 (reader ["rating"]);
-		}
-
-		reader.Dispose();
-
-		if (photo == null)
-			return null;
-
-		Photo cached = LookupInCache (photo.Id);
-
-		if (cached != null)
-			return cached;
-
-		AddToCache (photo);
-
-		GetTags (photo);
-		GetVersions (photo);
-
-		return photo;
-	}
-
-	public void Remove (Tag []tags)
-	{
-		Photo [] photos = Query (tags, String.Empty, null, null);
-
-		foreach (Photo photo in photos)
-			photo.RemoveCategory (tags);
-		Commit (photos);
-
-		foreach (Tag tag in tags)
-			App.Instance.Database.Tags.Remove (tag);
-
-	}
-
-	public void Remove (Photo []items)
-	{
-		EmitRemoved (items);
-
-		ArrayList query_builder = new ArrayList (items.Length);
-		for (int i = 0; i < items.Length; i++) {
-			query_builder.Add (String.Format ("{0}", items[i].Id));
-			RemoveFromCache (items[i]);
-		}
-
-		String id_list = String.Join ("','", ((string []) query_builder.ToArray (typeof (string))));
-		Database.Execute (String.Format ("DELETE FROM photos WHERE id IN ('{0}')", id_list));
-		Database.Execute (String.Format ("DELETE FROM photo_tags WHERE photo_id IN ('{0}')", id_list));
-		Database.Execute (String.Format ("DELETE FROM photo_versions WHERE photo_id IN ('{0}')", id_list));
-
-	}
-
-	public override void Remove (Photo item)
-	{
-		Remove (new Photo [] { (Photo)item });
-	}
-
-	public override void Commit (Photo item)
-	{
-		Commit (new Photo [] {item});
-	}
-
-	public void Commit (Photo [] items)
-	{
-		uint timer = Log.DebugTimerStart ();
-		// Only use a transaction for multiple saves. Avoids recursive transactions.
-
-		// TODO.
-		bool use_transactions = true; //!Database.InTransaction && items.Length > 1;
-
-		//if (use_transactions)
-		//	Database.BeginTransaction ();
-
-		// FIXME: this hack is used, because HyenaSqliteConnection does not support
-		// the InTransaction propery
-		try {
-			Database.BeginTransaction ();
-		} catch {
-			use_transactions = false;
-		}
-
-		PhotosChanges changes = new PhotosChanges ();
-		foreach (DbItem item in items)
-			changes |= Update ((Photo)item);
-
-		if (use_transactions)
-			Database.CommitTransaction ();
-
-		EmitChanged (items, new PhotoEventArgs (items, changes));
-		Log.DebugTimerPrint (timer, "Commit took {0}");
-	}
-
-	private PhotoChanges Update (Photo photo) {
-		PhotoChanges changes = photo.Changes;
-		// Update photo.
-		if (changes.DescriptionChanged || changes.DefaultVersionIdChanged || changes.TimeChanged || changes.UriChanged || changes.RatingChanged || changes.MD5SumChanged )
-
-			Database.Execute (
-				new HyenaSqliteCommand (
-					"UPDATE photos " +
-					"SET description = ?, " +
-					"    default_version_id = ?, " +
-					"    time = ?, " +
-					"    base_uri = ?, " +
-					"    filename = ?, " +
-					"    rating = ? " +
-					"WHERE id = ? ",
-					photo.Description,
-					photo.DefaultVersionId,
-					DateTimeUtil.FromDateTime (photo.Time),
-					photo.VersionUri (Photo.OriginalVersionId).GetBaseUri ().ToString (),
-					photo.VersionUri (Photo.OriginalVersionId).GetFilename (),
-					String.Format ("{0}", photo.Rating),
-					photo.Id
-				)
-			);
-
-		// Update tags.
-		if (changes.TagsRemoved != null)
-			foreach (Tag tag in changes.TagsRemoved)
-				Database.Execute (new HyenaSqliteCommand (
-					"DELETE FROM photo_tags WHERE photo_id = ? AND tag_id = ?",
-					photo.Id,
-					tag.Id));
-
-		if (changes.TagsAdded != null)
-			foreach (Tag tag in changes.TagsAdded)
-				Database.Execute (new HyenaSqliteCommand (
-					"INSERT OR IGNORE INTO photo_tags (photo_id, tag_id) " +
-					"VALUES (?, ?)",
-					photo.Id,
-					tag.Id));
-
-		// Update versions.
-		if (changes.VersionsRemoved != null)
-			foreach (uint version_id in changes.VersionsRemoved)
-				Database.Execute (new HyenaSqliteCommand (
-					"DELETE FROM photo_versions WHERE photo_id = ? AND version_id = ?",
-					photo.Id,
-					version_id));
-
-		if (changes.VersionsAdded != null)
-			foreach (uint version_id in changes.VersionsAdded) {
-				PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
-				InsertVersion (photo, version);
-			}
-		if (changes.VersionsModified != null)
-			foreach (uint version_id in changes.VersionsModified) {
-				PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
-				Database.Execute (new HyenaSqliteCommand (
-					"UPDATE photo_versions SET name = ?, " +
-					"base_uri = ?, filename = ?, protected = ?, import_md5 = ? " +
-					"WHERE photo_id = ? AND version_id = ?",
-					version.Name,
-					version.BaseUri.ToString (),
-					version.Filename,
-					version.IsProtected,
-					(version.ImportMD5 != String.Empty ? version.ImportMD5 : null),
-					photo.Id,
-					version_id));
-			}
-		photo.Changes = null;
-		return changes;
-	}
-
-	public void CalculateMD5Sum (Photo photo) {
-		foreach (uint version_id in photo.VersionIds) {
-			PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
-
-			// Don't overwrite MD5 sums that are already calculated.
-			if (version.ImportMD5 != String.Empty && version.ImportMD5 != null)
-				continue;
-
-			string version_md5_sum = HashUtils.GenerateMD5 (version.Uri);
-			version.ImportMD5 = version_md5_sum;
-			photo.Changes.ChangeVersion (version_id);
-		}
-
-		Commit (photo);
-	}
-
-	public int Count (string table_name, params IQueryCondition [] conditions)
-	{
-		StringBuilder query_builder = new StringBuilder ("SELECT COUNT(*) AS count FROM " + table_name + " ");
-		bool where_added = false;
-		foreach (IQueryCondition condition in conditions) {
-			if (condition == null)
-				continue;
-			if (condition is IOrderCondition)
-				continue;
-			query_builder.Append (where_added ? " AND " : " WHERE ");
-			query_builder.Append (condition.SqlClause ());
-			where_added = true;
-		}
-
-		IDataReader reader = Database.Query (query_builder.ToString());
-		reader.Read ();
-		int count = Convert.ToInt32 (reader ["count"]);
-		reader.Dispose();
-		return count;
-	}
-
-	public int [] IndicesOf (string table_name, uint [] items)
-	{
-		StringBuilder query_builder = new StringBuilder ("SELECT ROWID AS row_id FROM ");
-		query_builder.Append (table_name);
-		query_builder.Append (" WHERE id IN (");
-		for (int i = 0; i < items.Length; i++) {
-			query_builder.Append (items [i]);
-			query_builder.Append ((i != items.Length - 1) ? ", " : ")" );
-		}
-		return IndicesOf (query_builder.ToString ());
-	}
-
-	public int IndexOf (string table_name, Photo photo)
-	{
-		string query = String.Format ("SELECT ROWID AS row_id FROM {0} WHERE id = {1}", table_name, photo.Id);
-		return IndexOf (query);
-	}
-
-	public int IndexOf (string table_name, DateTime time, bool asc)
-	{
-		string query = String.Format ("SELECT ROWID AS row_id FROM {0} WHERE time {2} {1} ORDER BY time {3} LIMIT 1",
-				table_name,
-				DateTimeUtil.FromDateTime (time),
-				asc ? ">=" : "<=",
-				asc ? "ASC" : "DESC");
-		return IndexOf (query);
-	}
-
-	private int IndexOf (string query)
-	{
-		uint timer = Log.DebugTimerStart ();
-		IDataReader reader = Database.Query (query);
-		int index = - 1;
-		if (reader.Read ())
-			index = Convert.ToInt32 (reader ["row_id"]);
-		reader.Dispose();
-		Log.DebugTimerPrint (timer, "IndexOf took {0} : " + query);
-		return index - 1; //ROWID starts counting at 1
-	}
-
-	int [] IndicesOf (string query)
-	{
-		uint timer = Log.DebugTimerStart ();
-		List<int> list = new List<int> ();
-		IDataReader reader = Database.Query (query);
-		while (reader.Read ())
-			list.Add (Convert.ToInt32 (reader ["row_id"]) - 1);
-		reader.Dispose ();
-		Log.DebugTimerPrint (timer, "IndicesOf took {0} : " + query);
-		return list.ToArray ();
-	}
-
-	public Dictionary<int,int[]> PhotosPerMonth (params IQueryCondition [] conditions)
-	{
-		uint timer = Log.DebugTimerStart ();
-		Dictionary<int, int[]> val = new Dictionary<int, int[]> ();
-
-		//Sqlite is way more efficient querying to a temp then grouping than grouping at once
-		Database.Execute ("DROP TABLE IF EXISTS population");
-		StringBuilder query_builder = new StringBuilder ("CREATE TEMPORARY TABLE population AS SELECT strftime('%Y%m', datetime(time, 'unixepoch')) AS month FROM photos");
-		bool where_added = false;
-		foreach (IQueryCondition condition in conditions) {
-			if (condition == null)
-				continue;
-			if (condition is IOrderCondition)
-				continue;
-			query_builder.Append (where_added ? " AND " : " WHERE ");
-			query_builder.Append (condition.SqlClause ());
-			where_added = true;
-		}
-		Database.Execute (query_builder.ToString ());
-
-		int minyear = Int32.MaxValue;
-		int maxyear = Int32.MinValue;
-
-		IDataReader reader = Database.Query ("SELECT COUNT (*) as count, month from population GROUP BY month");
-		while (reader.Read ()) {
-			string yyyymm = reader ["month"].ToString ();
-			int count = Convert.ToInt32 (reader ["count"]);
-			int year = Convert.ToInt32 (yyyymm.Substring (0,4));
-			maxyear = Math.Max (year, maxyear);
-			minyear = Math.Min (year, minyear);
-			int month = Convert.ToInt32 (yyyymm.Substring (4));
-			if (!val.ContainsKey (year))
-				val.Add (year, new int[12]);
-			val[year][month-1] = count;
-		}
-		reader.Dispose ();
-
-		//Fill the blank
-		for (int i = minyear; i <= maxyear; i++)
-			if (!val.ContainsKey (i))
-				val.Add (i, new int[12]);
-
-		Log.DebugTimerPrint (timer, "PhotosPerMonth took {0}");
-		return val;
-	}
-
-	// Queries.
-	[Obsolete ("drop this, use IQueryCondition correctly instead")]
-	public Photo [] Query (Tag [] tags) {
-		return Query (tags, null, null, null, null);
-	}
-
-	private string BuildQuery (params IQueryCondition [] conditions)
-	{
-		StringBuilder query_builder = new StringBuilder ("SELECT * FROM photos ");
-
-		bool where_added = false;
-		bool hidden_contained = false;
-		foreach (IQueryCondition condition in conditions) {
-
-			if (condition == null)
-				continue;
-
-			if (condition is HiddenTag)
-				hidden_contained = true;
-
-			if (condition is IOrderCondition)
-				continue;
-
-			string sql_clause = condition.SqlClause ();
-
-			if (sql_clause == null || sql_clause.Trim () == String.Empty)
-				continue;
-			query_builder.Append (where_added ? " AND " : " WHERE ");
-			query_builder.Append (sql_clause);
-			where_added = true;
-		}
-
-		/* if a HiddenTag condition is not explicitly given, we add one */
-		if ( ! hidden_contained) {
-			string sql_clause = HiddenTag.HideHiddenTag.SqlClause ();
-
-			if (sql_clause != null && sql_clause.Trim () != String.Empty) {
-				query_builder.Append (where_added ? " AND " : " WHERE ");
-				query_builder.Append (sql_clause);
-			}
-		}
-
-		bool order_added = false;
-		foreach (IQueryCondition condition in conditions) {
-			if (condition == null)
-				continue;
-
-			if (!(condition is IOrderCondition))
-				continue;
-
-			string sql_clause = condition.SqlClause ();
-
-			if (sql_clause == null || sql_clause.Trim () == String.Empty)
-				continue;
-			query_builder.Append (order_added ? " , " : "ORDER BY ");
-			query_builder.Append (sql_clause);
-			order_added = true;
-		}
-
-		return query_builder.ToString ();
-	}
-
-	public Photo [] Query (params IQueryCondition [] conditions)
-	{
-		return Query (BuildQuery (conditions));
-	}
-
-	public void QueryToTemp (string temp_table, params IQueryCondition [] conditions)
-	{
-		QueryToTemp (temp_table, BuildQuery (conditions));
-	}
-
-	public void QueryToTemp(string temp_table, string query)
-	{
-		uint timer = Log.DebugTimerStart ();
-		Log.DebugFormat ("Query Started : {0}", query);
-		Database.BeginTransaction ();
-		Database.Execute (String.Format ("DROP TABLE IF EXISTS {0}", temp_table));
-		Database.Execute (String.Format ("CREATE TEMPORARY TABLE {0} AS {1}", temp_table, query));
-		// For Hyena.Data.Sqlite, we need to call Execute. Calling Query here does fail.
-		//Database.Query (String.Format ("CREATE TEMPORARY TABLE {0} AS {1}", temp_table, query)).Close ();
-		Database.CommitTransaction ();
-		Log.DebugTimerPrint (timer, "QueryToTemp took {0} : " + query);
-	}
-
-	public Photo [] QueryFromTemp (string temp_table)
-	{
-		return QueryFromTemp (temp_table, 0, -1);
-	}
-
-	public Photo [] QueryFromTemp (string temp_table, int offset, int limit)
-	{
-		return Query (String.Format ("SELECT * FROM {0} LIMIT {1} OFFSET {2}", temp_table, limit, offset));
-	}
-
-	public Photo [] Query (string query)
-	{
-		return Query (new HyenaSqliteCommand (query));
-	}
-
-	private Photo [] Query (HyenaSqliteCommand query)
-	{
-		uint timer = Log.DebugTimerStart ();
-		IDataReader reader = Database.Query(query);
-
-		List<Photo> new_photos = new List<Photo> ();
-		List<Photo> query_result = new List<Photo> ();
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["id"]);
-			Photo photo = LookupInCache (id);
-
-			if (photo == null) {
-				photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
-				photo.Description = reader["description"].ToString ();
-				photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
-				photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
-				photo.Rating = Convert.ToUInt32 (reader ["rating"]);
-				new_photos.Add (photo);
-			}
-
-			query_result.Add (photo);
-		}
-		reader.Dispose();
-
-		bool need_load = false;
-		string photo_ids = "(";
-		foreach (Photo photo in new_photos) {
-			AddToCache (photo);
-			photo_ids = photo_ids + Convert.ToString(photo.Id) + ",";
-			need_load |= !photo.AllVersionsLoaded;
-		}
-
-		photo_ids = photo_ids + "-1)";
-
-		if (need_load) {
-			GetAllTags (photo_ids);
-			GetAllVersions (photo_ids);
-			foreach (Photo photo in new_photos)
-				photo.AllVersionsLoaded = true;
-		} else {
-			//Console.WriteLine ("Skipped Loading Data");
-		}
-
-		foreach (Photo photo in new_photos)
-			photo.Changes = null;
-
-		Log.DebugTimerPrint (timer, "Query took {0} : " + query.Text);
-		return query_result.ToArray ();
-	}
-
-	public Photo [] Query (SafeUri uri)
-	{
-		string filename = uri.GetFilename ();
-
-		/* query by file */
-		if ( ! String.IsNullOrEmpty (filename)) {
-			return Query (new HyenaSqliteCommand (
-			"SELECT id, "			+
-				"time, "			+
-				"base_uri, "		+
-				"filename, "		+
-				"description, "		+
-				"roll_id, "		+
-				"default_version_id, "	+
-				"rating "		+
-			"FROM photos " 				+
-			"WHERE base_uri LIKE ?"		+
-			"AND filename LIKE ?",
-			 uri.GetBaseUri ().ToString (),
-			filename));
-		}
-
-		/* query by directory */
-		return Query (new HyenaSqliteCommand (
-			"SELECT id, "			+
-				"time, "			+
-				"base_uri, "		+
-				"filename, "		+
-				"description, "		+
-				"roll_id, "		+
-				"default_version_id, "	+
-				"rating "		+
-			"FROM photos " 				+
-			"WHERE base_uri LIKE ?"		+
-			"AND base_uri NOT LIKE ?",
-			uri.ToString () + "%",
-			uri.ToString () + "/%/%"));
-	}
-
-	[Obsolete ("drop this, use IQueryCondition correctly instead")]
-	public Photo [] Query (Tag [] tags, string extra_condition, DateRange range, RollSet importidrange)
-	{
-		return Query (FSpot.OrTerm.FromTags(tags), extra_condition, range, importidrange, null);
-	}
-
-	[Obsolete ("drop this, use IQueryCondition correctly instead")]
-	public Photo [] Query (Tag [] tags, string extra_condition, DateRange range, RollSet importidrange, RatingRange ratingrange)
-	{
-		return Query (FSpot.OrTerm.FromTags(tags), extra_condition, range, importidrange, ratingrange);
-	}
-
-	[Obsolete ("drop this, use IQueryCondition correctly instead")]
-	public Photo [] Query (Term searchexpression, string extra_condition, DateRange range, RollSet importidrange, RatingRange ratingrange)
-	{
-		bool hide = (extra_condition == null);
-
-		// The SQL query that we want to construct is:
-		//
-		// SELECT photos.id
-		//        photos.time
-		//        photos.uri,
-		//        photos.description,
-		//	  photos.roll_id,
-		//        photos.default_version_id
-		//        photos.rating
-		//                  FROM photos, photo_tags
-		//		    WHERE photos.time >= time1 AND photos.time <= time2
-		//				AND photos.rating >= rat1 AND photos.rating <= rat2
-		//				AND photos.id NOT IN (select photo_id FROM photo_tags WHERE tag_id = HIDDEN)
-		//				AND photos.id IN (select photo_id FROM photo_tags where tag_id IN (tag1, tag2..)
-		//				AND extra_condition_string
-		//                  GROUP BY photos.id
-
-		StringBuilder query_builder = new StringBuilder ();
-		ArrayList where_clauses = new ArrayList ();
-		query_builder.Append ("SELECT id, " 			+
-					     "time, "			+
-					     "base_uri, "			+
-					     "filename, "			+
-					     "description, "		+
-					     "roll_id, "   		+
-					     "default_version_id, "	+
-					     "rating "			+
-				      "FROM photos ");
-
-		if (range != null) {
-			where_clauses.Add (String.Format ("time >= {0} AND time <= {1}",
-							  DateTimeUtil.FromDateTime (range.Start),
-							  DateTimeUtil.FromDateTime (range.End)));
-
-		}
-
-		if (ratingrange != null) {
-			where_clauses.Add (ratingrange.SqlClause ());
-		}
-
-		if (importidrange != null) {
-			where_clauses.Add (importidrange.SqlClause ());
-		}
-
-		if (hide && App.Instance.Database.Tags.Hidden != null) {
-			where_clauses.Add (String.Format ("id NOT IN (SELECT photo_id FROM photo_tags WHERE tag_id = {0})",
-							  App.Instance.Database.Tags.Hidden.Id));
-		}
-
-		if (searchexpression != null) {
-			where_clauses.Add (searchexpression.SqlCondition ());
-		}
-
-		if (extra_condition != null && extra_condition.Trim () != String.Empty) {
-			where_clauses.Add (extra_condition);
-		}
-
-		if (where_clauses.Count > 0) {
-			query_builder.Append (" WHERE ");
-			query_builder.Append (String.Join (" AND ", ((String []) where_clauses.ToArray (typeof(String)))));
-		}
-		query_builder.Append (" ORDER BY time");
-		return Query (query_builder.ToString ());
-	}
-}
+        public class PhotoStore : DbStore<Photo> {
+         public int TotalPhotos {
+                 get {
+                         IDataReader reader = Database.Query("SELECT COUNT(*) AS photo_count FROM photos");
+                         reader.Read ();
+                         int total = Convert.ToInt32 (reader ["photo_count"]);
+                         reader.Dispose ();
+                         return total;
+                 }
+         }
+        
+         // FIXME this is a hack.  Since we don't have Gnome.ThumbnailFactory.SaveThumbnail() in
+         // GTK#, and generate them by ourselves directly with Gdk.Pixbuf, we have to make sure here
+         // that the "large" thumbnail directory exists.
+         private static void EnsureThumbnailDirectory ()
+         {
+                 string large_thumbnail_file_name_template = Gnome.Thumbnail.PathForUri ("file:///boo", Gnome.ThumbnailSize.Large);
+                 string large_thumbnail_directory_path = System.IO.Path.GetDirectoryName (large_thumbnail_file_name_template);
+        
+                 if (! System.IO.File.Exists (large_thumbnail_directory_path))
+                         System.IO.Directory.CreateDirectory (large_thumbnail_directory_path);
+         }
+
+         // Constructor
+         public PhotoStore (FSpotDatabaseConnection database, bool is_new)
+                 : base (database, false)
+         {
+                 EnsureThumbnailDirectory ();
+        
+                 if (! is_new)
+                         return;
+        
+                 Database.Execute (
+                         "CREATE TABLE photos (\n" +
+                         "       id                      INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \n" +
+                         "       time                    INTEGER NOT NULL, \n" +
+                         "       base_uri                STRING NOT NULL, \n" +
+                     "   filename                STRING NOT NULL, \n" +
+                         "       description             TEXT NOT NULL, \n" +
+                         "       roll_id                 INTEGER NOT NULL, \n" +
+                         "       default_version_id      INTEGER NOT NULL, \n" +
+                         "       rating                  INTEGER NULL \n" +
+                         ")");
+        
+                 Database.Execute (
+                         "CREATE TABLE photo_tags (\n" +
+                         "       photo_id        INTEGER, \n" +
+                         "       tag_id          INTEGER, \n" +
+                         "       UNIQUE (photo_id, tag_id)\n" +
+                         ")");
+        
+                 Database.Execute (
+                         "CREATE TABLE photo_versions (\n"+
+                         "       photo_id        INTEGER, \n" +
+                         "       version_id      INTEGER, \n" +
+                         "       name            STRING, \n" +
+                         "       base_uri                STRING NOT NULL, \n" +
+                     "   filename                STRING NOT NULL, \n" +
+                         "       import_md5              TEXT NULL, \n" +
+                         "       protected       BOOLEAN, \n" +
+                         "       UNIQUE (photo_id, version_id)\n" +
+                         ")");
+        
+                 Database.Execute ("CREATE INDEX idx_photo_versions_id ON photo_versions(photo_id)");
+                 Database.Execute ("CREATE INDEX idx_photo_versions_import_md5 ON photo_versions(import_md5)");
+                 Database.Execute ("CREATE INDEX idx_photos_roll_id ON photos(roll_id)");
+         }
+        
+         public bool HasDuplicate (IPhoto item) {
+                 var uri = item.DefaultVersion.Uri;
+        
+                 // Check if the exact given uri already exists.
+                 var query = "SELECT COUNT(*) AS count FROM photo_versions WHERE base_uri = ? AND filename = ?";
+                 var reader = Database.Query (new HyenaSqliteCommand (query, uri.GetBaseUri ().ToString (), uri.GetFilename ()));
+                 reader.Read ();
+                 int count = Convert.ToInt32 (reader ["count"]);
+                 reader.Dispose();
+                 if (count > 0)
+                         return true;
+        
+                 // Check by MD5. Won't import if there are photos with the same ImportMD5.
+                 string hash = item.DefaultVersion.ImportMD5;
+                 var condition = new ConditionWrapper (String.Format ("import_md5 = \"{0}\"", hash));
+                 var dupes_by_hash = Count ("photo_versions", condition);
+                 if (dupes_by_hash > 0)
+                         return true;
+        
+                 // This is a very lame check to overcome the lack of duplicate detect data right after transition.
+                 //
+                 // Does filename matching if there are files with no hash for the original version.
+                 condition = new ConditionWrapper ("version_id = 1 AND (import_md5 = \"\" OR import_md5 IS NULL)");
+                 var have_no_hashes = Count ("photo_versions", condition);
+                 if (have_no_hashes > 0) {
+                         var name = uri.GetFilename ();
+                         DateTime? time = null;
+        
+                         // Look for a filename match.
+                         reader = Database.Query (new HyenaSqliteCommand ("SELECT photos.id, photos.time, pv.filename FROM photos LEFT JOIN photo_versions AS pv ON pv.photo_id = photos.id WHERE pv.filename = ?", name));
+                         while (reader.Read ()) {
+                                 Log.DebugFormat ("Found one possible duplicate for {0}", reader["filename"].ToString ());
+                                 if (!time.HasValue) {
+                                         // Only read time when needed
+                                         time = item.Time;
+                                 }
+        
+                                 if (reader["time"].ToString () == DateTimeUtil.FromDateTime (time.Value).ToString ()) {
+                                         Log.Debug ("Skipping duplicate", uri);
+        
+                                         // Schedule a hash calculation job on the existing file.
+                                         CalculateHashJob.Create (FSpot.App.Instance.Database.Jobs, Convert.ToUInt32 (reader["id"]));
+        
+                                         return true;
+                                 }
+                         }
+                         reader.Dispose ();
+                 }
+        
+                 // No matches
+                 return false;
+         }
+        
+         public Photo CreateFrom (IPhoto item, uint roll_id)
+         {
+                 Photo photo;
+        
+                 long unix_time = DateTimeUtil.FromDateTime (item.Time);
+                 string description = item.Description ?? String.Empty;
+        
+                 uint id = (uint) Database.Execute (
+                         new HyenaSqliteCommand (
+                                 "INSERT INTO photos (time, base_uri, filename, description, roll_id, default_version_id, rating) "      +
+                                 "VALUES (?, ?, ?, ?, ?, ?, ?)",
+                                 unix_time,
+                                 item.DefaultVersion.BaseUri.ToString (),
+                                 item.DefaultVersion.Filename,
+                                 description,
+                                 roll_id,
+                                 Photo.OriginalVersionId,
+                                 "0"
+                         )
+                 );
+        
+                 photo = new Photo (id, unix_time);
+                 photo.AddVersionUnsafely (Photo.OriginalVersionId, item.DefaultVersion.BaseUri, item.DefaultVersion.Filename, item.DefaultVersion.ImportMD5, Catalog.GetString ("Original"), true);
+                 photo.AllVersionsLoaded = true;
+        
+                 InsertVersion (photo, photo.DefaultVersion as PhotoVersion);
+                 EmitAdded (photo);
+                 return photo;
+         }
+        
+         private void InsertVersion (Photo photo, PhotoVersion version)
+         {
+                 Database.Execute (new HyenaSqliteCommand (
+                         "INSERT OR IGNORE INTO photo_versions (photo_id, version_id, name, base_uri, filename, protected, import_md5) " +
+                         "VALUES (?, ?, ?, ?, ?, ?, ?)",
+                         photo.Id,
+                         version.VersionId,
+                         version.Name,
+                         version.BaseUri.ToString (),
+                         version.Filename,
+                         version.IsProtected,
+                         (version.ImportMD5 != String.Empty ? version.ImportMD5 : null)));
+         }
+        
+        
+         private void GetVersions (Photo photo)
+         {
+                 IDataReader reader = Database.Query(
+                         new HyenaSqliteCommand("SELECT version_id, name, base_uri, filename, import_md5, protected " +
+                                       "FROM photo_versions " +
+                                       "WHERE photo_id = ?",
+                                       photo.Id
+                         )
+                 );
+        
+                 while (reader.Read ()) {
+                         uint version_id = Convert.ToUInt32 (reader ["version_id"]);
+                         string name = reader["name"].ToString ();
+                         var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
+                         var filename = reader ["filename"].ToString ();
+                         string import_md5 = reader["import_md5"] != null ? reader ["import_md5"].ToString () : null;
+                         bool is_protected = Convert.ToBoolean (reader["protected"]);
+        
+                         photo.AddVersionUnsafely (version_id, base_uri, filename, import_md5, name, is_protected);
+                 }
+                 reader.Dispose();
+         }
+        
+         private void GetTags (Photo photo)
+         {
+                 IDataReader reader = Database.Query(new HyenaSqliteCommand("SELECT tag_id FROM photo_tags WHERE photo_id = ?", photo.Id));
+        
+                 while (reader.Read ()) {
+                         uint tag_id = Convert.ToUInt32 (reader ["tag_id"]);
+                         Tag tag = App.Instance.Database.Tags.Get (tag_id) as Tag;
+                         photo.AddTagUnsafely (tag);
+                 }
+                 reader.Dispose();
+         }
+        
+         private void GetAllVersions  (string ids) {
+                 IDataReader reader = Database.Query ("SELECT photo_id, version_id, name, base_uri, filename, import_md5, protected FROM photo_versions WHERE photo_id IN " + ids);
+        
+                 while (reader.Read ()) {
+                         uint id = Convert.ToUInt32 (reader ["photo_id"]);
+                         Photo photo = LookupInCache (id);
+        
+                         if (photo == null) {
+                                 //Console.WriteLine ("Photo {0} not found", id);
+                                 continue;
+                         }
+        
+                         if (photo.AllVersionsLoaded) {
+                                 //Console.WriteLine ("Photo {0} already Loaded", photo);
+                                 continue;
+                         }
+        
+                         if (reader ["version_id"] != null) {
+                                 uint version_id = Convert.ToUInt32 (reader ["version_id"]);
+                                 string name = reader["name"].ToString ();
+                                 var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
+                                 var filename = reader ["filename"].ToString ();
+                                 string import_md5 = reader["import_md5"] != null ? reader ["import_md5"].ToString () : null;
+                                 bool is_protected = Convert.ToBoolean (reader["protected"]);
+        
+                                 photo.AddVersionUnsafely (version_id, base_uri, filename, import_md5, name, is_protected);
+                         }
+        
+                         /*
+                         string directory_path = null;
+                         if (reader [3] != null)
+                                 directory_path = reader [3].ToString ();
+                         System.Console.WriteLine ("directory_path = {0}", directory_path);
+                         */
+                 }
+                 reader.Dispose();
+         }
+        
+         private void GetAllTags (string ids) {
+                 IDataReader reader = Database.Query ("SELECT photo_id, tag_id FROM photo_tags WHERE photo_id IN " + ids);
+        
+                 while (reader.Read ()) {
+                         uint id = Convert.ToUInt32 (reader ["photo_id"]);
+                         Photo photo = LookupInCache (id);
+        
+                         if (photo == null) {
+                                 //Console.WriteLine ("Photo {0} not found", id);
+                                 continue;
+                         }
+        
+                         if (photo.AllVersionsLoaded) {
+                                 //Console.WriteLine ("Photo {0} already Loaded", photo.Id);
+                                 continue;
+                         }
+        
+                         if (reader [1] != null) {
+                                 uint tag_id = Convert.ToUInt32 (reader ["tag_id"]);
+                                 Tag tag = App.Instance.Database.Tags.Get (tag_id) as Tag;
+                                 photo.AddTagUnsafely (tag);
+                         }
+                 }
+                 reader.Dispose();
+         }
+        
+         public override Photo Get (uint id)
+         {
+                 Photo photo = LookupInCache (id);
+                 if (photo != null)
+                         return photo;
+        
+                 IDataReader reader = Database.Query(
+                         new HyenaSqliteCommand("SELECT time, description, roll_id, default_version_id, rating " +
+                                       "FROM photos " +
+                                       "WHERE id = ?", id
+                                      )
+                 );
+        
+                 if (reader.Read ()) {
+                         photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
+                         photo.Description = reader["description"].ToString ();
+                         photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
+                         photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
+                         photo.Rating = Convert.ToUInt32 (reader ["rating"]);
+                         AddToCache (photo);
+                 }
+                 reader.Dispose();
+        
+                 if (photo == null)
+                         return null;
+        
+                 GetTags (photo);
+                 GetVersions (photo);
+        
+                 return photo;
+         }
+        
+         public Photo GetByUri (SafeUri uri)
+         {
+                 Photo photo = null;
+        
+                 var base_uri = uri.GetBaseUri ();
+                 var filename = uri.GetFilename ();
+        
+                 IDataReader reader =
+                         Database.Query (new HyenaSqliteCommand ("SELECT id, time, description, roll_id, default_version_id, rating " +
+                                                        " FROM photos " +
+                                                        " LEFT JOIN photo_versions AS pv ON photos.id = pv.photo_id" +
+                                                        " WHERE (photos.base_uri = ? AND photos.filename = ?)" +
+                                                        " OR (pv.base_uri = ? AND pv.filename = ?)",
+                                                        base_uri.ToString (), filename,
+                                                        base_uri.ToString (), filename));
+        
+                 if (reader.Read ()) {
+                         photo = new Photo (Convert.ToUInt32 (reader ["id"]),
+                                            Convert.ToInt64 (reader ["time"]));
+        
+                         photo.Description = reader["description"].ToString ();
+                         photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
+                         photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
+                         photo.Rating = Convert.ToUInt32 (reader ["rating"]);
+                 }
+        
+                 reader.Dispose();
+        
+                 if (photo == null)
+                         return null;
+        
+                 Photo cached = LookupInCache (photo.Id);
+        
+                 if (cached != null)
+                         return cached;
+        
+                 AddToCache (photo);
+        
+                 GetTags (photo);
+                 GetVersions (photo);
+        
+                 return photo;
+         }
+        
+         public void Remove (Tag []tags)
+         {
+                 Photo [] photos = Query (tags, String.Empty, null, null);
+        
+                 foreach (Photo photo in photos)
+                         photo.RemoveCategory (tags);
+                 Commit (photos);
+        
+                 foreach (Tag tag in tags)
+                         App.Instance.Database.Tags.Remove (tag);
+        
+         }
+        
+         public void Remove (Photo []items)
+         {
+                 EmitRemoved (items);
+        
+                 ArrayList query_builder = new ArrayList (items.Length);
+                 for (int i = 0; i < items.Length; i++) {
+                         query_builder.Add (String.Format ("{0}", items[i].Id));
+                         RemoveFromCache (items[i]);
+                 }
+        
+                 String id_list = String.Join ("','", ((string []) query_builder.ToArray (typeof (string))));
+                 Database.Execute (String.Format ("DELETE FROM photos WHERE id IN ('{0}')", id_list));
+                 Database.Execute (String.Format ("DELETE FROM photo_tags WHERE photo_id IN ('{0}')", id_list));
+                 Database.Execute (String.Format ("DELETE FROM photo_versions WHERE photo_id IN ('{0}')", id_list));
+        
+         }
+        
+         public override void Remove (Photo item)
+         {
+                 Remove (new Photo [] { (Photo)item });
+         }
+        
+         public override void Commit (Photo item)
+         {
+                 Commit (new Photo [] {item});
+         }
+        
+         public void Commit (Photo [] items)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 // Only use a transaction for multiple saves. Avoids recursive transactions.
+        
+                 // TODO.
+                 bool use_transactions = true; //!Database.InTransaction && items.Length > 1;
+        
+                 //if (use_transactions)
+                 //      Database.BeginTransaction ();
+        
+                 // FIXME: this hack is used, because HyenaSqliteConnection does not support
+                 // the InTransaction propery
+                 try {
+                         Database.BeginTransaction ();
+                 } catch {
+                         use_transactions = false;
+                 }
+        
+                 PhotosChanges changes = new PhotosChanges ();
+                 foreach (DbItem item in items)
+                         changes |= Update ((Photo)item);
+        
+                 if (use_transactions)
+                         Database.CommitTransaction ();
+        
+                 EmitChanged (items, new PhotoEventArgs (items, changes));
+                 Log.DebugTimerPrint (timer, "Commit took {0}");
+         }
+        
+         private PhotoChanges Update (Photo photo) {
+                 PhotoChanges changes = photo.Changes;
+                 // Update photo.
+                 if (changes.DescriptionChanged || changes.DefaultVersionIdChanged || changes.TimeChanged || changes.UriChanged || changes.RatingChanged || changes.MD5SumChanged )
+        
+                         Database.Execute (
+                                 new HyenaSqliteCommand (
+                                         "UPDATE photos " +
+                                         "SET description = ?, " +
+                                         "    default_version_id = ?, " +
+                                         "    time = ?, " +
+                                         "    base_uri = ?, " +
+                                         "    filename = ?, " +
+                                         "    rating = ? " +
+                                         "WHERE id = ? ",
+                                         photo.Description,
+                                         photo.DefaultVersionId,
+                                         DateTimeUtil.FromDateTime (photo.Time),
+                                         photo.VersionUri (Photo.OriginalVersionId).GetBaseUri ().ToString (),
+                                         photo.VersionUri (Photo.OriginalVersionId).GetFilename (),
+                                         String.Format ("{0}", photo.Rating),
+                                         photo.Id
+                                 )
+                         );
+        
+                 // Update tags.
+                 if (changes.TagsRemoved != null)
+                         foreach (Tag tag in changes.TagsRemoved)
+                                 Database.Execute (new HyenaSqliteCommand (
+                                         "DELETE FROM photo_tags WHERE photo_id = ? AND tag_id = ?",
+                                         photo.Id,
+                                         tag.Id));
+        
+                 if (changes.TagsAdded != null)
+                         foreach (Tag tag in changes.TagsAdded)
+                                 Database.Execute (new HyenaSqliteCommand (
+                                         "INSERT OR IGNORE INTO photo_tags (photo_id, tag_id) " +
+                                         "VALUES (?, ?)",
+                                         photo.Id,
+                                         tag.Id));
+        
+                 // Update versions.
+                 if (changes.VersionsRemoved != null)
+                         foreach (uint version_id in changes.VersionsRemoved)
+                                 Database.Execute (new HyenaSqliteCommand (
+                                         "DELETE FROM photo_versions WHERE photo_id = ? AND version_id = ?",
+                                         photo.Id,
+                                         version_id));
+        
+                 if (changes.VersionsAdded != null)
+                         foreach (uint version_id in changes.VersionsAdded) {
+                                 PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
+                                 InsertVersion (photo, version);
+                         }
+                 if (changes.VersionsModified != null)
+                         foreach (uint version_id in changes.VersionsModified) {
+                                 PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
+                                 Database.Execute (new HyenaSqliteCommand (
+                                         "UPDATE photo_versions SET name = ?, " +
+                                         "base_uri = ?, filename = ?, protected = ?, import_md5 = ? " +
+                                         "WHERE photo_id = ? AND version_id = ?",
+                                         version.Name,
+                                         version.BaseUri.ToString (),
+                                         version.Filename,
+                                         version.IsProtected,
+                                         (version.ImportMD5 != String.Empty ? version.ImportMD5 : null),
+                                         photo.Id,
+                                         version_id));
+                         }
+                 photo.Changes = null;
+                 return changes;
+         }
+        
+         public void CalculateMD5Sum (Photo photo) {
+                 foreach (uint version_id in photo.VersionIds) {
+                         PhotoVersion version = photo.GetVersion (version_id) as PhotoVersion;
+        
+                         // Don't overwrite MD5 sums that are already calculated.
+                         if (version.ImportMD5 != String.Empty && version.ImportMD5 != null)
+                                 continue;
+        
+                         string version_md5_sum = HashUtils.GenerateMD5 (version.Uri);
+                         version.ImportMD5 = version_md5_sum;
+                         photo.Changes.ChangeVersion (version_id);
+                 }
+        
+                 Commit (photo);
+         }
+        
+         public int Count (string table_name, params IQueryCondition [] conditions)
+         {
+                 StringBuilder query_builder = new StringBuilder ("SELECT COUNT(*) AS count FROM " + table_name + " ");
+                 bool where_added = false;
+                 foreach (IQueryCondition condition in conditions) {
+                         if (condition == null)
+                                 continue;
+                         if (condition is IOrderCondition)
+                                 continue;
+                         query_builder.Append (where_added ? " AND " : " WHERE ");
+                         query_builder.Append (condition.SqlClause ());
+                         where_added = true;
+                 }
+        
+                 IDataReader reader = Database.Query (query_builder.ToString());
+                 reader.Read ();
+                 int count = Convert.ToInt32 (reader ["count"]);
+                 reader.Dispose();
+                 return count;
+         }
+        
+         public int [] IndicesOf (string table_name, uint [] items)
+         {
+                 StringBuilder query_builder = new StringBuilder ("SELECT ROWID AS row_id FROM ");
+                 query_builder.Append (table_name);
+                 query_builder.Append (" WHERE id IN (");
+                 for (int i = 0; i < items.Length; i++) {
+                         query_builder.Append (items [i]);
+                         query_builder.Append ((i != items.Length - 1) ? ", " : ")" );
+                 }
+                 return IndicesOf (query_builder.ToString ());
+         }
+        
+         public int IndexOf (string table_name, Photo photo)
+         {
+                 string query = String.Format ("SELECT ROWID AS row_id FROM {0} WHERE id = {1}", table_name, photo.Id);
+                 return IndexOf (query);
+         }
+        
+         public int IndexOf (string table_name, DateTime time, bool asc)
+         {
+                 string query = String.Format ("SELECT ROWID AS row_id FROM {0} WHERE time {2} {1} ORDER BY time {3} LIMIT 1",
+                                 table_name,
+                                 DateTimeUtil.FromDateTime (time),
+                                 asc ? ">=" : "<=",
+                                 asc ? "ASC" : "DESC");
+                 return IndexOf (query);
+         }
+        
+         private int IndexOf (string query)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 IDataReader reader = Database.Query (query);
+                 int index = - 1;
+                 if (reader.Read ())
+                         index = Convert.ToInt32 (reader ["row_id"]);
+                 reader.Dispose();
+                 Log.DebugTimerPrint (timer, "IndexOf took {0} : " + query);
+                 return index - 1; //ROWID starts counting at 1
+         }
+        
+         int [] IndicesOf (string query)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 List<int> list = new List<int> ();
+                 IDataReader reader = Database.Query (query);
+                 while (reader.Read ())
+                         list.Add (Convert.ToInt32 (reader ["row_id"]) - 1);
+                 reader.Dispose ();
+                 Log.DebugTimerPrint (timer, "IndicesOf took {0} : " + query);
+                 return list.ToArray ();
+         }
+        
+         public Dictionary<int,int[]> PhotosPerMonth (params IQueryCondition [] conditions)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 Dictionary<int, int[]> val = new Dictionary<int, int[]> ();
+        
+                 //Sqlite is way more efficient querying to a temp then grouping than grouping at once
+                 Database.Execute ("DROP TABLE IF EXISTS population");
+                 StringBuilder query_builder = new StringBuilder ("CREATE TEMPORARY TABLE population AS SELECT strftime('%Y%m', datetime(time, 'unixepoch')) AS month FROM photos");
+                 bool where_added = false;
+                 foreach (IQueryCondition condition in conditions) {
+                         if (condition == null)
+                                 continue;
+                         if (condition is IOrderCondition)
+                                 continue;
+                         query_builder.Append (where_added ? " AND " : " WHERE ");
+                         query_builder.Append (condition.SqlClause ());
+                         where_added = true;
+                 }
+                 Database.Execute (query_builder.ToString ());
+        
+                 int minyear = Int32.MaxValue;
+                 int maxyear = Int32.MinValue;
+        
+                 IDataReader reader = Database.Query ("SELECT COUNT (*) as count, month from population GROUP BY month");
+                 while (reader.Read ()) {
+                         string yyyymm = reader ["month"].ToString ();
+                         int count = Convert.ToInt32 (reader ["count"]);
+                         int year = Convert.ToInt32 (yyyymm.Substring (0,4));
+                         maxyear = Math.Max (year, maxyear);
+                         minyear = Math.Min (year, minyear);
+                         int month = Convert.ToInt32 (yyyymm.Substring (4));
+                         if (!val.ContainsKey (year))
+                                 val.Add (year, new int[12]);
+                         val[year][month-1] = count;
+                 }
+                 reader.Dispose ();
+        
+                 //Fill the blank
+                 for (int i = minyear; i <= maxyear; i++)
+                         if (!val.ContainsKey (i))
+                                 val.Add (i, new int[12]);
+        
+                 Log.DebugTimerPrint (timer, "PhotosPerMonth took {0}");
+                 return val;
+         }
+        
+         // Queries.
+         [Obsolete ("drop this, use IQueryCondition correctly instead")]
+         public Photo [] Query (Tag [] tags) {
+                 return Query (tags, null, null, null, null);
+         }
+        
+         private string BuildQuery (params IQueryCondition [] conditions)
+         {
+                 StringBuilder query_builder = new StringBuilder ("SELECT * FROM photos ");
+        
+                 bool where_added = false;
+                 bool hidden_contained = false;
+                 foreach (IQueryCondition condition in conditions) {
+        
+                         if (condition == null)
+                                 continue;
+        
+                         if (condition is HiddenTag)
+                                 hidden_contained = true;
+        
+                         if (condition is IOrderCondition)
+                                 continue;
+        
+                         string sql_clause = condition.SqlClause ();
+        
+                         if (sql_clause == null || sql_clause.Trim () == String.Empty)
+                                 continue;
+                         query_builder.Append (where_added ? " AND " : " WHERE ");
+                         query_builder.Append (sql_clause);
+                         where_added = true;
+                 }
+        
+                 /* if a HiddenTag condition is not explicitly given, we add one */
+                 if ( ! hidden_contained) {
+                         string sql_clause = HiddenTag.HideHiddenTag.SqlClause ();
+        
+                         if (sql_clause != null && sql_clause.Trim () != String.Empty) {
+                                 query_builder.Append (where_added ? " AND " : " WHERE ");
+                                 query_builder.Append (sql_clause);
+                         }
+                 }
+        
+                 bool order_added = false;
+                 foreach (IQueryCondition condition in conditions) {
+                         if (condition == null)
+                                 continue;
+        
+                         if (!(condition is IOrderCondition))
+                                 continue;
+        
+                         string sql_clause = condition.SqlClause ();
+        
+                         if (sql_clause == null || sql_clause.Trim () == String.Empty)
+                                 continue;
+                         query_builder.Append (order_added ? " , " : "ORDER BY ");
+                         query_builder.Append (sql_clause);
+                         order_added = true;
+                 }
+        
+                 return query_builder.ToString ();
+         }
+        
+         public Photo [] Query (params IQueryCondition [] conditions)
+         {
+                 return Query (BuildQuery (conditions));
+         }
+        
+         public void QueryToTemp (string temp_table, params IQueryCondition [] conditions)
+         {
+                 QueryToTemp (temp_table, BuildQuery (conditions));
+         }
+        
+         public void QueryToTemp(string temp_table, string query)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 Log.DebugFormat ("Query Started : {0}", query);
+                 Database.BeginTransaction ();
+                 Database.Execute (String.Format ("DROP TABLE IF EXISTS {0}", temp_table));
+                 Database.Execute (String.Format ("CREATE TEMPORARY TABLE {0} AS {1}", temp_table, query));
+                 // For Hyena.Data.Sqlite, we need to call Execute. Calling Query here does fail.
+                 //Database.Query (String.Format ("CREATE TEMPORARY TABLE {0} AS {1}", temp_table, query)).Close ();
+                 Database.CommitTransaction ();
+                 Log.DebugTimerPrint (timer, "QueryToTemp took {0} : " + query);
+         }
+        
+         public Photo [] QueryFromTemp (string temp_table)
+         {
+                 return QueryFromTemp (temp_table, 0, -1);
+         }
+        
+         public Photo [] QueryFromTemp (string temp_table, int offset, int limit)
+         {
+                 return Query (String.Format ("SELECT * FROM {0} LIMIT {1} OFFSET {2}", temp_table, limit, offset));
+         }
+        
+         public Photo [] Query (string query)
+         {
+                 return Query (new HyenaSqliteCommand (query));
+         }
+        
+         private Photo [] Query (HyenaSqliteCommand query)
+         {
+                 uint timer = Log.DebugTimerStart ();
+                 IDataReader reader = Database.Query(query);
+        
+                 List<Photo> new_photos = new List<Photo> ();
+                 List<Photo> query_result = new List<Photo> ();
+                 while (reader.Read ()) {
+                         uint id = Convert.ToUInt32 (reader ["id"]);
+                         Photo photo = LookupInCache (id);
+        
+                         if (photo == null) {
+                                 photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
+                                 photo.Description = reader["description"].ToString ();
+                                 photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
+                                 photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
+                                 photo.Rating = Convert.ToUInt32 (reader ["rating"]);
+                                 new_photos.Add (photo);
+                         }
+        
+                         query_result.Add (photo);
+                 }
+                 reader.Dispose();
+        
+                 bool need_load = false;
+                 string photo_ids = "(";
+                 foreach (Photo photo in new_photos) {
+                         AddToCache (photo);
+                         photo_ids = photo_ids + Convert.ToString(photo.Id) + ",";
+                         need_load |= !photo.AllVersionsLoaded;
+                 }
+        
+                 photo_ids = photo_ids + "-1)";
+        
+                 if (need_load) {
+                         GetAllTags (photo_ids);
+                         GetAllVersions (photo_ids);
+                         foreach (Photo photo in new_photos)
+                                 photo.AllVersionsLoaded = true;
+                 } else {
+                         //Console.WriteLine ("Skipped Loading Data");
+                 }
+        
+                 foreach (Photo photo in new_photos)
+                         photo.Changes = null;
+        
+                 Log.DebugTimerPrint (timer, "Query took {0} : " + query.Text);
+                 return query_result.ToArray ();
+         }
+        
+         public Photo [] Query (SafeUri uri)
+         {
+                 string filename = uri.GetFilename ();
+        
+                 /* query by file */
+                 if ( ! String.IsNullOrEmpty (filename)) {
+                         return Query (new HyenaSqliteCommand (
+                         "SELECT id, "                   +
+                                 "time, "                        +
+                                 "base_uri, "            +
+                                 "filename, "            +
+                                 "description, "         +
+                                 "roll_id, "             +
+                                 "default_version_id, "  +
+                                 "rating "               +
+                         "FROM photos "                          +
+                         "WHERE base_uri LIKE ?"         +
+                         "AND filename LIKE ?",
+                          uri.GetBaseUri ().ToString (),
+                         filename));
+                 }
+        
+                 /* query by directory */
+                 return Query (new HyenaSqliteCommand (
+                         "SELECT id, "                   +
+                                 "time, "                        +
+                                 "base_uri, "            +
+                                 "filename, "            +
+                                 "description, "         +
+                                 "roll_id, "             +
+                                 "default_version_id, "  +
+                                 "rating "               +
+                         "FROM photos "                          +
+                         "WHERE base_uri LIKE ?"         +
+                         "AND base_uri NOT LIKE ?",
+                         uri.ToString () + "%",
+                         uri.ToString () + "/%/%"));
+         }
+        
+         [Obsolete ("drop this, use IQueryCondition correctly instead")]
+         public Photo [] Query (Tag [] tags, string extra_condition, DateRange range, RollSet importidrange)
+         {
+                 return Query (FSpot.OrTerm.FromTags(tags), extra_condition, range, importidrange, null);
+         }
+        
+         [Obsolete ("drop this, use IQueryCondition correctly instead")]
+         public Photo [] Query (Tag [] tags, string extra_condition, DateRange range, RollSet importidrange, RatingRange ratingrange)
+         {
+                 return Query (FSpot.OrTerm.FromTags(tags), extra_condition, range, importidrange, ratingrange);
+         }
+        
+         [Obsolete ("drop this, use IQueryCondition correctly instead")]
+         public Photo [] Query (Term searchexpression, string extra_condition, DateRange range, RollSet importidrange, RatingRange ratingrange)
+         {
+                 bool hide = (extra_condition == null);
+        
+                 // The SQL query that we want to construct is:
+                 //
+                 // SELECT photos.id
+                 //        photos.time
+                 //        photos.uri,
+                 //        photos.description,
+                 //        photos.roll_id,
+                 //        photos.default_version_id
+                 //        photos.rating
+                 //                  FROM photos, photo_tags
+                 //                  WHERE photos.time >= time1 AND photos.time <= time2
+                 //                              AND photos.rating >= rat1 AND photos.rating <= rat2
+                 //                              AND photos.id NOT IN (select photo_id FROM photo_tags WHERE tag_id = HIDDEN)
+                 //                              AND photos.id IN (select photo_id FROM photo_tags where tag_id IN (tag1, tag2..)
+                 //                              AND extra_condition_string
+                 //                  GROUP BY photos.id
+        
+                 StringBuilder query_builder = new StringBuilder ();
+                 ArrayList where_clauses = new ArrayList ();
+                 query_builder.Append ("SELECT id, "                     +
+                                              "time, "                   +
+                                              "base_uri, "                       +
+                                              "filename, "                       +
+                                              "description, "            +
+                                              "roll_id, "                +
+                                              "default_version_id, "     +
+                                              "rating "                  +
+                                       "FROM photos ");
+        
+                 if (range != null) {
+                         where_clauses.Add (String.Format ("time >= {0} AND time <= {1}",
+                                                           DateTimeUtil.FromDateTime (range.Start),
+                                                           DateTimeUtil.FromDateTime (range.End)));
+        
+                 }
+        
+                 if (ratingrange != null) {
+                         where_clauses.Add (ratingrange.SqlClause ());
+                 }
+        
+                 if (importidrange != null) {
+                         where_clauses.Add (importidrange.SqlClause ());
+                 }
+        
+                 if (hide && App.Instance.Database.Tags.Hidden != null) {
+                         where_clauses.Add (String.Format ("id NOT IN (SELECT photo_id FROM photo_tags WHERE tag_id = {0})",
+                                                           App.Instance.Database.Tags.Hidden.Id));
+                 }
+        
+                 if (searchexpression != null) {
+                         where_clauses.Add (searchexpression.SqlCondition ());
+                 }
+        
+                 if (extra_condition != null && extra_condition.Trim () != String.Empty) {
+                         where_clauses.Add (extra_condition);
+                 }
+        
+                 if (where_clauses.Count > 0) {
+                         query_builder.Append (" WHERE ");
+                         query_builder.Append (String.Join (" AND ", ((String []) where_clauses.ToArray (typeof(String)))));
+                 }
+                 query_builder.Append (" ORDER BY time");
+                 return Query (query_builder.ToString ());
+         }
+        }
 }
diff --git a/src/Clients/MainApp/FSpot/PhotoVersion.cs b/src/Clients/MainApp/FSpot/PhotoVersion.cs
index 87ab44e..4e9f61f 100644
--- a/src/Clients/MainApp/FSpot/PhotoVersion.cs
+++ b/src/Clients/MainApp/FSpot/PhotoVersion.cs
@@ -38,6 +38,7 @@ namespace FSpot
         public IPhoto Photo { get; private set; }
         public SafeUri BaseUri { get; set; }
         public string Filename { get; set; }
+
         public SafeUri Uri {
             get { return BaseUri.Append (Filename); }
             set {
@@ -45,6 +46,7 @@ namespace FSpot
                 Filename = value.GetFilename ();
             }
         }
+
         public string ImportMD5 { get; set; }
         public uint VersionId { get; private set; }
         public bool IsProtected { get; private set; }
diff --git a/src/Clients/MainApp/FSpot/PhotoView.cs b/src/Clients/MainApp/FSpot/PhotoView.cs
index 389a127..546acca 100644
--- a/src/Clients/MainApp/FSpot/PhotoView.cs
+++ b/src/Clients/MainApp/FSpot/PhotoView.cs
@@ -50,8 +50,7 @@ namespace FSpot {
 	public class PhotoView : EventBox {
 		DelayedOperation commit_delay;
 
-		private PhotoImageView photo_view;
-		private ScrolledWindow photo_view_scrolled;
+                private ScrolledWindow photo_view_scrolled;
 		private EventBox background;
 
 		private Filmstrip filmstrip;
@@ -80,33 +79,28 @@ namespace FSpot {
 			get { return filmstrip.Orientation; }
 		}
 
-		public PhotoImageView View {
-			get { return photo_view; }
-		}
+                // was photo_view
+		public PhotoImageView View { get; private set; }
 
 		public new BrowsablePointer Item {
-			get { return photo_view.Item; }
+                        get { return View.Item; }
 		}
 
-		private IBrowsableCollection query;
-		public IBrowsableCollection Query {
-			get { return query; }
-			set { query = value; }
-		}
+		public IBrowsableCollection Query { get; set; }
 
 		public double Zoom {
-			get { return photo_view.Zoom; }
-			set { photo_view.Zoom = value; }
+			get { return View.Zoom; }
+			set { View.Zoom = value; }
 		}
 
 		public double NormalizedZoom {
-			get { return photo_view.NormalizedZoom; }
-			set { photo_view.NormalizedZoom = value; }
+			get { return View.NormalizedZoom; }
+			set { View.NormalizedZoom = value; }
 		}
 
 		public void Reload ()
 		{
-			photo_view.Reload ();
+			View.Reload ();
 		}
 
 		private void UpdateDescriptionEntry ()
@@ -155,12 +149,12 @@ namespace FSpot {
 
 		public void ZoomIn ()
 		{
-			photo_view.ZoomIn ();
+			View.ZoomIn ();
 		}
 
 		public void ZoomOut ()
 		{
-			photo_view.ZoomOut ();
+			View.ZoomOut ();
 		}
 
 		// Event handlers.
@@ -187,7 +181,7 @@ namespace FSpot {
 		{
 			if (commit_delay.IsPending) {
 				commit_delay.Stop ();
-				((PhotoQuery)query).Commit (changed_photo);
+				((PhotoQuery)Query).Commit (changed_photo);
 			}
 			return true;
 		}
@@ -233,7 +227,7 @@ namespace FSpot {
 
 		void HandlePhotoChanged (object sender, EventArgs e)
 		{
-			if (query is PhotoQuery) {
+			if (Query is PhotoQuery) {
 				CommitPendingChanges ();
 			}
 
@@ -308,7 +302,7 @@ namespace FSpot {
 		public PhotoView (IBrowsableCollection query)
 			: base ()
 		{
-			this.query = query;
+			Query = query;
 
 			commit_delay = new DelayedOperation (1000, new GLib.IdleHandler (CommitPendingChanges));
 			this.Destroyed += HandleDestroy;
@@ -330,7 +324,7 @@ namespace FSpot {
 			frame.Add (inner_hbox);
 
 			BrowsablePointer bp = new BrowsablePointer (query, -1);
-			photo_view = new PhotoImageView (bp);
+			View = new PhotoImageView (bp);
 
 			filmstrip = new Filmstrip (bp);
 			filmstrip.ThumbOffset = 1;
@@ -338,15 +332,15 @@ namespace FSpot {
 			filmstrip.ThumbSize = 75;
 			PlaceFilmstrip ((Orientation) Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);
 
-			photo_view.PhotoChanged += HandlePhotoChanged;
+			View.PhotoChanged += HandlePhotoChanged;
 
 			photo_view_scrolled = new ScrolledWindow (null, null);
 
 			photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
 			photo_view_scrolled.ShadowType = ShadowType.None;
-			photo_view_scrolled.Add (photo_view);
+			photo_view_scrolled.Add (View);
 			photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
-			photo_view.AddEvents ((int) EventMask.KeyPressMask);
+			View.AddEvents ((int) EventMask.KeyPressMask);
 			inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
 			inner_hbox.PackStart (inner_vbox, true, true, 0);
 
@@ -408,7 +402,7 @@ namespace FSpot {
 		{
 			GtkUtil.ModifyColors (filmstrip);
 			GtkUtil.ModifyColors (tag_view);
-			GtkUtil.ModifyColors (photo_view);
+			GtkUtil.ModifyColors (View);
 			GtkUtil.ModifyColors (background);
 			GtkUtil.ModifyColors (photo_view_scrolled);
 			GtkUtil.ModifyColors (rating);
@@ -416,7 +410,7 @@ namespace FSpot {
 			Gdk.Color dark = Style.Dark (Gtk.StateType.Normal);
 			filmstrip.ModifyBg (Gtk.StateType.Normal, dark);
 			tag_view.ModifyBg (Gtk.StateType.Normal, dark);
-			photo_view.ModifyBg (Gtk.StateType.Normal, dark);
+			View.ModifyBg (Gtk.StateType.Normal, dark);
 			background.ModifyBg (Gtk.StateType.Normal, dark);
 			photo_view_scrolled.ModifyBg (Gtk.StateType.Normal, dark);
 			rating.ModifyBg (Gtk.StateType.Normal, dark);
diff --git a/src/Clients/MainApp/FSpot/PixbufCache.cs b/src/Clients/MainApp/FSpot/PixbufCache.cs
index 4cbfb6e..39508f0 100644
--- a/src/Clients/MainApp/FSpot/PixbufCache.cs
+++ b/src/Clients/MainApp/FSpot/PixbufCache.cs
@@ -62,7 +62,7 @@ namespace FSpot {
 
 		public void HandleThumbnailLoaded (ImageLoaderThread loader, ImageLoaderThread.RequestItem result)
 		{
-            Reload (result.Uri);
+                        Reload (result.Uri);
 		}
 
 		public void Request (SafeUri uri, object closure, int width, int height)
@@ -279,42 +279,25 @@ namespace FSpot {
 
 		public class CacheEntry : System.IDisposable {
 			private Gdk.Pixbuf pixbuf;
-			private SafeUri uri;
-			private int width;
-			private int height;
 			private object data;
-			private bool reload;
 			private PixbufCache cache;
 
 			public CacheEntry (PixbufCache cache, SafeUri uri, object closure, int width, int height)
 			{
-				this.uri = uri;
-				this.width = width;
-				this.height = height;
+				Uri = uri;
+				Width = width;
+				Height = height;
+                                // Should this be this.data or Data?
 				this.data = closure;
-				this.Reload = true;
+				Reload = true;
 				this.cache = cache;
 				cache.total_size += this.Size;
 			}
 
-			public bool Reload {
-				get { return reload; }
-				set { reload = value; }
-			}
-
-			public SafeUri Uri {
-				get { return uri; }
-			}
-
-			public int Width {
-				get { return width; }
-				set { width = value; }
-			}
-
-			public int Height {
-				get { return height; }
-				set { height = value; }
-			}
+			public bool Reload { get; set; }
+			public SafeUri Uri { get; private set; }
+			public int Width { get; set; }
+			public int Height { get; set; }
 
 			public object Data {
 				get {
@@ -330,7 +313,7 @@ namespace FSpot {
 			}
 
 			public bool IsDisposed {
-				get { return uri == null; }
+				get { return Uri == null; }
 			}
 
 			public void SetPixbufExtended (Gdk.Pixbuf value, bool ignore_undead)
@@ -348,11 +331,11 @@ namespace FSpot {
 					cache.total_size -= this.Size;
 					this.pixbuf = value;
 					if (pixbuf != null) {
-						this.width = pixbuf.Width;
-						this.height = pixbuf.Height;
+						Width = pixbuf.Width;
+						Height = pixbuf.Height;
 					}
 					cache.total_size += this.Size;
-					this.Reload = false;
+					Reload = false;
 
 					if (old != null)
 						old.Dispose ();
@@ -398,14 +381,14 @@ namespace FSpot {
 					}
 					this.pixbuf = null;
 					this.cache = null;
-					this.uri = null;
+					Uri = null;
 				}
 				System.GC.SuppressFinalize (this);
 			}
 
 			public int Size {
 				get {
-					return width * height * 3;
+					return Width * Height * 3;
 				}
 			}
 		}
diff --git a/src/Clients/MainApp/FSpot/RollStore.cs b/src/Clients/MainApp/FSpot/RollStore.cs
index 09ca8e3..67a5913 100644
--- a/src/Clients/MainApp/FSpot/RollStore.cs
+++ b/src/Clients/MainApp/FSpot/RollStore.cs
@@ -87,7 +87,7 @@ public class RollStore : DbStore<Roll>
 			AddToCache (roll);
 		}
 
-        reader.Dispose();
+                reader.Dispose();
 
 		return roll;
 	}
diff --git a/src/Clients/MainApp/FSpot/RotateCommand.cs b/src/Clients/MainApp/FSpot/RotateCommand.cs
index af83645..3c0f889 100644
--- a/src/Clients/MainApp/FSpot/RotateCommand.cs
+++ b/src/Clients/MainApp/FSpot/RotateCommand.cs
@@ -49,17 +49,14 @@ using Mono.Unix;
 
 namespace FSpot {
 	public class RotateException : ApplicationException {
-		public string path;
-		public bool ReadOnly = false;
 
-		public string Path {
-			get { return path; }
-		}
+                public bool ReadOnly = false;
+		public string Path { get; private set; }
 
 		public RotateException (string msg, string path) : this (msg, path, false) {}
 
 		public RotateException (string msg, string path, bool ro) : base (msg) {
-			this.path = path;
+			Path = path;
 			this.ReadOnly = ro;
 		}
 	}
@@ -81,87 +78,81 @@ namespace FSpot {
 			done = false;
 		}
 
-		private static void RotateOrientation (string original_path, RotateDirection direction)
-		{
-            try {
-                var uri = new SafeUri (original_path);
-                using (var metadata = Metadata.Parse (uri)) {
-                    metadata.EnsureAvailableTags ();
-                    var tag = metadata.ImageTag;
-                    var orientation = direction == RotateDirection.Clockwise
-                        ? FSpot.Utils.PixbufUtils.Rotate90 (tag.Orientation)
-                        : FSpot.Utils.PixbufUtils.Rotate270 (tag.Orientation);
-
-                    tag.Orientation = orientation;
-                    var always_sidecar = Preferences.Get<bool> (Preferences.METADATA_ALWAYS_USE_SIDECAR);
-                    metadata.SaveSafely (uri, always_sidecar);
-                    XdgThumbnailSpec.RemoveThumbnail (uri);
+	        private static void RotateOrientation (string original_path, RotateDirection direction)
+	        {
+                    try {
+                        var uri = new SafeUri (original_path);
+                        using (var metadata = Metadata.Parse (uri)) {
+                            metadata.EnsureAvailableTags ();
+                            var tag = metadata.ImageTag;
+                            var orientation = direction == RotateDirection.Clockwise
+                                ? FSpot.Utils.PixbufUtils.Rotate90 (tag.Orientation)
+                                : FSpot.Utils.PixbufUtils.Rotate270 (tag.Orientation);
+        
+                            tag.Orientation = orientation;
+                            var always_sidecar = Preferences.Get<bool> (Preferences.METADATA_ALWAYS_USE_SIDECAR);
+                            metadata.SaveSafely (uri, always_sidecar);
+                            XdgThumbnailSpec.RemoveThumbnail (uri);
+                        }
+                    } catch (Exception e) {
+                        Log.DebugException (e);
+                        throw new RotateException (Catalog.GetString ("Unable to rotate this type of photo"), original_path);
+                    }
                 }
-            } catch (Exception e) {
-                Log.DebugException (e);
-                throw new RotateException (Catalog.GetString ("Unable to rotate this type of photo"), original_path);
-            }
-        }
-
-        private void Rotate (string original_path, RotateDirection dir)
-        {
-            RotateOrientation (original_path, dir);
-        }
-
-        public bool Step ()
-        {
-            if (done)
-                return false;
 
-            GLib.FileInfo info = GLib.FileFactory.NewForUri (item.DefaultVersion.Uri).QueryInfo ("access::can-write", GLib.FileQueryInfoFlags.None, null);
-            if (!info.GetAttributeBoolean("access::can-write")) {
-                throw new RotateException (Catalog.GetString ("Unable to rotate readonly file"), item.DefaultVersion.Uri, true);
-            }
-
-            Rotate (item.DefaultVersion.Uri, direction);
-
-            done = true;
-            return !done;
+                private void Rotate (string original_path, RotateDirection dir)
+                {
+                    RotateOrientation (original_path, dir);
+                }
+        
+                public bool Step ()
+                {
+                    if (done)
+                        return false;
+        
+                    GLib.FileInfo info = GLib.FileFactory.NewForUri (item.DefaultVersion.Uri).QueryInfo ("access::can-write", GLib.FileQueryInfoFlags.None, null);
+                    if (!info.GetAttributeBoolean("access::can-write")) {
+                        throw new RotateException (Catalog.GetString ("Unable to rotate readonly file"), item.DefaultVersion.Uri, true);
+                    }
+        
+                    Rotate (item.DefaultVersion.Uri, direction);
+
+                    done = true;
+                    return !done;
+                }
         }
-    }
 
 	public class RotateMultiple {
 		RotateDirection direction;
-		IPhoto [] items;
-		int index;
 		RotateOperation op;
 
-		public int Index {
-			get { return index; }
-		}
+		public int Index { get; private set; }
 
-		public IPhoto [] Items {
-			get { return items; }
-		}
+		public IPhoto [] Items { get; private set; }
 
 		public RotateMultiple (IPhoto [] items, RotateDirection direction)
 		{
 			this.direction = direction;
-			this.items = items;
-			index = 0;
+			Items = items;
+			Index = 0;
 		}
 
 		public bool Step ()
 		{
-			if (index >= items.Length)
+			if (Index >= Items.Length)
 				return false;
 
 			if (op == null)
-				op = new RotateOperation (items [index], direction);
+				op = new RotateOperation (Items [Index], direction);
 
 			if (op.Step ())
 				return true;
 			else {
-				index++;
+				Index++;
 				op = null;
 			}
 
-			return (index < items.Length);
+			return (Index < Items.Length);
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs b/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
index 4f126e1..9d3d29e 100644
--- a/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
+++ b/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
@@ -133,22 +133,22 @@ namespace FSpot
 			selection_data.Set (target, 8, data, data.Length);
 		}
 
-        public static void SetUriListData (this SelectionData selection_data, UriList uri_list)
-        {
-            selection_data.SetUriListData (uri_list, Atom.Intern ("text/uri-list", true));
-        }
-
+                public static void SetUriListData (this SelectionData selection_data, UriList uri_list)
+                {
+                    selection_data.SetUriListData (uri_list, Atom.Intern ("text/uri-list", true));
+                }
+        
 		public static UriList GetUriListData (this SelectionData selection_data)
 		{
 			return new UriList (GetStringData (selection_data));
 		}
 
-        public static void SetCopyFiles (this SelectionData selection_data, UriList uri_list)
-        {
-            var uris = (from p in uri_list select p.ToString ()).ToArray ();
-            var data = Encoding.UTF8.GetBytes ("copy\n" + String.Join ("\n", uris));
-
-            selection_data.Set (Atom.Intern ("x-special/gnome-copied-files", true), 8, data, data.Length);
-        }
+                public static void SetCopyFiles (this SelectionData selection_data, UriList uri_list)
+                {
+                    var uris = (from p in uri_list select p.ToString ()).ToArray ();
+                    var data = Encoding.UTF8.GetBytes ("copy\n" + String.Join ("\n", uris));
+        
+                    selection_data.Set (Atom.Intern ("x-special/gnome-copied-files", true), 8, data, data.Length);
+                }
 	}
 }
diff --git a/src/Clients/MainApp/FSpot/SendEmail.cs b/src/Clients/MainApp/FSpot/SendEmail.cs
index a8d7d1b..602e6db 100644
--- a/src/Clients/MainApp/FSpot/SendEmail.cs
+++ b/src/Clients/MainApp/FSpot/SendEmail.cs
@@ -55,15 +55,14 @@ namespace FSpot
 #pragma warning disable 0649
 		[GtkBeans.Builder.Object] private Gtk.ScrolledWindow   tray_scrolled;
 		[GtkBeans.Builder.Object] private Label 		NumberOfPictures, TotalOriginalSize, ApproxNewSize;
-		[GtkBeans.Builder.Object] private RadioButton 	tiny_size, small_size, medium_size,
-														large_size, x_large_size, original_size;
+		[GtkBeans.Builder.Object] private RadioButton 	tiny_size, small_size, medium_size, large_size, x_large_size, original_size;
 #pragma warning restore 0649
 
 		long Orig_Photo_Size 	= 0;
 		double scale_percentage = 0.3;
 
 		// The different sizes we can shrink to foto to. See RadioButton above for labels.
-		static int[] sizes 		= { 0, 320, 	480, 	640, 	800, 	1024 };
+		static int[] sizes 	= { 0, 320, 	480, 	640, 	800, 	1024 };
 
 		// Estimated size relative to original after shrinking down the photo.
 		double[] avg_scale_ref 	= { 0, 0.0186,	0.0348,	0.0532,	0.0826,	0.1234 };
@@ -199,19 +198,18 @@ namespace FSpot
 
 		private void UpdateEstimatedSize()
 		{
-				int new_size_index;
-				long new_approx_total_size;
-				string approxresult;
-
-				new_size_index = GetScaleIndex();
-				if (new_size_index == 0)
-					new_approx_total_size = Orig_Photo_Size;
-				else
-					new_approx_total_size = System.Convert.ToInt64(Orig_Photo_Size * avg_scale [new_size_index]);
-
-				approxresult = GLib.Format.SizeForDisplay (new_approx_total_size);
-				ApproxNewSize.Text 	= approxresult;
-
+			int new_size_index;
+			long new_approx_total_size;
+			string approxresult;
+
+			new_size_index = GetScaleIndex();
+			if (new_size_index == 0)
+				new_approx_total_size = Orig_Photo_Size;
+			else
+				new_approx_total_size = System.Convert.ToInt64(Orig_Photo_Size * avg_scale [new_size_index]);
+
+			approxresult = GLib.Format.SizeForDisplay (new_approx_total_size);
+			ApproxNewSize.Text 	= approxresult;
 		}
 
 		public void on_size_toggled (object o, EventArgs args)
@@ -219,7 +217,6 @@ namespace FSpot
 			UpdateEstimatedSize();
 		}
 
-
 		private void HandleResponse (object sender, Gtk.ResponseArgs args)
 		{
 			int size = 0;
diff --git a/src/Clients/MainApp/FSpot/SingleView.cs b/src/Clients/MainApp/FSpot/SingleView.cs
index 7595d19..8607683 100644
--- a/src/Clients/MainApp/FSpot/SingleView.cs
+++ b/src/Clients/MainApp/FSpot/SingleView.cs
@@ -126,9 +126,9 @@ namespace FSpot {
 
 			collection = new UriCollection (uris);
 
-            TargetList targetList = new TargetList();
-            targetList.AddTextTargets((uint)DragDropTargets.TargetType.PlainText);
-            targetList.AddUriTargets((uint)DragDropTargets.TargetType.UriList);
+			TargetList targetList = new TargetList();
+			targetList.AddTextTargets((uint)DragDropTargets.TargetType.PlainText);
+			targetList.AddUriTargets((uint)DragDropTargets.TargetType.UriList);
 
 			directory_view = new SelectionCollectionGridView (collection);
 			directory_view.Selection.Changed += HandleSelectionChanged;
diff --git a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
index cc0e445..fe90643 100644
--- a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
+++ b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
@@ -69,9 +69,9 @@ namespace FSpot {
 		// Selection management.
 
 		public Tag TagAtPosition (double x, double y)
-	    {
-	        return TagAtPosition((int) x, (int) y);
-	    }
+		{
+			return TagAtPosition((int) x, (int) y);
+		}
 
 		public Tag TagAtPosition (int x, int y)
 		{
@@ -105,7 +105,6 @@ namespace FSpot {
 		}
 
 		// Loading up the store.
-
 		private void LoadCategory (Category category, TreeIter parent_iter)
 		{
 			IList<Tag> tags = category.Children;
diff --git a/src/Clients/MainApp/FSpot/TagStore.cs b/src/Clients/MainApp/FSpot/TagStore.cs
index 53b2c51..a532434 100644
--- a/src/Clients/MainApp/FSpot/TagStore.cs
+++ b/src/Clients/MainApp/FSpot/TagStore.cs
@@ -48,381 +48,362 @@ using Hyena;
 using Hyena.Data.Sqlite;
 
 namespace FSpot {
-public class InvalidTagOperationException : InvalidOperationException {
-	public Tag tag;
+	public class InvalidTagOperationException : InvalidOperationException {
 
-	public InvalidTagOperationException (Tag t, string message) : base (message)
-	{
-		tag = t;
-	}
-
-	public Tag Tag {
-		get {
-			return tag;
+		public InvalidTagOperationException (Tag t, string message) : base (message)
+		{
+			Tag = t;
 		}
-	}
-
-}
-
-// Sorts tags into an order that it will be safe to delete
-// them in (eg children first).
-public class TagRemoveComparer : IComparer {
-	public int Compare (object obj1, object obj2)
-	{
-		Tag t1 = obj1 as Tag;
-		Tag t2 = obj2 as Tag;
-
-		return Compare (t1, t2);
-	}
 
-	public int Compare (Tag t1, Tag t2)
-	{
-		if (t1.IsAncestorOf (t2))
-			return 1;
-		else if (t2.IsAncestorOf (t1))
-			return -1;
-		else
-			return 0;
+		public Tag Tag { get; set; }
 	}
-}
-
-public class TagStore : DbStore<Tag> {
-	Category root_category;
-	public Category RootCategory {
-		get {
-			return root_category;
+	
+	// Sorts tags into an order that it will be safe to delete
+	// them in (eg children first).
+	public class TagRemoveComparer : IComparer {
+		public int Compare (object obj1, object obj2)
+		{
+			Tag t1 = obj1 as Tag;
+			Tag t2 = obj2 as Tag;
+	
+			return Compare (t1, t2);
 		}
-	}
-
-	private const string STOCK_ICON_DB_PREFIX = "stock_icon:";
-
-	static void SetIconFromString (Tag tag, string icon_string)
-	{
-		if (icon_string == null) {
-			tag.Icon = null;
-			// IconWasCleared automatically set already, override
-			// it in this case since it was NULL in the db.
-			tag.IconWasCleared = false;
-		} else if (icon_string == String.Empty)
-			tag.Icon = null;
-		else if (icon_string.StartsWith (STOCK_ICON_DB_PREFIX))
-			tag.ThemeIconName = icon_string.Substring (STOCK_ICON_DB_PREFIX.Length);
-		else
-			tag.Icon = GdkUtils.Deserialize (Convert.FromBase64String (icon_string));
-	}
-
-	private Tag hidden;
-	public Tag Hidden {
-		get {
-			return hidden;
+	
+		public int Compare (Tag t1, Tag t2)
+		{
+			if (t1.IsAncestorOf (t2))
+				return 1;
+			else if (t2.IsAncestorOf (t1))
+				return -1;
+			else
+				return 0;
 		}
 	}
-
-	public Tag GetTagByName (string name)
-	{
-		foreach (Tag t in this.item_cache.Values)
-			if (t.Name.ToLower () == name.ToLower ())
-				return t;
-
-		return null;
-	}
-
-	public Tag GetTagById (int id)
-	{
-		foreach (Tag t in this.item_cache.Values)
-			if (t.Id == id)
-				return t;
-		return null;
-	}
-
-	public Tag [] GetTagsByNameStart (string s)
-	{
-		List <Tag> l = new List<Tag> ();
-		foreach (Tag t in this.item_cache.Values) {
-			if (t.Name.ToLower ().StartsWith (s.ToLower ()))
-				l.Add (t);
+	
+	public class TagStore : DbStore<Tag> {
+
+		public Category RootCategory { get; private set; }
+		public Tag Hidden { get; private set; }
+		private const string STOCK_ICON_DB_PREFIX = "stock_icon:";
+
+		static void SetIconFromString (Tag tag, string icon_string)
+		{
+			if (icon_string == null) {
+				tag.Icon = null;
+				// IconWasCleared automatically set already, override
+				// it in this case since it was NULL in the db.
+				tag.IconWasCleared = false;
+			} else if (icon_string == String.Empty)
+				tag.Icon = null;
+			else if (icon_string.StartsWith (STOCK_ICON_DB_PREFIX))
+				tag.ThemeIconName = icon_string.Substring (STOCK_ICON_DB_PREFIX.Length);
+			else
+				tag.Icon = GdkUtils.Deserialize (Convert.FromBase64String (icon_string));
 		}
 
-		if (l.Count == 0)
+		public Tag GetTagByName (string name)
+		{
+			foreach (Tag t in this.item_cache.Values)
+				if (t.Name.ToLower () == name.ToLower ())
+					return t;
+	
 			return null;
-
-		l.Sort (delegate (Tag t1, Tag t2) {return t2.Popularity.CompareTo (t1.Popularity); });
-
-		return l.ToArray ();
-	}
-
-	// In this store we keep all the items (i.e. the tags) in memory at all times.  This is
-	// mostly to simplify handling of the parent relationship between tags, but it also makes it
-	// a little bit faster.  We achieve this by passing "true" as the cache_is_immortal to our
-	// base class.
-	private void LoadAllTags ()
-	{
-
-		// Pass 1, get all the tags.
-
-		IDataReader reader = Database.Query ("SELECT id, name, is_category, sort_priority, icon FROM tags");
-
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["id"]);
-			string name = reader ["name"].ToString ();
-			bool is_category = (Convert.ToUInt32 (reader ["is_category"]) != 0);
-
-			Tag tag;
-			if (is_category)
-				tag = new Category (null, id, name);
-			else
-				tag = new Tag (null, id, name);
-
-			if (reader ["icon"] != null)
-				try {
-					SetIconFromString (tag, reader ["icon"].ToString ());
-				} catch (Exception ex) {
-					Log.Exception ("Unable to load icon for tag " + name, ex);
+		}
+	
+		public Tag GetTagById (int id)
+		{
+			foreach (Tag t in this.item_cache.Values)
+				if (t.Id == id)
+					return t;
+			return null;
+		}
+	
+		public Tag [] GetTagsByNameStart (string s)
+		{
+			List <Tag> l = new List<Tag> ();
+			foreach (Tag t in this.item_cache.Values) {
+				if (t.Name.ToLower ().StartsWith (s.ToLower ()))
+					l.Add (t);
+			}
+	
+			if (l.Count == 0)
+				return null;
+	
+			l.Sort (delegate (Tag t1, Tag t2) {return t2.Popularity.CompareTo (t1.Popularity); });
+	
+			return l.ToArray ();
+		}
+	
+		// In this store we keep all the items (i.e. the tags) in memory at all times.  This is
+		// mostly to simplify handling of the parent relationship between tags, but it also makes it
+		// a little bit faster.  We achieve this by passing "true" as the cache_is_immortal to our
+		// base class.
+		private void LoadAllTags ()
+		{
+	
+			// Pass 1, get all the tags.
+	
+			IDataReader reader = Database.Query ("SELECT id, name, is_category, sort_priority, icon FROM tags");
+	
+			while (reader.Read ()) {
+				uint id = Convert.ToUInt32 (reader ["id"]);
+				string name = reader ["name"].ToString ();
+				bool is_category = (Convert.ToUInt32 (reader ["is_category"]) != 0);
+	
+				Tag tag;
+				if (is_category)
+					tag = new Category (null, id, name);
+				else
+					tag = new Tag (null, id, name);
+	
+				if (reader ["icon"] != null)
+					try {
+						SetIconFromString (tag, reader ["icon"].ToString ());
+					} catch (Exception ex) {
+						Log.Exception ("Unable to load icon for tag " + name, ex);
+					}
+	
+				tag.SortPriority = Convert.ToInt32 (reader["sort_priority"]);
+				AddToCache (tag);
+			}
+	
+			reader.Dispose ();
+	
+			// Pass 2, set the parents.
+			reader = Database.Query ("SELECT id, category_id FROM tags");
+	
+			while (reader.Read ()) {
+				uint id = Convert.ToUInt32 (reader ["id"]);
+				uint category_id = Convert.ToUInt32 (reader ["category_id"]);
+	
+				Tag tag = Get (id) as Tag;
+				if (tag == null)
+					throw new Exception (String.Format ("Cannot find tag {0}", id));
+				if (category_id == 0)
+					tag.Category = RootCategory;
+				else {
+					tag.Category = Get (category_id) as Category;
+					if (tag.Category == null)
+						Log.Warning ("Tag Without category found");
 				}
-
-			tag.SortPriority = Convert.ToInt32 (reader["sort_priority"]);
-			AddToCache (tag);
+	
+			}
+			reader.Dispose ();
+	
+			//Pass 3, set popularity
+			reader = Database.Query ("SELECT tag_id, COUNT (*) AS popularity FROM photo_tags GROUP BY tag_id");
+			while (reader.Read ()) {
+				Tag t = Get (Convert.ToUInt32 (reader ["tag_id"])) as Tag;
+				if (t != null)
+					t.Popularity = Convert.ToInt32 (reader ["popularity"]);
+			}
+			reader.Dispose ();
+	
+			if (FSpot.App.Instance.Database.Meta.HiddenTagId.Value != null)
+				Hidden = LookupInCache ((uint) FSpot.App.Instance.Database.Meta.HiddenTagId.ValueAsInt) as Tag;
 		}
-
-		reader.Dispose ();
-
-		// Pass 2, set the parents.
-		reader = Database.Query ("SELECT id, category_id FROM tags");
-
-		while (reader.Read ()) {
-			uint id = Convert.ToUInt32 (reader ["id"]);
-			uint category_id = Convert.ToUInt32 (reader ["category_id"]);
-
-			Tag tag = Get (id) as Tag;
-			if (tag == null)
-				throw new Exception (String.Format ("Cannot find tag {0}", id));
-			if (category_id == 0)
-				tag.Category = RootCategory;
-			else {
-				tag.Category = Get (category_id) as Category;
-				if (tag.Category == null)
-					Log.Warning ("Tag Without category found");
+	
+	
+		private void CreateTable ()
+		{
+			Database.Execute (
+				"CREATE TABLE tags (\n" +
+				"	id		INTEGER PRIMARY KEY NOT NULL, \n" +
+				"	name		TEXT UNIQUE, \n" +
+				"	category_id	INTEGER, \n" +
+				"	is_category	BOOLEAN, \n" +
+				"	sort_priority	INTEGER, \n" +
+				"	icon		TEXT\n" +
+				")");
+		}
+	
+		private void CreateDefaultTags ()
+		{
+			Category favorites_category = CreateCategory (RootCategory, Catalog.GetString ("Favorites"), false);
+			favorites_category.ThemeIconName = "emblem-favorite";
+			favorites_category.SortPriority = -10;
+			Commit (favorites_category);
+	
+			Tag hidden_tag = CreateTag (RootCategory, Catalog.GetString ("Hidden"), false);
+			hidden_tag.ThemeIconName = "emblem-readonly";
+			hidden_tag.SortPriority = -9;
+			Hidden = hidden_tag;
+			Commit (hidden_tag);
+			FSpot.App.Instance.Database.Meta.HiddenTagId.ValueAsInt = (int) hidden_tag.Id;
+			FSpot.App.Instance.Database.Meta.Commit (FSpot.App.Instance.Database.Meta.HiddenTagId);
+	
+			Tag people_category = CreateCategory (RootCategory, Catalog.GetString ("People"), false);
+			people_category.ThemeIconName = "emblem-people";
+			people_category.SortPriority = -8;
+			Commit (people_category);
+	
+			Tag places_category = CreateCategory (RootCategory, Catalog.GetString ("Places"), false);
+			places_category.ThemeIconName = "emblem-places";
+			places_category.SortPriority = -8;
+			Commit (places_category);
+	
+			Tag events_category = CreateCategory (RootCategory, Catalog.GetString ("Events"), false);
+			events_category.ThemeIconName = "emblem-event";
+			events_category.SortPriority = -7;
+			Commit (events_category);
+		}
+	
+	
+		// Constructor
+		public TagStore (FSpotDatabaseConnection database, bool is_new)
+			: base (database, true)
+		{
+			// The label for the root category is used in new and edit tag dialogs
+			RootCategory = new Category (null, 0, Catalog.GetString ("(None)"));
+	
+			if (! is_new) {
+				LoadAllTags ();
+			} else {
+				CreateTable ();
+				CreateDefaultTags ();
 			}
-
 		}
-		reader.Dispose ();
-
-		//Pass 3, set popularity
-		reader = Database.Query ("SELECT tag_id, COUNT (*) AS popularity FROM photo_tags GROUP BY tag_id");
-		while (reader.Read ()) {
-			Tag t = Get (Convert.ToUInt32 (reader ["tag_id"])) as Tag;
-			if (t != null)
-				t.Popularity = Convert.ToInt32 (reader ["popularity"]);
+	
+		private uint InsertTagIntoTable (Category parent_category, string name, bool is_category, bool autoicon)
+		{
+	
+			uint parent_category_id = parent_category.Id;
+			String default_tag_icon_value = autoicon ? null : String.Empty;
+	
+			int id = Database.Execute (new HyenaSqliteCommand ("INSERT INTO tags (name, category_id, is_category, sort_priority, icon)"
+	                          + "VALUES (?, ?, ?, 0, ?)",
+							  name,
+							  parent_category_id,
+							  is_category ? 1 : 0,
+							  default_tag_icon_value));
+	
+
+			return (uint) id;
 		}
-		reader.Dispose ();
-
-		if (FSpot.App.Instance.Database.Meta.HiddenTagId.Value != null)
-			hidden = LookupInCache ((uint) FSpot.App.Instance.Database.Meta.HiddenTagId.ValueAsInt) as Tag;
-	}
-
-
-	private void CreateTable ()
-	{
-		Database.Execute (
-			"CREATE TABLE tags (\n" +
-			"	id		INTEGER PRIMARY KEY NOT NULL, \n" +
-			"	name		TEXT UNIQUE, \n" +
-			"	category_id	INTEGER, \n" +
-			"	is_category	BOOLEAN, \n" +
-			"	sort_priority	INTEGER, \n" +
-			"	icon		TEXT\n" +
-			")");
-	}
-
-	private void CreateDefaultTags ()
-	{
-		Category favorites_category = CreateCategory (RootCategory, Catalog.GetString ("Favorites"), false);
-		favorites_category.ThemeIconName = "emblem-favorite";
-		favorites_category.SortPriority = -10;
-		Commit (favorites_category);
-
-		Tag hidden_tag = CreateTag (RootCategory, Catalog.GetString ("Hidden"), false);
-		hidden_tag.ThemeIconName = "emblem-readonly";
-		hidden_tag.SortPriority = -9;
-		this.hidden = hidden_tag;
-		Commit (hidden_tag);
-		FSpot.App.Instance.Database.Meta.HiddenTagId.ValueAsInt = (int) hidden_tag.Id;
-		FSpot.App.Instance.Database.Meta.Commit (FSpot.App.Instance.Database.Meta.HiddenTagId);
-
-		Tag people_category = CreateCategory (RootCategory, Catalog.GetString ("People"), false);
-		people_category.ThemeIconName = "emblem-people";
-		people_category.SortPriority = -8;
-		Commit (people_category);
-
-		Tag places_category = CreateCategory (RootCategory, Catalog.GetString ("Places"), false);
-		places_category.ThemeIconName = "emblem-places";
-		places_category.SortPriority = -8;
-		Commit (places_category);
-
-		Tag events_category = CreateCategory (RootCategory, Catalog.GetString ("Events"), false);
-		events_category.ThemeIconName = "emblem-event";
-		events_category.SortPriority = -7;
-		Commit (events_category);
-	}
-
-
-	// Constructor
-
-	public TagStore (FSpotDatabaseConnection database, bool is_new)
-		: base (database, true)
-	{
-		// The label for the root category is used in new and edit tag dialogs
-		root_category = new Category (null, 0, Catalog.GetString ("(None)"));
-
-		if (! is_new) {
-			LoadAllTags ();
-		} else {
-			CreateTable ();
-			CreateDefaultTags ();
+	
+		public Tag CreateTag (Category category, string name, bool autoicon)
+		{
+			if (category == null)
+				category = RootCategory;
+	
+			uint id = InsertTagIntoTable (category, name, false, autoicon);
+	
+			Tag tag = new Tag (category, id, name);
+			tag.IconWasCleared = !autoicon;
+	
+			AddToCache (tag);
+			EmitAdded (tag);
+	
+			return tag;
 		}
-	}
-
-	private uint InsertTagIntoTable (Category parent_category, string name, bool is_category, bool autoicon)
-	{
-
-		uint parent_category_id = parent_category.Id;
-		String default_tag_icon_value = autoicon ? null : String.Empty;
-
-		int id = Database.Execute (new HyenaSqliteCommand ("INSERT INTO tags (name, category_id, is_category, sort_priority, icon)"
-                          + "VALUES (?, ?, ?, 0, ?)",
-						  name,
-						  parent_category_id,
-						  is_category ? 1 : 0,
-						  default_tag_icon_value));
-
-
-		return (uint) id;
-	}
-
-	public Tag CreateTag (Category category, string name, bool autoicon)
-	{
-		if (category == null)
-			category = RootCategory;
-
-		uint id = InsertTagIntoTable (category, name, false, autoicon);
-
-		Tag tag = new Tag (category, id, name);
-		tag.IconWasCleared = !autoicon;
-
-		AddToCache (tag);
-		EmitAdded (tag);
-
-		return tag;
-	}
-
-	public Category CreateCategory (Category parent_category, string name, bool autoicon)
-	{
-		if (parent_category == null)
-			parent_category = RootCategory;
-
-		uint id = InsertTagIntoTable (parent_category, name, true, autoicon);
-
-		Category new_category = new Category (parent_category, id, name);
-		new_category.IconWasCleared = !autoicon;
-
-		AddToCache (new_category);
-		EmitAdded (new_category);
-
-		return new_category;
-	}
-
-	public override Tag Get (uint id)
-	{
-		if (id == 0)
-			return RootCategory;
-		else
-			return LookupInCache (id);
-	}
-
-	public override void Remove (Tag tag)
-	{
-		Category category = tag as Category;
-		if (category != null &&
-		    category.Children != null &&
-		    category.Children.Count > 0)
-			throw new InvalidTagOperationException (category, "Cannot remove category that contains children");
-
-		RemoveFromCache (tag);
-
-		tag.Category = null;
-
-		Database.Execute (new HyenaSqliteCommand ("DELETE FROM tags WHERE id = ?", tag.Id));
-
-		EmitRemoved (tag);
-	}
-
-
-	private string GetIconString (Tag tag)
-	{
-		if (tag.ThemeIconName != null)
-			return STOCK_ICON_DB_PREFIX + tag.ThemeIconName;
-		if (tag.Icon == null) {
-			if (tag.IconWasCleared)
-				return String.Empty;
-			return null;
+	
+		public Category CreateCategory (Category parent_category, string name, bool autoicon)
+		{
+			if (parent_category == null)
+				parent_category = RootCategory;
+	
+			uint id = InsertTagIntoTable (parent_category, name, true, autoicon);
+	
+			Category new_category = new Category (parent_category, id, name);
+			new_category.IconWasCleared = !autoicon;
+	
+			AddToCache (new_category);
+			EmitAdded (new_category);
+	
+			return new_category;
+		}
+	
+		public override Tag Get (uint id)
+		{
+			if (id == 0)
+				return RootCategory;
+			else
+				return LookupInCache (id);
+		}
+	
+		public override void Remove (Tag tag)
+		{
+			Category category = tag as Category;
+			if (category != null &&
+			    category.Children != null &&
+			    category.Children.Count > 0)
+				throw new InvalidTagOperationException (category, "Cannot remove category that contains children");
+	
+			RemoveFromCache (tag);
+	
+			tag.Category = null;
+	
+			Database.Execute (new HyenaSqliteCommand ("DELETE FROM tags WHERE id = ?", tag.Id));
+	
+			EmitRemoved (tag);
 		}
 
-		byte [] data = GdkUtils.Serialize (tag.Icon);
-		return Convert.ToBase64String (data);
-	}
-
-	public override void Commit (Tag tag)
-	{
-		Commit (tag, false);
-	}
-
-	public void Commit (Tag tag, bool update_xmp)
-	{
-		Commit (new Tag[] {tag}, update_xmp);
-	}
-
-	public void Commit (Tag [] tags, bool update_xmp)
-	{
-
-		// TODO.
-		bool use_transactions = update_xmp;//!Database.InTransaction && update_xmp;
-
-		//if (use_transactions)
-		//	Database.BeginTransaction ();
-
-		// FIXME: this hack is used, because HyenaSqliteConnection does not support
-		// the InTransaction propery
-
-		if (use_transactions) {
-			try {
-				Database.BeginTransaction ();
-			} catch {
-				use_transactions = false;
+		private string GetIconString (Tag tag)
+		{
+			if (tag.ThemeIconName != null)
+				return STOCK_ICON_DB_PREFIX + tag.ThemeIconName;
+			if (tag.Icon == null) {
+				if (tag.IconWasCleared)
+					return String.Empty;
+				return null;
 			}
+	
+			byte [] data = GdkUtils.Serialize (tag.Icon);
+			return Convert.ToBase64String (data);
 		}
-
-		foreach (Tag tag in tags) {
-			Database.Execute (new HyenaSqliteCommand ("UPDATE tags SET name = ?, category_id = ?, "
-						+ "is_category = ?, sort_priority = ?, icon = ? WHERE id = ?",
-							  tag.Name,
-							  tag.Category.Id,
-							  tag is Category ? 1 : 0,
-							  tag.SortPriority,
-							  GetIconString (tag),
-							  tag.Id));
-
-			if (update_xmp && Preferences.Get<bool> (Preferences.METADATA_EMBED_IN_IMAGE)) {
-				Photo [] photos = App.Instance.Database.Photos.Query (new Tag [] { tag });
-				foreach (Photo p in photos)
-					if (p.HasTag (tag)) // the query returns all the pics of the tag and all its child. this avoids updating child tags
-						SyncMetadataJob.Create (App.Instance.Database.Jobs, p);
+	
+		public override void Commit (Tag tag)
+		{
+			Commit (tag, false);
+		}
+	
+		public void Commit (Tag tag, bool update_xmp)
+		{
+			Commit (new Tag[] {tag}, update_xmp);
+		}
+	
+		public void Commit (Tag [] tags, bool update_xmp)
+		{
+	
+			// TODO.
+			bool use_transactions = update_xmp;//!Database.InTransaction && update_xmp;
+	
+			//if (use_transactions)
+			//	Database.BeginTransaction ();
+	
+			// FIXME: this hack is used, because HyenaSqliteConnection does not support
+			// the InTransaction propery
+	
+			if (use_transactions) {
+				try {
+					Database.BeginTransaction ();
+				} catch {
+					use_transactions = false;
+				}
+			}
+	
+			foreach (Tag tag in tags) {
+				Database.Execute (new HyenaSqliteCommand ("UPDATE tags SET name = ?, category_id = ?, "
+							+ "is_category = ?, sort_priority = ?, icon = ? WHERE id = ?",
+								  tag.Name,
+								  tag.Category.Id,
+								  tag is Category ? 1 : 0,
+								  tag.SortPriority,
+								  GetIconString (tag),
+								  tag.Id));
+	
+				if (update_xmp && Preferences.Get<bool> (Preferences.METADATA_EMBED_IN_IMAGE)) {
+					Photo [] photos = App.Instance.Database.Photos.Query (new Tag [] { tag });
+					foreach (Photo p in photos)
+						if (p.HasTag (tag)) // the query returns all the pics of the tag and all its child. this avoids updating child tags
+							SyncMetadataJob.Create (App.Instance.Database.Jobs, p);
+				}
 			}
+	
+			if (use_transactions)
+				Database.CommitTransaction ();
+	
+			EmitChanged (tags);
 		}
-
-		if (use_transactions)
-			Database.CommitTransaction ();
-
-		EmitChanged (tags);
 	}
 }
-}
diff --git a/src/Clients/MainApp/FSpot/Term.cs b/src/Clients/MainApp/FSpot/Term.cs
index 9db3b31..a4bc82e 100644
--- a/src/Clients/MainApp/FSpot/Term.cs
+++ b/src/Clients/MainApp/FSpot/Term.cs
@@ -444,26 +444,13 @@ namespace FSpot {
 		}
 
 		public Literal (Term parent, Tag tag, Literal after) : base (parent, after) {
-			this.tag = tag;
+			Tag = tag;
 		}
 
 		/** Properties **/
 
-		public static ArrayList FocusedLiterals
-		{
-			get {
-				return focusedLiterals;
-			}
-			set {
-				focusedLiterals = value;
-			}
-		}
-
-		public Tag Tag {
-			get {
-				return tag;
-			}
-		}
+		public static ArrayList FocusedLiterals { get; set; }
+		public Tag Tag { get; private set; }
 
 		public override bool IsNegated {
 			get {
diff --git a/src/Clients/MainApp/FSpot/ThumbnailCache.cs b/src/Clients/MainApp/FSpot/ThumbnailCache.cs
index 9d7bbc3..11cb29d 100644
--- a/src/Clients/MainApp/FSpot/ThumbnailCache.cs
+++ b/src/Clients/MainApp/FSpot/ThumbnailCache.cs
@@ -40,121 +40,121 @@ using FSpot.Utils;
 
 namespace FSpot
 {
-public class ThumbnailCache : IDisposable {
-
-	// Types.
-
-	private class Thumbnail {
-		// Uri of the image source
-		public SafeUri uri;
-
-		// The uncompressed thumbnail.
-		public Pixbuf pixbuf;
-	}
-
-
-	// Private members and constants
-
-	private const int DEFAULT_CACHE_SIZE = 2;
-
-	private int max_count;
-	private ArrayList pixbuf_mru;
-	private Hashtable pixbuf_hash = new Hashtable ();
-
-	static private ThumbnailCache defaultcache = new ThumbnailCache (DEFAULT_CACHE_SIZE);
-
-
-	// Public API
-
-	public ThumbnailCache (int max_count)
-	{
-		this.max_count = max_count;
-		pixbuf_mru = new ArrayList (max_count);
-	}
-
-	static public ThumbnailCache Default {
-		get {
-			return defaultcache;
+	public class ThumbnailCache : IDisposable {
+	
+		// Types.
+	
+		private class Thumbnail {
+			// Uri of the image source
+			public SafeUri uri;
+	
+			// The uncompressed thumbnail.
+			public Pixbuf pixbuf;
 		}
-	}
-
-	public void AddThumbnail (SafeUri uri, Pixbuf pixbuf)
-	{
-		Thumbnail thumbnail = new Thumbnail ();
-
-		thumbnail.uri = uri;
-		thumbnail.pixbuf = pixbuf;
-
-		RemoveThumbnailForUri (uri);
-
-		pixbuf_mru.Insert (0, thumbnail);
-		pixbuf_hash.Add (uri, thumbnail);
-
-		MaybeExpunge ();
-	}
-
-	public Pixbuf GetThumbnailForUri (SafeUri uri)
-	{
-		if (! pixbuf_hash.ContainsKey (uri))
-			return null;
-
-		Thumbnail item = pixbuf_hash [uri] as Thumbnail;
-
-		pixbuf_mru.Remove (item);
-		pixbuf_mru.Insert (0, item);
-
-        if (item.pixbuf == null)
-            return null;
-        return item.pixbuf.ShallowCopy ();
-	}
-
-	public void RemoveThumbnailForUri (SafeUri uri)
-	{
-		if (! pixbuf_hash.ContainsKey (uri))
-			return;
-
-		Thumbnail item = pixbuf_hash [uri] as Thumbnail;
-
-		pixbuf_hash.Remove (uri);
-		pixbuf_mru.Remove (item);
-
-		item.pixbuf.Dispose ();
-	}
-
-	public void Dispose ()
-	{
-		foreach (object item in pixbuf_mru) {
-			Thumbnail thumb = item as Thumbnail;
-			pixbuf_hash.Remove (thumb.uri);
-			thumb.pixbuf.Dispose ();
+	
+	
+		// Private members and constants
+
+		private const int DEFAULT_CACHE_SIZE = 2;
+	
+		private int max_count;
+		private ArrayList pixbuf_mru;
+		private Hashtable pixbuf_hash = new Hashtable ();
+	
+		static private ThumbnailCache defaultcache = new ThumbnailCache (DEFAULT_CACHE_SIZE);
+	
+	
+		// Public API
+	
+		public ThumbnailCache (int max_count)
+		{
+			this.max_count = max_count;
+			pixbuf_mru = new ArrayList (max_count);
 		}
-		pixbuf_mru.Clear ();
-		System.GC.SuppressFinalize (this);
-	}
-
-	~ThumbnailCache ()
-	{
-		Log.DebugFormat ("Finalizer called on {0}. Should be Disposed", GetType ());
-		foreach (object item in pixbuf_mru) {
-			Thumbnail thumb = item as Thumbnail;
-			pixbuf_hash.Remove (thumb.uri);
-			thumb.pixbuf.Dispose ();
+	
+		static public ThumbnailCache Default {
+			get {
+				return defaultcache;
+			}
 		}
-		pixbuf_mru.Clear ();
-	}
-
-	// Private utility methods.
-
-	private void MaybeExpunge ()
-	{
-		while (pixbuf_mru.Count > max_count) {
-			Thumbnail thumbnail = pixbuf_mru [pixbuf_mru.Count - 1] as Thumbnail;
-
-			pixbuf_hash.Remove (thumbnail.uri);
-			pixbuf_mru.RemoveAt (pixbuf_mru.Count - 1);
-
-			thumbnail.pixbuf.Dispose ();
+	
+		public void AddThumbnail (SafeUri uri, Pixbuf pixbuf)
+		{
+			Thumbnail thumbnail = new Thumbnail ();
+	
+			thumbnail.uri = uri;
+			thumbnail.pixbuf = pixbuf;
+	
+			RemoveThumbnailForUri (uri);
+	
+			pixbuf_mru.Insert (0, thumbnail);
+			pixbuf_hash.Add (uri, thumbnail);
+	
+			MaybeExpunge ();
+		}
+	
+		public Pixbuf GetThumbnailForUri (SafeUri uri)
+		{
+			if (! pixbuf_hash.ContainsKey (uri))
+				return null;
+	
+			Thumbnail item = pixbuf_hash [uri] as Thumbnail;
+	
+			pixbuf_mru.Remove (item);
+			pixbuf_mru.Insert (0, item);
+	
+		        if (item.pixbuf == null)
+		            return null;
+		        return item.pixbuf.ShallowCopy ();
+		}
+	
+		public void RemoveThumbnailForUri (SafeUri uri)
+		{
+			if (! pixbuf_hash.ContainsKey (uri))
+				return;
+	
+			Thumbnail item = pixbuf_hash [uri] as Thumbnail;
+	
+			pixbuf_hash.Remove (uri);
+			pixbuf_mru.Remove (item);
+	
+			item.pixbuf.Dispose ();
+		}
+	
+		public void Dispose ()
+		{
+			foreach (object item in pixbuf_mru) {
+				Thumbnail thumb = item as Thumbnail;
+				pixbuf_hash.Remove (thumb.uri);
+				thumb.pixbuf.Dispose ();
+			}
+			pixbuf_mru.Clear ();
+			System.GC.SuppressFinalize (this);
+		}
+	
+		~ThumbnailCache ()
+		{
+			Log.DebugFormat ("Finalizer called on {0}. Should be Disposed", GetType ());
+			foreach (object item in pixbuf_mru) {
+				Thumbnail thumb = item as Thumbnail;
+				pixbuf_hash.Remove (thumb.uri);
+				thumb.pixbuf.Dispose ();
+			}
+			pixbuf_mru.Clear ();
+		}
+	
+		// Private utility methods.
+	
+		private void MaybeExpunge ()
+		{
+			while (pixbuf_mru.Count > max_count) {
+				Thumbnail thumbnail = pixbuf_mru [pixbuf_mru.Count - 1] as Thumbnail;
+	
+				pixbuf_hash.Remove (thumbnail.uri);
+				pixbuf_mru.RemoveAt (pixbuf_mru.Count - 1);
+	
+				thumbnail.pixbuf.Dispose ();
+			}
 		}
 	}
 }
-}
diff --git a/src/Clients/MainApp/FSpot/TimeAdaptor.cs b/src/Clients/MainApp/FSpot/TimeAdaptor.cs
index e376a66..33c970f 100644
--- a/src/Clients/MainApp/FSpot/TimeAdaptor.cs
+++ b/src/Clients/MainApp/FSpot/TimeAdaptor.cs
@@ -124,12 +124,12 @@ namespace FSpot {
 			int year = endyear - item/12;
 			int month = 12 - (item % 12);
 
-            year = Math.Max(1, year);
-            year = Math.Min(year, 9999);
-            month = Math.Max(1, month);
-            month = Math.Min(month, 12);
-
-            int daysInMonth = DateTime.DaysInMonth(year, month);
+			year = Math.Max(1, year);
+			year = Math.Min(year, 9999);
+			month = Math.Max(1, month);
+			month = Math.Min(month, 12);
+		
+			int daysInMonth = DateTime.DaysInMonth(year, month);
 
 			return new DateTime (year, month, daysInMonth).AddDays (1.0).AddMilliseconds (-.1);
 		}
diff --git a/src/Clients/MainApp/ImageLoaderThread.cs b/src/Clients/MainApp/ImageLoaderThread.cs
index a0e0ca3..22578c5 100644
--- a/src/Clients/MainApp/ImageLoaderThread.cs
+++ b/src/Clients/MainApp/ImageLoaderThread.cs
@@ -30,7 +30,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using Gdk;
 using Gtk;
 using System.Collections;
@@ -43,11 +42,13 @@ using Hyena;
 using FSpot.Utils;
 using FSpot.Imaging;
 
-public class ImageLoaderThread {
+public class ImageLoaderThread
+{
 
 	// Types.
 
-	public class RequestItem {
+	public class RequestItem
+	{
 		/* The uri to the image.  */
 		public SafeUri Uri { get; set; }
 
@@ -55,38 +56,46 @@ public class ImageLoaderThread {
 		public int Order { get; set; }
 
 		/* The pixbuf obtained from the operation.  */
-        private Pixbuf result;
+		private Pixbuf result;
+
 		public Pixbuf Result {
-            get {
-				if (result == null) return null;
+			get {
+				if (result == null) {
+					return null;
+				}
 				return result.ShallowCopy ();
 			}
-            set { result = value; }
-        }
+			set { result = value; }
+		}
 
 		/* the maximium size both must be greater than zero if either is */
 		public int Width { get; set; }
+
 		public int Height { get; set; }
 
-		public RequestItem (SafeUri uri, int order, int width, int height) {
+		public RequestItem (SafeUri uri, int order, int width, int height)
+		{
 			this.Uri = uri;
 			this.Order = order;
 			this.Width = width;
 			this.Height = height;
-			if ((width <= 0 && height > 0) || (height <= 0 && width > 0))
+			if ((width <= 0 && height > 0) || (height <= 0 && width > 0)) {
 				throw new System.Exception ("Invalid arguments");
+			}
 		}
 
-        ~RequestItem () {
-            if (result != null)
-                result.Dispose ();
-            result = null;
-        }
+		~RequestItem ()
+		{
+			if (result != null) {
+				result.Dispose ();
+			}
+			result = null;
+		}
 	}
 
 
 	// Private members.
-    static List<ImageLoaderThread> instances = new List<ImageLoaderThread> ();
+	static List<ImageLoaderThread> instances = new List<ImageLoaderThread> ();
 
 	/* The thread used to handle the requests.  */
 	private Thread worker_thread;
@@ -115,12 +124,12 @@ public class ImageLoaderThread {
 	/* Whether a notification is pending on `pending_notify'
 	   already or not.  */
 	private bool pending_notify_notified;
-
 	volatile bool should_cancel = false;
 
 	// Public API.
 
-	public delegate void PixbufLoadedHandler (ImageLoaderThread loader, RequestItem result);
+	public delegate void PixbufLoadedHandler (ImageLoaderThread loader,RequestItem result);
+
 	public event PixbufLoadedHandler OnPixbufLoaded;
 
 	public ImageLoaderThread ()
@@ -132,20 +141,22 @@ public class ImageLoaderThread {
 
 		pending_notify = new ThreadNotify (new Gtk.ReadyEvent (HandleProcessedRequests));
 
-        instances.Add (this);
+		instances.Add (this);
 	}
 
-    void StartWorker ()
-    {
-        if (worker_thread != null)
-            return;
+	void StartWorker ()
+	{
+		if (worker_thread != null) {
+			return;
+		}
 
 		should_cancel = false;
 		worker_thread = new Thread (new ThreadStart (WorkerThread));
 		worker_thread.Start ();
-    }
+	}
 
 	int block_count;
+
 	public void PushBlock ()
 	{
 		System.Threading.Interlocked.Increment (ref block_count);
@@ -172,11 +183,12 @@ public class ImageLoaderThread {
 		worker_thread = null;
 	}
 
-    public static void CleanAll ()
-    {
-        foreach (var thread in instances)
-            thread.Cleanup ();
-    }
+	public static void CleanAll ()
+	{
+		foreach (var thread in instances) {
+			thread.Cleanup ();
+		}
+	}
 
 	public void Request (SafeUri uri, int order)
 	{
@@ -186,8 +198,9 @@ public class ImageLoaderThread {
 	public virtual void Request (SafeUri uri, int order, int width, int height)
 	{
 		lock (queue) {
-			if (InsertRequest (uri, order, width, height))
+			if (InsertRequest (uri, order, width, height)) {
 				Monitor.Pulse (queue);
+			}
 		}
 	}
 
@@ -215,13 +228,14 @@ public class ImageLoaderThread {
 					orig_image = img.Load ();
 				}
 			}
-		} catch (GLib.GException e){
+		} catch (GLib.GException e) {
 			Log.Exception (e);
 			return;
 		}
 
-		if (orig_image == null)
+		if (orig_image == null) {
 			return;
+		}
 
 		request.Result = orig_image;
 	}
@@ -231,20 +245,22 @@ public class ImageLoaderThread {
 
 	private bool InsertRequest (SafeUri uri, int order, int width, int height)
 	{
-        StartWorker ();
+		StartWorker ();
 
 		/* Check if this is the same as the request currently being processed.  */
-		lock(processed_requests) {
-			if (current_request != null && current_request.Uri == uri)
+		lock (processed_requests) {
+			if (current_request != null && current_request.Uri == uri) {
 				return false;
+			}
 		}
 		/* Check if a request for this path has already been queued.  */
 		RequestItem existing_request;
 		if (requests_by_uri.TryGetValue (uri, out existing_request)) {
 			/* FIXME: At least for now, this shouldn't happen.  */
-			if (existing_request.Order != order)
+			if (existing_request.Order != order) {
 				Log.WarningFormat ("BUG: Filing another request of order {0} (previously {1}) for `{2}'",
 						   order, existing_request.Order, uri);
+			}
 
 			queue.Remove (existing_request);
 			queue.Add (existing_request);
@@ -265,7 +281,7 @@ public class ImageLoaderThread {
 	/* The worker thread's main function.  */
 	private void WorkerThread ()
 	{
-        Log.Debug (this.ToString (), "Worker starting");
+		Log.Debug (this.ToString (), "Worker starting");
 		try {
 			while (!should_cancel) {
 				lock (processed_requests) {
@@ -283,11 +299,13 @@ public class ImageLoaderThread {
 
 				lock (queue) {
 
-					while ((queue.Count == 0 || block_count > 0) && !should_cancel)
+					while ((queue.Count == 0 || block_count > 0) && !should_cancel) {
 						Monitor.Wait (queue);
+					}
 
-					if (should_cancel)
+					if (should_cancel) {
 						return;
+					}
 
 					int pos = queue.Count - 1;
 
@@ -306,8 +324,9 @@ public class ImageLoaderThread {
 	protected virtual void EmitLoaded (Queue results)
 	{
 		if (OnPixbufLoaded != null) {
-			foreach (RequestItem r in results)
+			foreach (RequestItem r in results) {
 				OnPixbufLoaded (this, r);
+			}
 		}
 	}
 
@@ -319,7 +338,7 @@ public class ImageLoaderThread {
 		lock (processed_requests) {
 			/* Copy the queued items out of the shared queue so we hold the lock for
 			   as little time as possible.  */
-			results = processed_requests.Clone() as Queue;
+			results = processed_requests.Clone () as Queue;
 			processed_requests.Clear ();
 
 			pending_notify_notified = false;
diff --git a/src/Clients/MainApp/TagPopup.cs b/src/Clients/MainApp/TagPopup.cs
index af9355e..51abf8f 100644
--- a/src/Clients/MainApp/TagPopup.cs
+++ b/src/Clients/MainApp/TagPopup.cs
@@ -32,14 +32,14 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using System;
 using Mono.Unix;
 using FSpot;
 using FSpot.Core;
 using FSpot.Utils;
 
-public class TagPopup {
+public class TagPopup
+{
 	public void Activate (Gdk.EventButton eb, Tag tag, Tag [] tags)
 	{
 		int photo_count = App.Instance.Organizer.SelectedPhotos ().Length;
@@ -54,18 +54,19 @@ public class TagPopup {
                 true
         );
 
-        FSpot.TermMenuItem.Create (tags, popup_menu);
+		FSpot.TermMenuItem.Create (tags, popup_menu);
 
 		GtkUtil.MakeMenuSeparator (popup_menu);
 
 		GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Create New Tag..."), "tag-new",
 				      App.Instance.Organizer.HandleCreateNewCategoryCommand, true);
 
-        GtkUtil.MakeMenuSeparator (popup_menu);
+		GtkUtil.MakeMenuSeparator (popup_menu);
 
 		GtkUtil.MakeMenuItem (popup_menu,
 			Catalog.GetString ("Edit Tag..."), "gtk-edit",
-			delegate { App.Instance.Organizer.HandleEditSelectedTagWithTag (tag); }, tag != null && tags_count == 1);
+			delegate {
+			App.Instance.Organizer.HandleEditSelectedTagWithTag (tag); }, tag != null && tags_count == 1);
 
 		GtkUtil.MakeMenuItem (popup_menu,
 			Catalog.GetPluralString ("Delete Tag", "Delete Tags", tags_count), "gtk-delete",
@@ -89,10 +90,11 @@ public class TagPopup {
 
 		}
 
-		if (eb != null)
+		if (eb != null) {
 			popup_menu.Popup (null, null, null, eb.Button, eb.Time);
-		else
+		} else {
 			popup_menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
+		}
 
 	}
 }
diff --git a/src/Clients/MainApp/ThumbnailCommand.cs b/src/Clients/MainApp/ThumbnailCommand.cs
index 7954c93..ba36a81 100644
--- a/src/Clients/MainApp/ThumbnailCommand.cs
+++ b/src/Clients/MainApp/ThumbnailCommand.cs
@@ -48,7 +48,8 @@ public class ThumbnailCommand {
 	public bool Execute (IPhoto [] photos)
 	{
 		ProgressDialog progress_dialog = null;
-        var loader = ThumbnailLoader.Default;
+		var loader = ThumbnailLoader.Default;
+		
 		if (photos.Length > 1) {
 			progress_dialog = new ProgressDialog (Mono.Unix.Catalog.GetString ("Updating Thumbnails"),
 							      ProgressDialog.CancelButtonType.Stop,
diff --git a/src/Core/FSpot.Bling/FSpot.Bling/Animation.cs b/src/Core/FSpot.Bling/FSpot.Bling/Animation.cs
index 3fe0771..b007ab5 100644
--- a/src/Core/FSpot.Bling/FSpot.Bling/Animation.cs
+++ b/src/Core/FSpot.Bling/FSpot.Bling/Animation.cs
@@ -43,21 +43,18 @@ namespace FSpot.Bling
 			Paused,
 		}
 
-		TimeSpan duration;
 		TimeSpan pausedafter;
 
 		DateTimeOffset starttime;
-		T from;
-		T to;
 		Action<T> action;
 		AnimationState state;
 		GLib.Priority priority = GLib.Priority.DefaultIdle;
 
 		public Animation ()
 		{
-			from = default (T);
-			to = default (T);
-			duration = TimeSpan.Zero;
+			From = default (T);
+			To = default (T);
+			Duration = TimeSpan.Zero;
 			action = null;
 			state = AnimationState.NotRunning;
 		}
@@ -68,9 +65,9 @@ namespace FSpot.Bling
 
 		public Animation (T from, T to, TimeSpan duration, Action<T> action, GLib.Priority priority)
 		{
-			this.from = from;
-			this.to = to;
-			this.duration = duration;
+			From = from;
+			To = to;
+			Duration = duration;
 			this.action = action;
 			this.priority = priority;
 			state = AnimationState.NotRunning;
@@ -113,7 +110,7 @@ namespace FSpot.Bling
 				return;
 			else
 				GLib.Idle.Remove (Handler);
-			action (to);
+			action (To);
 			EventHandler h = Completed;
 			if (h != null)
 				Completed (this, EventArgs.Empty);
@@ -140,11 +137,11 @@ namespace FSpot.Bling
 
 		bool Handler ()
 		{
-			double percentage = (double)(DateTimeOffset.Now - starttime).Ticks / (double)duration.Ticks;
+			double percentage = (double)(DateTimeOffset.Now - starttime).Ticks / (double)Duration.Ticks;
 			EventHandler<ProgressChangedEventArgs> p = ProgressChanged;
 			if (p != null)
 				p (this, new ProgressChangedEventArgs ((int)(100 * percentage), null));
-			action (Interpolate (from, to, Ease (Math.Min (percentage, 1.0))));
+			action (Interpolate (From, To, Ease (Math.Min (percentage, 1.0))));
 			if (percentage >= 1.0) {
 				EventHandler h = Completed;
 				if (h != null)
@@ -171,19 +168,10 @@ namespace FSpot.Bling
 			get { return state == AnimationState.Paused; }
 		}
 
-		public TimeSpan Duration {
-			get { return duration; }
-			set { duration = value; }
-		}
+		public TimeSpan Duration { get; set; }
 
-		public T From {
-			get { return from; }
-			set { from = value; }
-		}
+		public T From { get; set; }
 
-		public T To {
-			get { return to; }
-			set { to = value; }
-		}
+		public T To { get; set; }
 	}
 }
diff --git a/src/Core/FSpot.Bling/FSpot.Bling/EasedAnimation.cs b/src/Core/FSpot.Bling/FSpot.Bling/EasedAnimation.cs
index ef3cd24..dad8e71 100644
--- a/src/Core/FSpot.Bling/FSpot.Bling/EasedAnimation.cs
+++ b/src/Core/FSpot.Bling/FSpot.Bling/EasedAnimation.cs
@@ -33,15 +33,13 @@ namespace FSpot.Bling
 {
 	public abstract class EasedAnimation<T>: Animation<T>
 	{
-		EasingFunction easingFunction;
-
 		public EasedAnimation () : this (null)
 		{
 		}
 
 		public EasedAnimation (EasingFunction easingFunction) : base ()
 		{
-			this.easingFunction = easingFunction;
+			EasingFunction = easingFunction;
 		}
 
 		public EasedAnimation (T from, T to, TimeSpan duration, Action<T> action) : this (from, to, duration, action, null)
@@ -54,24 +52,21 @@ namespace FSpot.Bling
 
 		public EasedAnimation (T from, T to, TimeSpan duration, Action<T> action, EasingFunction easingFunction) : base (from, to, duration, action)
 		{
-			this.easingFunction = easingFunction;
+			EasingFunction = easingFunction;
 		}
 
 		public EasedAnimation (T from, T to, TimeSpan duration, Action<T> action, EasingFunction easingFunction, GLib.Priority priority) : base (from, to, duration, action, priority)
 		{
-			this.easingFunction = easingFunction;
+			EasingFunction = easingFunction;
 		}
 
-		public EasingFunction EasingFunction {
-			get { return easingFunction; }
-			set { easingFunction = value; }
-		}
+		public EasingFunction EasingFunction { get; set; }
 
 		protected override double Ease (double normalizedTime)
 		{
-			if (easingFunction == null)
+			if (EasingFunction == null)
 				return base.Ease (normalizedTime);
-			return easingFunction.Ease (normalizedTime);
+			return EasingFunction.Ease (normalizedTime);
 		}
 
 	}
diff --git a/src/Core/FSpot.Bling/FSpot.Bling/EasingFunction.cs b/src/Core/FSpot.Bling/FSpot.Bling/EasingFunction.cs
index 8a0f430..6a6c422 100644
--- a/src/Core/FSpot.Bling/FSpot.Bling/EasingFunction.cs
+++ b/src/Core/FSpot.Bling/FSpot.Bling/EasingFunction.cs
@@ -33,20 +33,18 @@ namespace FSpot.Bling
 {
 	public abstract class EasingFunction
 	{
-		EasingMode easingMode;
-
 		public EasingFunction () : this (EasingMode.EaseIn)
 		{
 		}
 
 		public EasingFunction (EasingMode easingMode)
 		{
-			this.easingMode = easingMode;
+			EasingMode = easingMode;
 		}
 
 		public double Ease (double normalizedTime)
 		{
-			switch (easingMode) {
+			switch (EasingMode) {
 			case EasingMode.EaseIn:
 				return EaseInCore (normalizedTime);
 			case EasingMode.EaseOut:
@@ -59,10 +57,7 @@ namespace FSpot.Bling
 			throw new InvalidOperationException ("Unknown value for EasingMode");
 		}
 
-		public EasingMode EasingMode {
-			get { return easingMode; }
-			set { easingMode = value; }
-		}
+		public EasingMode EasingMode { get; set; }
 
 		protected abstract double EaseInCore (double normalizedTime);
 	}
diff --git a/src/Core/FSpot.Bling/FSpot.Bling/EasingMode.cs b/src/Core/FSpot.Bling/FSpot.Bling/EasingMode.cs
index 4eb038b..2f88f77 100644
--- a/src/Core/FSpot.Bling/FSpot.Bling/EasingMode.cs
+++ b/src/Core/FSpot.Bling/FSpot.Bling/EasingMode.cs
@@ -35,4 +35,3 @@ namespace FSpot.Bling
 		EaseInOut,
 	}
 }
-
diff --git a/src/Core/FSpot.Cms/Cms/GammaTable.cs b/src/Core/FSpot.Cms/Cms/GammaTable.cs
index 908907f..8d95350 100644
--- a/src/Core/FSpot.Cms/Cms/GammaTable.cs
+++ b/src/Core/FSpot.Cms/Cms/GammaTable.cs
@@ -36,12 +36,7 @@ using System.Runtime.Serialization;
 
 namespace Cms {
 	public class GammaTable : IDisposable {
-		private HandleRef handle;
-		public HandleRef Handle {
-			get {
-				return handle;
-			}
-		}
+		public HandleRef Handle { get; private set; }
 		
 //		internal struct GammaTableStruct {
 //			public int Count;
@@ -50,7 +45,7 @@ namespace Cms {
 
 		public GammaTable (int count, double gamma)
 		{
-			handle = new HandleRef (this, NativeMethods.CmsBuildGamma (count, gamma));
+			Handle = new HandleRef (this, NativeMethods.CmsBuildGamma (count, gamma));
 		}
 
 		/*
@@ -86,7 +81,7 @@ namespace Cms {
 		// FIXME type should be an enum
 		public GammaTable (int entry_count, int type, double [] values)
 		{
-			handle = new HandleRef (this, NativeMethods.CmsBuildParametricGamma (entry_count, type, values));
+			Handle = new HandleRef (this, NativeMethods.CmsBuildParametricGamma (entry_count, type, values));
 		}
 		
 
@@ -96,24 +91,24 @@ namespace Cms {
 
 		public int Count {
 			get {
-				return NativeMethods.FCmsGammaTableGetCount (handle);
+				return NativeMethods.FCmsGammaTableGetCount (Handle);
 			}
 		}
 
 		public IntPtr Values {
 			get {
-				return NativeMethods.FCmsGammaTableGetValues (handle);
+				return NativeMethods.FCmsGammaTableGetValues (Handle);
 			}
 		}
 
 		public ushort this [int index] {
 			get {
 				unsafe {
-					if (handle.Handle == (IntPtr)0)
+					if (Handle.Handle == (IntPtr)0)
 						throw new CmsException ();
 					
 					if (index < 0 || index >= Count)
-						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for {2}", index, Count, handle.Handle));
+						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for {2}", index, Count, Handle.Handle));
 
 					ushort *data = (ushort *)Values;
 					return data [index];
@@ -121,11 +116,11 @@ namespace Cms {
 			}
 			set {
 				unsafe {
-					if (handle.Handle == (IntPtr)0)
+					if (Handle.Handle == (IntPtr)0)
 						throw new CmsException ();
 					
 					if (index < 0 || index >= Count)
-						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for handle {2}", index, Count, handle.Handle));
+						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for handle {2}", index, Count, Handle.Handle));
 
 
 					ushort *data = (ushort *)Values;
@@ -140,7 +135,7 @@ namespace Cms {
 			if (values == null)
 				throw new ArgumentNullException ("values");
 
-			handle = new HandleRef (this, NativeMethods.FCmsGammaTableNew (values, start_offset, length));
+			Handle = new HandleRef (this, NativeMethods.FCmsGammaTableNew (values, start_offset, length));
 			//System.Console.WriteLine ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXhandle = {0}", handle.Handle);
 #else
 			handle = new HandleRef (this, cmsAllocGamma (length));
@@ -152,7 +147,7 @@ namespace Cms {
 
 		protected virtual void Cleanup ()
 		{
-			NativeMethods.CmsFreeGamma (handle);
+			NativeMethods.CmsFreeGamma (Handle);
 		}
 		
 		public void Dispose ()
diff --git a/src/Core/FSpot.Cms/Cms/Profile.cs b/src/Core/FSpot.Cms/Cms/Profile.cs
index 757268b..c469858 100644
--- a/src/Core/FSpot.Cms/Cms/Profile.cs
+++ b/src/Core/FSpot.Cms/Cms/Profile.cs
@@ -43,10 +43,7 @@ namespace Cms {
 			SetErrorAction (ErrorAction.Show);
 		}
 
-		private HandleRef handle;
-		public HandleRef Handle {
-			get { return handle; }
-		}
+		public HandleRef Handle { get; private set; }
 
 		private Profile () : this (NativeMethods.CmsCreateProfilePlaceholder ())
 		{
@@ -173,7 +170,7 @@ namespace Cms {
 
 		public Profile (IccColorSpace color_space, GammaTable [] gamma)
 		{
-			handle = new HandleRef (this, NativeMethods.CmsCreateLinearizationDeviceLink (color_space, CopyHandles (gamma)));
+			Handle = new HandleRef (this, NativeMethods.CmsCreateLinearizationDeviceLink (color_space, CopyHandles (gamma)));
 		}
 
 		private static HandleRef [] CopyHandles (GammaTable [] gamma)
@@ -190,14 +187,14 @@ namespace Cms {
 
 		public Profile (ColorCIExyY whitepoint, ColorCIExyYTriple primaries, GammaTable [] gamma)
 		{
-			handle = new HandleRef (this, NativeMethods.CmsCreateRGBProfile (out whitepoint, out primaries, CopyHandles (gamma)));
+			Handle = new HandleRef (this, NativeMethods.CmsCreateRGBProfile (out whitepoint, out primaries, CopyHandles (gamma)));
 		}
 
-		public Profile (string path) 
+		public Profile (string path)
 		{
-			handle = new HandleRef (this, NativeMethods.CmsOpenProfileFromFile (path, "r"));
+			Handle = new HandleRef (this, NativeMethods.CmsOpenProfileFromFile (path, "r"));
 
-			if (handle.Handle == IntPtr.Zero)
+			if (Handle.Handle == IntPtr.Zero)
 				throw new CmsException ("Error opening ICC profile in file " + path);
 		}
 
@@ -205,10 +202,10 @@ namespace Cms {
 		{
 			unsafe {
 				uint length = 0;
-				if (NativeMethods.CmsSaveProfileToMem (this.Handle, null, ref length)) {
+				if (NativeMethods.CmsSaveProfileToMem (Handle, null, ref length)) {
 					byte [] data = new byte [length];
 					fixed (byte * data_p = &data [0]) {
-						if (NativeMethods.CmsSaveProfileToMem (this.Handle, data_p, ref length)) {
+						if (NativeMethods.CmsSaveProfileToMem (Handle, data_p, ref length)) {
 							return data;
 						}
 					}
@@ -245,14 +242,14 @@ namespace Cms {
 			
 			if (profileh == IntPtr.Zero)
 				throw new CmsException ("Invalid Profile Data");
-			else 
-				this.handle = new HandleRef (this, profileh);
+			else
+				Handle = new HandleRef (this, profileh);
 		}
 
 		public ColorCIEXYZ MediaWhitePoint {
 			get {
 				ColorCIEXYZ wp;
-				if (!NativeMethods.CmsTakeMediaWhitePoint (out wp, handle))
+				if (!NativeMethods.CmsTakeMediaWhitePoint (out wp, Handle))
 					throw new CmsException ("unable to retrieve white point from profile");
 				return wp;
 			}
@@ -261,7 +258,7 @@ namespace Cms {
 		public ColorCIEXYZ MediaBlackPoint {
 			get {
 				ColorCIEXYZ black;
-				if (!NativeMethods.CmsTakeMediaBlackPoint (out black, handle))
+				if (!NativeMethods.CmsTakeMediaBlackPoint (out black, Handle))
 					throw new CmsException ("unable to retrieve white point from profile");
 				
 				return black;
@@ -271,7 +268,7 @@ namespace Cms {
 		public ColorCIEXYZTriple Colorants {
 			get {
 				ColorCIEXYZTriple colors;
-				if (!NativeMethods.CmsTakeColorants (out colors, handle))
+				if (!NativeMethods.CmsTakeColorants (out colors, Handle))
 					throw new CmsException ("Unable to retrieve profile colorants");
 				
 				return colors;
@@ -279,17 +276,17 @@ namespace Cms {
 		}
 		
 		public IccColorSpace ColorSpace {
-			get { return (IccColorSpace) NativeMethods.CmsGetColorSpace (this.handle); }
+			get { return (IccColorSpace) NativeMethods.CmsGetColorSpace (Handle); }
 		}
 
 		public IccProfileClass DeviceClass {
-			get { return (IccProfileClass) NativeMethods.CmsGetDeviceClass (this.handle); }
+			get { return (IccProfileClass) NativeMethods.CmsGetDeviceClass (Handle); }
 		}
 		
 		public string Model {
 			get {
 				lock (srgb) {
-					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeModel (handle));
+					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeModel (Handle));
 				}
 			}
 		}
@@ -297,7 +294,7 @@ namespace Cms {
 		public string ProductName {
 			get {
 				lock (srgb) {
-					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeProductName (handle));
+					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeProductName (Handle));
 				}
 			}
 		}
@@ -305,7 +302,7 @@ namespace Cms {
 		public string ProductDescription {
 			get {
 				lock (srgb) {
-					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeProductDesc (handle));
+					return Marshal.PtrToStringAnsi (NativeMethods.CmsTakeProductDesc (Handle));
 				}
 			}
 		}
@@ -328,7 +325,7 @@ namespace Cms {
 
 		protected Profile (IntPtr handle)
 		{
-			this.handle = new HandleRef (this, handle);
+			Handle = new HandleRef (this, handle);
 		}
 
 		public void Dispose () 
@@ -340,7 +337,7 @@ namespace Cms {
 
 		protected virtual void Cleanup ()
 		{
-			if (NativeMethods.CmsCloseProfile (this.Handle) == 0)
+			if (NativeMethods.CmsCloseProfile (Handle) == 0)
 				throw new CmsException ("Error closing Handle");
 
 		}
diff --git a/src/Core/FSpot.Cms/Cms/Transform.cs b/src/Core/FSpot.Cms/Cms/Transform.cs
index a9c7dff..2ceddc8 100644
--- a/src/Core/FSpot.Cms/Cms/Transform.cs
+++ b/src/Core/FSpot.Cms/Cms/Transform.cs
@@ -36,12 +36,7 @@ using System.Runtime.Serialization;
 
 namespace Cms {
 	public class Transform : IDisposable {
-		private HandleRef handle;
-		public HandleRef Handle {
-			get {
-				return handle;
-			}
-		}
+		public HandleRef Handle { get; private set; }
 
 		public Transform (Profile [] profiles,
 				  Format input_format,
@@ -51,14 +46,14 @@ namespace Cms {
 			if (profiles == null)
 				throw new ArgumentNullException ("profiles");
 
-			HandleRef [] handles = new HandleRef [profiles.Length];
+			HandleRef [] Handles = new HandleRef [profiles.Length];
 			for (int i = 0; i < profiles.Length; i++) {
-				handles [i] = profiles [i].Handle;
+				Handles [i] = profiles [i].Handle;
 			}
 			
-			this.handle = new HandleRef (this, NativeMethods.CmsCreateMultiprofileTransform (handles, handles.Length, 
+			Handle = new HandleRef (this, NativeMethods.CmsCreateMultiprofileTransform (Handles, Handles.Length,
 											   input_format,
-											   output_format, 
+											   output_format,
 											   (int)intent, flags));
 		}
 		
@@ -71,7 +66,7 @@ namespace Cms {
 			if (output == null)
 				throw new ArgumentNullException ("output");
 
-			this.handle = new HandleRef (this, NativeMethods.CmsCreateTransform (input.Handle, input_format,
+			Handle = new HandleRef (this, NativeMethods.CmsCreateTransform (input.Handle, input_format,
 									       output.Handle, output_format,
 									       (int)intent, flags));
 		}
@@ -90,10 +85,10 @@ namespace Cms {
 		
 		protected virtual void Cleanup ()
 		{
-			NativeMethods.CmsDeleteTransform (this.handle);
+			NativeMethods.CmsDeleteTransform (Handle);
 		}
 		
-		~Transform () 
+		~Transform ()
 		{
 			Cleanup ();
 		}	       
diff --git a/src/Core/FSpot.Core/FSpot.Core/BrowsableEventArgs.cs b/src/Core/FSpot.Core/FSpot.Core/BrowsableEventArgs.cs
index 200a719..7df9e43 100644
--- a/src/Core/FSpot.Core/FSpot.Core/BrowsableEventArgs.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/BrowsableEventArgs.cs
@@ -39,10 +39,7 @@ namespace FSpot.Core
 			get { return items; }
 		}
 
-		IBrowsableItemChanges changes;
-		public IBrowsableItemChanges Changes {
-			get { return changes; }
-		}
+		public IBrowsableItemChanges Changes { get; private set; }
 
 		public BrowsableEventArgs (int item, IBrowsableItemChanges changes) : this (new int[] {item}, changes)
 		{
@@ -51,7 +48,7 @@ namespace FSpot.Core
 		public BrowsableEventArgs (int[] items, IBrowsableItemChanges changes)
 		{
 			this.items = items;
-			this.changes = changes;
+			Changes = changes;
 		}
 	}
 }
diff --git a/src/Core/FSpot.Core/FSpot.Core/BrowsablePointerChangedEventArgs.cs b/src/Core/FSpot.Core/FSpot.Core/BrowsablePointerChangedEventArgs.cs
index 78a6600..741dc0d 100644
--- a/src/Core/FSpot.Core/FSpot.Core/BrowsablePointerChangedEventArgs.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/BrowsablePointerChangedEventArgs.cs
@@ -33,26 +33,15 @@ namespace FSpot.Core
 {
 	public class BrowsablePointerChangedEventArgs : System.EventArgs
 	{
-		IPhoto previous_item;
-		public IPhoto PreviousItem {
-			get { return previous_item; }
-		}
-
-		int previous_index;
-		public int PreviousIndex {
-			get { return previous_index; }
-		}
-
-		IBrowsableItemChanges changes;
-		public IBrowsableItemChanges Changes {
-			get { return changes; }
-		}
+		public IPhoto PreviousItem { get; private set; }
+		public int PreviousIndex { get; private set; }
+		public IBrowsableItemChanges Changes { get; private set; }
 
 		public BrowsablePointerChangedEventArgs (IPhoto previous_item, int previous_index, IBrowsableItemChanges changes) : base ()
 		{
-			this.previous_item = previous_item;
-			this.previous_index = previous_index;
-			this.changes = changes;
+			PreviousItem = previous_item;
+			PreviousIndex = previous_index;
+			Changes = changes;
 		}
 	}
 }
diff --git a/src/Core/FSpot.Core/FSpot.Core/DbItem.cs b/src/Core/FSpot.Core/FSpot.Core/DbItem.cs
index f22facc..4e565f3 100644
--- a/src/Core/FSpot.Core/FSpot.Core/DbItem.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/DbItem.cs
@@ -34,13 +34,10 @@ using System;
 namespace FSpot.Core
 {
 	public class DbItem {
-		uint id;
-		public uint Id {
-			get { return id; }
-		}
+		public uint Id { get; private set; }
 
 		protected DbItem (uint id) {
-			this.id = id;
+			Id = id;
 		}
 	}
 
@@ -61,4 +58,4 @@ namespace FSpot.Core
 			this.items = new T [] { item };
 		}
 	}
-}
+}
\ No newline at end of file
diff --git a/src/Core/FSpot.Core/FSpot.Core/Global.cs b/src/Core/FSpot.Core/FSpot.Core/Global.cs
index 91dd785..4e9596d 100644
--- a/src/Core/FSpot.Core/FSpot.Core/Global.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/Global.cs
@@ -48,11 +48,7 @@ namespace FSpot.Core {
 			set { base_dir = value; }
 		}
 
-		private static SafeUri photo_uri;
-		public static SafeUri PhotoUri {
-			get { return photo_uri; }
-			set { photo_uri = value; }
-		}
+		public static SafeUri PhotoUri { get; set; }
 
 		public static string HelpDirectory {
 			get {
@@ -61,17 +57,9 @@ namespace FSpot.Core {
 			}
 		}
 
-		private static Cms.Profile display_profile;
-		public static Cms.Profile DisplayProfile {
-			set { display_profile = value; }
-			get { return display_profile; }
-		}
+		public static Cms.Profile DisplayProfile { get; set; }
 
-		private static Cms.Profile destination_profile;
-		public static Cms.Profile DestinationProfile {
-			set { destination_profile = value; }
-			get { return destination_profile; }
-		}
+		public static Cms.Profile DestinationProfile { get; set; }
 
 		private static Gtk.IconTheme icon_theme;
 		public static Gtk.IconTheme IconTheme {
@@ -94,10 +82,6 @@ namespace FSpot.Core {
 			set { default_rc_files = value; }
 		}
 
-		private static Gtk.PageSetup page_setup;
-		public static Gtk.PageSetup PageSetup {
-			get { return page_setup; }
-			set { page_setup = value; }
-		}
+		public static Gtk.PageSetup PageSetup { get; set; }
 	}
 }
diff --git a/src/Core/FSpot.Core/FSpot.Core/Roll.cs b/src/Core/FSpot.Core/FSpot.Core/Roll.cs
index 1ee5cdb..f99e31a 100644
--- a/src/Core/FSpot.Core/FSpot.Core/Roll.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/Roll.cs
@@ -39,14 +39,11 @@ namespace FSpot.Core
 	public class Roll : DbItem
 	{
 		// The time is always in UTC.
-		private DateTime time;
-		public DateTime Time {
-			get { return time; }
-		}
+		public DateTime Time { get; private set; }
 
 		public Roll (uint id, long unix_time) : base (id)
 		{
-			time = DateTimeUtil.ToDateTime (unix_time);
+			Time = DateTimeUtil.ToDateTime (unix_time);
 		}
 	}
 }
diff --git a/src/Core/FSpot.Core/FSpot.Core/Tag.cs b/src/Core/FSpot.Core/FSpot.Core/Tag.cs
index f9aa4f1..61a6b4d 100644
--- a/src/Core/FSpot.Core/FSpot.Core/Tag.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/Tag.cs
@@ -37,11 +37,7 @@ using Hyena;
 namespace FSpot.Core
 {
 	public class Tag : DbItem, IComparable<Tag>, IDisposable {
-		string name;
-		public string Name {
-			get { return name; }
-			set {  name = value;}
-		}
+		public string Name { get; set; }
 
 		Category category;
 		public Category Category {
@@ -56,11 +52,7 @@ namespace FSpot.Core
 			}
 		}
 
-		int sort_priority;
-		public int SortPriority {
-			get { return sort_priority; }
-			set { sort_priority = value; }
-		}
+		public int SortPriority { get; set; }
 
 		int popularity = 0;
 		public int Popularity {
@@ -70,23 +62,19 @@ namespace FSpot.Core
 
 		// Icon.  If theme_icon_name is not null, then we save the name of the icon instead
 		// of the actual icon data.
-		string theme_icon_name;
-		public string ThemeIconName {
-			get { return theme_icon_name; }
-			set { theme_icon_name = value; }
-		}
+		public string ThemeIconName { get; set; }
 
 		Pixbuf icon;
 		public Pixbuf Icon {
 			get {
-				if (icon == null && theme_icon_name != null) {
+				if (icon == null && ThemeIconName != null) {
 					cached_icon_size = IconSize.Hidden;
-					icon = GtkUtil.TryLoadIcon (Global.IconTheme, theme_icon_name, 48, (Gtk.IconLookupFlags)0);
+					icon = GtkUtil.TryLoadIcon (Global.IconTheme, ThemeIconName, 48, (Gtk.IconLookupFlags)0);
 				}
 				return icon;
 			}
 			set {
-				theme_icon_name = null;
+				ThemeIconName = null;
 				if (icon != null)
 					icon.Dispose ();
 				icon = value;
@@ -124,10 +112,10 @@ namespace FSpot.Core
 					return null;
 				if (tag_icon_size == cached_icon_size)
 					return cached_icon;
-				if (theme_icon_name != null) { //Theme icon
+				if (ThemeIconName != null) { //Theme icon
 					if (cached_icon != null)
 						cached_icon.Dispose ();
-					cached_icon = GtkUtil.TryLoadIcon (Global.IconTheme, theme_icon_name, (int) tag_icon_size, (Gtk.IconLookupFlags)0);
+					cached_icon = GtkUtil.TryLoadIcon (Global.IconTheme, ThemeIconName, (int) tag_icon_size, (Gtk.IconLookupFlags)0);
 
 					if (Math.Max (cached_icon.Width, cached_icon.Height) <= (int) tag_icon_size)
 						return cached_icon;
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/ApplicationActivatedEventArgs.cs b/src/Core/FSpot.Gui/FSpot.Widgets/ApplicationActivatedEventArgs.cs
index c2e8616..4e1d439 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/ApplicationActivatedEventArgs.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/ApplicationActivatedEventArgs.cs
@@ -34,14 +34,11 @@ namespace FSpot.Widgets
 {
 	public class ApplicationActivatedEventArgs : EventArgs
 	{
-		AppInfo app;
-		public AppInfo AppInfo {
-			get { return app; }
-		}
+		public AppInfo AppInfo { get; private set; }
 
 		public ApplicationActivatedEventArgs (AppInfo app) : base ()
 		{
-			this.app = app;
+			AppInfo = app;
 		}
 	}
 }
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/CurveType.cs b/src/Core/FSpot.Gui/FSpot.Widgets/CurveType.cs
index b3f6890..4a1aa2e 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/CurveType.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/CurveType.cs
@@ -35,5 +35,3 @@ namespace FSpot.Widgets
 		Free,
 	}
 }
-
-
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/Layout.cs b/src/Core/FSpot.Gui/FSpot.Widgets/Layout.cs
index 17f6f20..50dab91 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/Layout.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/Layout.cs
@@ -73,28 +73,16 @@ namespace FSpot.Widgets
 		}
 
 		class LayoutChild {
-			Gtk.Widget widget;
-			public Gtk.Widget Widget {
-				get { return widget; }
-			}
-
-			int x;
-			public int X {
-				get { return x; } 
-				set { x = value; }
-			}
+			public Gtk.Widget Widget { get; private set; }
 
-			int y;
-			public int Y {
-				get { return y; }
-				set { y = value; }
-			}
+			public int X { get; set; }
+			public int Y { get; set; }
 
 			public LayoutChild (Gtk.Widget widget, int x, int y)
 			{
-				this.widget = widget;
-				this.x = x;
-				this.y = y;
+				Widget = widget;
+				X = x;
+				Y = y;
 			}
 		}
 
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/MenuButton.cs b/src/Core/FSpot.Gui/FSpot.Widgets/MenuButton.cs
index ea7d212..362aca4 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/MenuButton.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/MenuButton.cs
@@ -34,7 +34,6 @@ namespace FSpot.Widgets
 	public class MenuButton : Button
 	{
 		Label label;
-		Image image;
 		Arrow arrow;
 		Menu popup_menu;
 
@@ -43,9 +42,7 @@ namespace FSpot.Widgets
 			set { label.Text = value; }
 		}
 
-		public new Image Image {
-			get { return image; }
-		}
+		public new Image Image { get; private set; }
 
 		public ArrowType ArrowType {
 			get { return arrow.ArrowType; }
@@ -73,9 +70,9 @@ namespace FSpot.Widgets
 		{
 			HBox hbox = new HBox ();
 			
-			this.image = new Image ();
-			hbox.PackStart (this.image, false, false, 1);
-			image.Show ();
+			Image = new Image ();
+			hbox.PackStart (Image, false, false, 1);
+			Image.Show ();
 
 			this.label = new Label (label);
 			this.label.Xalign = 0;
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/OpenWithMenu.cs b/src/Core/FSpot.Gui/FSpot.Widgets/OpenWithMenu.cs
index c0dcdef..444eeb8 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/OpenWithMenu.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/OpenWithMenu.cs
@@ -121,14 +121,11 @@ namespace FSpot.Widgets {
 
 		private class AppMenuItem : ImageMenuItem
 		{
-			AppInfo app;
-			public AppInfo App {
-				get { return app; }
-			}
+			public AppInfo App { get; private set; }
 
 			public AppMenuItem (AppInfo app, bool show_icon) : base (app.Name)
 			{
-				this.app = app;
+				App = app;
 
 				if (!show_icon)
 					return;
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/ScrolledView.cs b/src/Core/FSpot.Gui/FSpot.Widgets/ScrolledView.cs
index a1aecec..3f4a270 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/ScrolledView.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/ScrolledView.cs
@@ -33,21 +33,21 @@ using FSpot.Utils;
 
 namespace FSpot.Widgets {
 	public class ScrolledView : Fixed {
-		private EventBox ebox;
-		private ScrolledWindow scroll;
 		private DelayedOperation hide;
+		public EventBox ControlBox { get; private set; }
+		public ScrolledWindow ScrolledWindow { get; private set; }
 
 		public ScrolledView (IntPtr raw) : base (raw) {}
 
 		public ScrolledView () : base () {
-			scroll = new ScrolledWindow  (null, null);
-			this.Put (scroll, 0, 0);
-			scroll.Show ();
+			ScrolledWindow = new ScrolledWindow  (null, null);
+			this.Put (ScrolledWindow, 0, 0);
+			ScrolledWindow.Show ();
 			
 			//ebox = new BlendBox ();
-			ebox = new EventBox ();
-			this.Put (ebox, 0, 0);
-			ebox.ShowAll ();
+			ControlBox = new EventBox ();
+			this.Put (ControlBox, 0, 0);
+			ControlBox.ShowAll ();
 			
 			hide = new DelayedOperation (2000, new GLib.IdleHandler (HideControls));
 			this.Destroyed += HandleDestroyed;
@@ -64,15 +64,15 @@ namespace FSpot.Widgets {
 			Gdk.ModifierType type;
 
 			if (!force && IsRealized) {
-				ebox.GdkWindow.GetPointer (out x, out y, out type);
-				if (x < ebox.Allocation.Width && y < ebox.Allocation.Height) {
+				ControlBox.GdkWindow.GetPointer (out x, out y, out type);
+				if (x < ControlBox.Allocation.Width && y < ControlBox.Allocation.Height) {
 					hide.Start ();
 					return true;
 				}
 			}
 
 			hide.Stop ();
-			ebox.Hide ();
+			ControlBox.Hide ();
 			return false;
 		}
 		
@@ -80,7 +80,7 @@ namespace FSpot.Widgets {
 		{
 			hide.Stop ();
 			hide.Start ();
-			ebox.Show ();
+			ControlBox.Show ();
 		}
 
 		private void HandleDestroyed (object sender, System.EventArgs args)
@@ -88,20 +88,9 @@ namespace FSpot.Widgets {
 			hide.Stop ();
 		}
 
-		public EventBox ControlBox {
-			get {
-				return ebox;
-			}
-		}
-		public ScrolledWindow ScrolledWindow {
-			get {
-				return scroll;
-			}
-		}
-
 		protected override void OnSizeAllocated (Gdk.Rectangle allocation)
 		{
-			scroll.SetSizeRequest (allocation.Width, allocation.Height);
+			ScrolledWindow.SetSizeRequest (allocation.Width, allocation.Height);
 			base.OnSizeAllocated (allocation);
 		}
 	}
diff --git a/src/Core/FSpot.Platform/FSpot.Platform/PreferenceBackend.cs b/src/Core/FSpot.Platform/FSpot.Platform/PreferenceBackend.cs
index 2f9fa23..e420b93 100644
--- a/src/Core/FSpot.Platform/FSpot.Platform/PreferenceBackend.cs
+++ b/src/Core/FSpot.Platform/FSpot.Platform/PreferenceBackend.cs
@@ -35,20 +35,13 @@ namespace FSpot
 {
 	public class NotifyEventArgs : System.EventArgs
 	{
-		string key;
-		public string Key {
-			get { return key; }
-		}
-
-		object val;
-		public object Value {
-			get { return val; }
-		}
+		public string Key { get; private set; }
+		public object Value { get; private set; }
 
 		public NotifyEventArgs (string key, object val)
 		{
-			this.key = key;
-			this.val = val;
+			Key = key;
+			Value = val;
 		}
 	}
 }
diff --git a/src/Core/FSpot.Query/FSpot.Query/DateRange.cs b/src/Core/FSpot.Query/FSpot.Query/DateRange.cs
index 4fd0ff2..e77a501 100644
--- a/src/Core/FSpot.Query/FSpot.Query/DateRange.cs
+++ b/src/Core/FSpot.Query/FSpot.Query/DateRange.cs
@@ -33,33 +33,27 @@ using Hyena;
 namespace FSpot.Query {
 	public class DateRange : IQueryCondition
 	{
-		private DateTime start;		
-		public DateTime Start {
-			get { return start; }
-		}
+		public DateTime Start { get; private set; }
 
-		private DateTime end;
-		public DateTime End {
-			get { return end; }
-		}
+		public DateTime End { get; private set; }
 
 		public DateRange (DateTime start, DateTime end)
 		{
-			this.start = start;
-			this.end = end;
+			Start = start;
+			End = end;
 		}
 
 		public DateRange (int year, int month)
 		{
-			start = new DateTime (year, month, 1);
-			end = new DateTime (month < 12 ? year : year + 1, month < 12 ? month + 1 : 1, 1);
+			Start = new DateTime (year, month, 1);
+			End = new DateTime (month < 12 ? year : year + 1, month < 12 ? month + 1 : 1, 1);
 		}
 
 		public string SqlClause ()
 		{
 			return String.Format (" photos.time >= {0} AND photos.time <= {1} ", 
-					DateTimeUtil.FromDateTime (start),
-					DateTimeUtil.FromDateTime (end));
+					DateTimeUtil.FromDateTime (Start),
+					DateTimeUtil.FromDateTime (End));
 		}
 	}
 }
diff --git a/src/Core/FSpot.Query/FSpot.Query/LogicalTerm.cs b/src/Core/FSpot.Query/FSpot.Query/LogicalTerm.cs
index bdda5cd..3c4e5d6 100644
--- a/src/Core/FSpot.Query/FSpot.Query/LogicalTerm.cs
+++ b/src/Core/FSpot.Query/FSpot.Query/LogicalTerm.cs
@@ -41,14 +41,11 @@ namespace FSpot.Query
 
 	public class TagTerm : LogicalTerm, IDisposable
 	{
-		Tag tag;
-		public Tag Tag {
-			get { return tag; }
-		}
+		public Tag Tag { get; private set; }
 
 		public TagTerm (Tag tag)
 		{
-			this.tag = tag;
+			Tag = tag;
 		}
 
 		public override string SqlClause ()
@@ -76,35 +73,29 @@ namespace FSpot.Query
 
 		public void Dispose ()
 		{
-			if (tag != null)
-				tag.Dispose ();
+			if (Tag != null)
+				Tag.Dispose ();
 			System.GC.SuppressFinalize (this);
 		}
 
 		~TagTerm ()
 		{
 			Log.DebugFormat ("Finalizer called on {0}. Should be Disposed", GetType ());
-			if (tag != null)
-				tag.Dispose ();
+			if (Tag != null)
+				Tag.Dispose ();
 		}
 	}
 
 	public class TextTerm : LogicalTerm
 	{
-		string text;
-		public string Text {
-			get { return text; }
-		}
+		public string Text { get; private set; }
 
-		string field;
-		public string Field {
-			get { return field;  }
-		}
+		public string Field { get; private set; }
 
 		public TextTerm (string text, string field)
 		{
-			this.text = text;
-			this.field = field;
+			Text = text;
+			Field = field;
 		}
 
 		public static OrTerm SearchMultiple (string text, params string[] fields)
@@ -117,25 +108,22 @@ namespace FSpot.Query
 
 		public override string SqlClause ()
 		{
-			return String.Format (" {0} LIKE %{1}% ", field, text);
+			return String.Format (" {0} LIKE %{1}% ", Field, Text);
 		}
 	}
 
 	public class NotTerm : LogicalTerm
 	{
-		LogicalTerm term;
-		public LogicalTerm Term {
-			get { return term; }
-		}
+		public LogicalTerm Term { get; private set; }
 
 		public NotTerm (LogicalTerm term)
 		{
-			this.term = term;
+			Term = term;
 		}
 
 		public override string SqlClause ()
 		{
-			return String.Format (" NOT ({0}) ", term.SqlClause ());
+			return String.Format (" NOT ({0}) ", Term.SqlClause ());
 		}
 	}
 
diff --git a/src/Core/FSpot.Query/FSpot.Query/OrderByTime.cs b/src/Core/FSpot.Query/FSpot.Query/OrderByTime.cs
index 967b7c1..e3e4071 100644
--- a/src/Core/FSpot.Query/FSpot.Query/OrderByTime.cs
+++ b/src/Core/FSpot.Query/FSpot.Query/OrderByTime.cs
@@ -35,20 +35,17 @@ namespace FSpot.Query {
 		public static OrderByTime OrderByTimeAsc = new OrderByTime (true);
 		public static OrderByTime OrderByTimeDesc = new OrderByTime (false);
 
-		bool asc;
-		public bool Asc {
-			get { return asc; }
-		}
+		public bool Asc { get; private set; }
 
 		public OrderByTime (bool asc)
 		{
-			this.asc = asc;
+			Asc = asc;
 		}
 
 		public string SqlClause ()
 		{
 			// filenames must always appear in alphabetical order if times are the same
-			return String.Format (" time {0}, filename ASC ", asc ? "ASC" : "DESC");
+			return String.Format (" time {0}, filename ASC ", Asc ? "ASC" : "DESC");
 		}
 	}
 }
diff --git a/src/Core/FSpot.Query/FSpot.Query/RatingRange.cs b/src/Core/FSpot.Query/FSpot.Query/RatingRange.cs
index e0c7ec6..f92608a 100644
--- a/src/Core/FSpot.Query/FSpot.Query/RatingRange.cs
+++ b/src/Core/FSpot.Query/FSpot.Query/RatingRange.cs
@@ -33,33 +33,24 @@ namespace FSpot.Query
 {
 	public class RatingRange : IQueryCondition
 	{
-		private uint minRating;		
-		public uint MinRating {
-			get { return minRating; }
-			set { minRating = value; }
-		}
-
-		private uint maxRating;		
-		public uint MaxRating {
-			get { return maxRating; }
-			set { maxRating = value; }
-		}
+		public uint MinRating { get; private set; }
+		public uint MaxRating { get; private set; }
 
 		public RatingRange (uint min_rating)
 		{
-			this.minRating = min_rating;
-			this.maxRating = System.UInt32.MaxValue;
+			MinRating = min_rating;
+			MaxRating = System.UInt32.MaxValue;
 		}
 
 		public RatingRange (uint min_rating, uint max_rating)
 		{
-			this.minRating = min_rating;
-			this.maxRating = max_rating;
+			MinRating = min_rating;
+			MaxRating = max_rating;
 		}
 
 		public string SqlClause ()
 		{
-			return String.Format (" photos.rating >= {0} AND photos.rating <= {1} ", minRating, maxRating);
+			return String.Format (" photos.rating >= {0} AND photos.rating <= {1} ", MinRating, MaxRating);
 		}
 	}
 }
diff --git a/src/Core/FSpot.Utils/FSpot.Utils/GdkUtils.cs b/src/Core/FSpot.Utils/FSpot.Utils/GdkUtils.cs
index bb3691a..7804bac 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils/GdkUtils.cs
+++ b/src/Core/FSpot.Utils/FSpot.Utils/GdkUtils.cs
@@ -73,7 +73,8 @@ namespace FSpot.Utils {
 	
 			[DllImport("libgdk-2.0-0.dll")]
 			public static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr d);
-	
+
+			// FIXME: get rid of this? (Make this cross platform)
 			[DllImport("X11")]
 			public static extern uint XVisualIDFromVisual(IntPtr visual);
 	
diff --git a/src/Core/FSpot.Utils/FSpot.Utils/RecursiveFileEnumerator.cs b/src/Core/FSpot.Utils/FSpot.Utils/RecursiveFileEnumerator.cs
index d85793b..de02098 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils/RecursiveFileEnumerator.cs
+++ b/src/Core/FSpot.Utils/FSpot.Utils/RecursiveFileEnumerator.cs
@@ -47,9 +47,9 @@ namespace FSpot.Utils
         public RecursiveFileEnumerator (string root)
         {
             this.root = root;
-            this.Recurse = true;
-            this.CatchErrors = false;
-            this.IgnoreSymlinks = false;
+            Recurse = true;
+            CatchErrors = false;
+            IgnoreSymlinks = false;
         }
 
         IEnumerable<File> ScanForFiles (File root)
diff --git a/src/Core/FSpot.Utils/FSpot.Utils/SafeUriExtensions.cs b/src/Core/FSpot.Utils/FSpot.Utils/SafeUriExtensions.cs
index 599004c..9eb73cc 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils/SafeUriExtensions.cs
+++ b/src/Core/FSpot.Utils/FSpot.Utils/SafeUriExtensions.cs
@@ -67,7 +67,6 @@ namespace FSpot
 
         public static SafeUri ReplaceExtension (this SafeUri uri, string extension)
         {
-
             return uri.GetBaseUri ().Append (uri.GetFilenameWithoutExtension () + extension);
         }
     }



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