[f-spot] Bug 578528 – Add date query D-Bus method



commit dbbf60b42a0220516948015160cf6dd271ee1146
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Apr 27 18:08:00 2009 +0100

    Bug 578528 â?? Add date query D-Bus method
    
    The QueryByDate method takes two longs, interpreted as Unix timestamps for the
    start and end of a date range. Patch reviewed by Stephane Delcroix.
---
 extensions/Services/DBusService/DBusProxy.cs |   17 +++++++++++++++++
 extensions/Services/DBusService/Makefile.am  |    1 +
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/extensions/Services/DBusService/DBusProxy.cs b/extensions/Services/DBusService/DBusProxy.cs
index 6fd727e..3677199 100644
--- a/extensions/Services/DBusService/DBusProxy.cs
+++ b/extensions/Services/DBusService/DBusProxy.cs
@@ -4,6 +4,8 @@ using System.IO;
 using System.Text;
 
 using FSpot;
+using FSpot.Query;
+using FSpot.Utils;
 using NDesk.DBus;
 
 namespace DBusService {
@@ -276,6 +278,7 @@ namespace DBusService {
 
 		// query
 		uint[] Query (string []tags);
+		uint[] QueryByDate (long start_time, long end_time);
 
 		// events
 		event RemoteUp RemoteUp;
@@ -353,6 +356,20 @@ namespace DBusService {
 			return ids;
 		}
 
+		public uint[] QueryByDate (long start_time, long end_time)
+		{
+			DateTime start = DbUtils.DateTimeFromUnixTime (start_time);
+			DateTime end = DbUtils.DateTimeFromUnixTime (end_time);
+
+			Photo []photos = db.Photos.Query (new DateRange (start, end));
+			uint []ids = new uint[photos.Length];
+
+			for (int i = 0; i < ids.Length; i++)
+				ids[i] = photos[i].Id;
+
+			return ids;
+		}
+
 		protected Photo[] QueryAll ()
 		{
 			return db.Photos.Query ((Tag [])null);
diff --git a/extensions/Services/DBusService/Makefile.am b/extensions/Services/DBusService/Makefile.am
index 7373632..4be1441 100644
--- a/extensions/Services/DBusService/Makefile.am
+++ b/extensions/Services/DBusService/Makefile.am
@@ -16,6 +16,7 @@ REFS =					\
 	-r:$(top_builddir)/src/f-spot.exe		\
 	-r:$(top_builddir)/src/FSpot.Core.dll	\
 	-r:$(top_builddir)/src/FSpot.Utils.dll	\
+	-r:$(top_builddir)/src/FSpot.Query.dll	\
 	$(LINK_DBUS)
 
 PKGS =



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