[f-spot] Removed DbUtil utility methods in favor of Hyena DateTimeUtil.



commit 3aecadcd17ee75ced5a2422ee402c230c47de0a0
Author: Evan Briones <erbriones gmail com>
Date:   Thu Jul 1 14:55:25 2010 -0700

    Removed DbUtil utility methods in favor of Hyena DateTimeUtil.
    
    Also fixed a missing constructor exception in CellRendererTextProgress.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623327

 src/Core/Photo.cs                       |    2 +-
 src/Core/Roll.cs                        |    4 +-
 src/JobStore.cs                         |    6 ++--
 src/Jobs/CalculateHashJob.cs            |    3 +-
 src/Jobs/SyncMetadataJob.cs             |    3 +-
 src/PhotoStore.cs                       |   12 ++++----
 src/Query/DateRange.cs                  |    6 ++--
 src/RollStore.cs                        |    4 +-
 src/Updater.cs                          |    2 +-
 src/Utils/DbUtils.cs                    |   40 -------------------------------
 src/Utils/Makefile.am                   |    1 -
 src/Widgets/CellRendererTextProgress.cs |    3 ++
 12 files changed, 23 insertions(+), 63 deletions(-)
---
diff --git a/src/Core/Photo.cs b/src/Core/Photo.cs
index b5e72c2..7c1784b 100644
--- a/src/Core/Photo.cs
+++ b/src/Core/Photo.cs
@@ -514,7 +514,7 @@ namespace FSpot
 		public Photo (uint id, long unix_time)
 			: base (id)
 		{
-			time = DbUtils.DateTimeFromUnixTime (unix_time);
+			time = DateTimeUtil.ToDateTime (unix_time);
 	
 			description = String.Empty;
 			rating = 0;
diff --git a/src/Core/Roll.cs b/src/Core/Roll.cs
index ad13da3..3cc02b2 100644
--- a/src/Core/Roll.cs
+++ b/src/Core/Roll.cs
@@ -9,7 +9,7 @@
  */
 
 using System;
-using FSpot.Utils;
+using Hyena;
 
 namespace FSpot
 {
@@ -23,7 +23,7 @@ namespace FSpot
 	
 		public Roll (uint id, long unix_time) : base (id)
 		{
-			time = DbUtils.DateTimeFromUnixTime (unix_time);
+			time = DateTimeUtil.ToDateTime (unix_time);
 		}
 	}
 }
diff --git a/src/JobStore.cs b/src/JobStore.cs
index 868ff9b..e1dcd25 100644
--- a/src/JobStore.cs
+++ b/src/JobStore.cs
@@ -15,8 +15,8 @@ using System;
 using Banshee.Database;
 using Banshee.Kernel;
 using FSpot.Jobs;
-using FSpot.Utils;
 using FSpot;
+using Hyena;
 
 public abstract class Job : DbItem, IJob
 {
@@ -146,7 +146,7 @@ public class JobStore : DbStore<Job> {
 			id = Database.Execute (new DbCommand ("INSERT INTO jobs (job_type, job_options, run_at, job_priority) VALUES (:job_type, :job_options, :run_at, :job_priority)",
 						"job_type", job_type.ToString (), 
 						"job_options", job_options, 
-						"run_at", DbUtils.UnixTimeFromDateTime (run_at),
+						"run_at", DateTimeUtil.FromDateTime (run_at),
 						"job_priority", Convert.ToInt32 (job_priority)));
 		
                 Job job = (Job) Activator.CreateInstance (job_type, (uint)id, job_options, run_at, job_priority, true);
@@ -171,7 +171,7 @@ public class JobStore : DbStore<Job> {
 									"WHERE id = :item_id", 
 									"job_type", "Empty", //FIXME
 									"job_options", item.JobOptions,
-									"run_at", DbUtils.UnixTimeFromDateTime (item.RunAt),
+									"run_at", DateTimeUtil.FromDateTime (item.RunAt),
 									"job_priority", item.JobPriority));
 		
 		EmitChanged (item);
diff --git a/src/Jobs/CalculateHashJob.cs b/src/Jobs/CalculateHashJob.cs
index d2a9007..55f449c 100644
--- a/src/Jobs/CalculateHashJob.cs
+++ b/src/Jobs/CalculateHashJob.cs
@@ -9,14 +9,13 @@
 
 using System;
 using Banshee.Kernel;
-using FSpot.Utils;
 using Hyena;
 
 namespace FSpot.Jobs {
 	public class CalculateHashJob : Job
 	{
 		public CalculateHashJob (uint id, string job_options, int run_at, JobPriority job_priority, bool persistent) 
-			: this (id, job_options, DbUtils.DateTimeFromUnixTime (run_at), job_priority, persistent)
+			: this (id, job_options, DateTimeUtil.ToDateTime (run_at), job_priority, persistent)
 		{
 		}
 
diff --git a/src/Jobs/SyncMetadataJob.cs b/src/Jobs/SyncMetadataJob.cs
index 0ecda15..e4d2ec6 100644
--- a/src/Jobs/SyncMetadataJob.cs
+++ b/src/Jobs/SyncMetadataJob.cs
@@ -9,13 +9,12 @@
 
 using System;
 using Banshee.Kernel;
-using FSpot.Utils;
 using Hyena;
 
 namespace FSpot.Jobs {
 	public class SyncMetadataJob : Job
 	{
-		public SyncMetadataJob (uint id, string job_options, int run_at, JobPriority job_priority, bool persistent) : this (id, job_options, DbUtils.DateTimeFromUnixTime (run_at), job_priority, persistent)
+		public SyncMetadataJob (uint id, string job_options, int run_at, JobPriority job_priority, bool persistent) : this (id, job_options, DateTimeUtil.ToDateTime (run_at), job_priority, persistent)
 		{
 		}
 
diff --git a/src/PhotoStore.cs b/src/PhotoStore.cs
index f44d26d..6f82f6d 100644
--- a/src/PhotoStore.cs
+++ b/src/PhotoStore.cs
@@ -126,7 +126,7 @@ public class PhotoStore : DbStore<Photo> {
 					time = item.Time;
 				}
 
-				if (reader["time"].ToString () == DbUtils.UnixTimeFromDateTime (time.Value).ToString ()) {
+				if (reader["time"].ToString () == DateTimeUtil.FromDateTime (time.Value).ToString ()) {
 					Log.Debug ("Skipping duplicate", uri);
 					
 					// Schedule a hash calculation job on the existing file.
@@ -145,7 +145,7 @@ public class PhotoStore : DbStore<Photo> {
 	{
 		Photo photo;
 
-		long unix_time = DbUtils.UnixTimeFromDateTime (item.Time);
+		long unix_time = DateTimeUtil.FromDateTime (item.Time);
 		string description = item.Description;
 
 		uint id = (uint) Database.Execute (
@@ -437,7 +437,7 @@ public class PhotoStore : DbStore<Photo> {
 					"WHERE id = :id ",
 					"description", photo.Description,
 					"default_version_id", photo.DefaultVersionId,
-					"time", DbUtils.UnixTimeFromDateTime (photo.Time),
+					"time", DateTimeUtil.FromDateTime (photo.Time),
 					"base_uri", photo.VersionUri (Photo.OriginalVersionId).GetBaseUri ().ToString (),
 					"filename", photo.VersionUri (Photo.OriginalVersionId).GetFilename (),
 					"rating", String.Format ("{0}", photo.Rating),
@@ -552,7 +552,7 @@ public class PhotoStore : DbStore<Photo> {
 	{
 		string query = String.Format ("SELECT ROWID AS row_id FROM {0} WHERE time {2} {1} ORDER BY time {3} LIMIT 1",
 				table_name,
-				DbUtils.UnixTimeFromDateTime (time),
+				DateTimeUtil.FromDateTime (time),
 				asc ? ">=" : "<=",
 				asc ? "ASC" : "DESC");
 		return IndexOf (query);
@@ -864,8 +864,8 @@ public class PhotoStore : DbStore<Photo> {
 		
 		if (range != null) {
 			where_clauses.Add (String.Format ("time >= {0} AND time <= {1}",
-							  DbUtils.UnixTimeFromDateTime (range.Start), 
-							  DbUtils.UnixTimeFromDateTime (range.End)));
+							  DateTimeUtil.FromDateTime (range.Start),
+							  DateTimeUtil.FromDateTime (range.End)));
 
 		}
 
diff --git a/src/Query/DateRange.cs b/src/Query/DateRange.cs
index ee8e3c5..0e98fbf 100644
--- a/src/Query/DateRange.cs
+++ b/src/Query/DateRange.cs
@@ -9,7 +9,7 @@
  */
 
 using System;
-using FSpot.Utils;
+using Hyena;
 
 namespace FSpot.Query {
 	public class DateRange : IQueryCondition
@@ -39,8 +39,8 @@ namespace FSpot.Query {
 		public string SqlClause ()
 		{
 			return String.Format (" photos.time >= {0} AND photos.time <= {1} ", 
-					DbUtils.UnixTimeFromDateTime (start), 
-					DbUtils.UnixTimeFromDateTime (end));
+					DateTimeUtil.FromDateTime (start),
+					DateTimeUtil.FromDateTime (end));
 		}
 	}
 }
diff --git a/src/RollStore.cs b/src/RollStore.cs
index b417285..25bc89d 100644
--- a/src/RollStore.cs
+++ b/src/RollStore.cs
@@ -14,8 +14,8 @@ using System.Collections;
 using System.IO;
 using System;
 using Banshee.Database;
-using FSpot.Utils;
 using FSpot;
+using Hyena;
 
 public class RollStore : DbStore<Roll>
 {
@@ -33,7 +33,7 @@ public class RollStore : DbStore<Roll>
 
 	public Roll Create (DateTime time_in_utc)
 	{
-		long unix_time = DbUtils.UnixTimeFromDateTime (time_in_utc);
+		long unix_time = DateTimeUtil.FromDateTime (time_in_utc);
 		uint id = (uint) Database.Execute (new DbCommand ("INSERT INTO rolls (time) VALUES (:time)", "time", unix_time));
 
 		Roll roll = new Roll (id, unix_time);
diff --git a/src/Updater.cs b/src/Updater.cs
index 24e3703..26ce6e5 100644
--- a/src/Updater.cs
+++ b/src/Updater.cs
@@ -331,7 +331,7 @@ namespace FSpot.Database {
 							 "SELECT '{0}', id, {1}, {2} " +
 							 "FROM   photos ",
 							 typeof(Jobs.CalculateHashJob).ToString (),
-							 FSpot.Utils.DbUtils.UnixTimeFromDateTime (DateTime.Now),
+							 DateTimeUtil.FromDateTime (DateTime.Now),
 							 0
 							)
 				 );
diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am
index 7ea4608..aead04c 100644
--- a/src/Utils/Makefile.am
+++ b/src/Utils/Makefile.am
@@ -6,7 +6,6 @@ SOURCES = \
 	Cache.cs \
 	CairoUtils.cs \
 	ConsoleCrayon.cs \
-	DbUtils.cs \
 	FileExtensions.cs \
 	GdkUtils.cs \
 	GtkUtil.cs \
diff --git a/src/Widgets/CellRendererTextProgress.cs b/src/Widgets/CellRendererTextProgress.cs
index a9bfc17..24f6bbb 100644
--- a/src/Widgets/CellRendererTextProgress.cs
+++ b/src/Widgets/CellRendererTextProgress.cs
@@ -53,6 +53,9 @@ namespace FSpot.Widgets
 			Xpad = Ypad = 2;
 		}
 		
+		protected CellRendererTextProgress (IntPtr ptr) : base (ptr)
+		{
+		}
 		
 		int progress_value;
 		



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