[f-spot] Disable DBusService for now.



commit c17aad22d21a9b2fb88afc274f1d2758afab51d2
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sat Jun 5 22:38:29 2010 +0200

    Disable DBusService for now.
    
    DBus support should be baked into the core. Tried to fix it but it's
    just wrong. If anyone actually uses this, he/she should step up and let
    us know what is actually needed.

 configure.ac                                 |    1 -
 extensions/Services/DBusService/DBusProxy.cs |   67 ++++----------------------
 extensions/Services/Makefile.am              |    4 +-
 3 files changed, 11 insertions(+), 61 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 78d2e79..7b4f3fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -374,7 +374,6 @@ extensions/Exporters/PicasaWebExport/Makefile
 extensions/Exporters/PicasaWebExport/google-sharp/Makefile
 extensions/Exporters/ZipExport/Makefile
 extensions/Services/Makefile
-extensions/Services/DBusService/Makefile
 extensions/Tools/Makefile
 extensions/Tools/RawPlusJpeg/Makefile
 extensions/Tools/ChangePhotoPath/Makefile
diff --git a/extensions/Services/DBusService/DBusProxy.cs b/extensions/Services/DBusService/DBusProxy.cs
index 6604414..a87408a 100644
--- a/extensions/Services/DBusService/DBusProxy.cs
+++ b/extensions/Services/DBusService/DBusProxy.cs
@@ -7,6 +7,7 @@ using Hyena;
 using FSpot;
 using FSpot.Query;
 using FSpot.Utils;
+using FSpot.Import;
 using NDesk.DBus;
 
 namespace DBusService {
@@ -264,10 +265,6 @@ namespace DBusService {
 		// get all
 		uint[] GetPhotoIds ();
 
-		// import prepare
-		void PrepareRoll ();
-		void FinishRoll ();
-
 		// import
 		int ImportPhoto (string path, bool copy, string []tags);
 
@@ -393,61 +390,15 @@ namespace DBusService {
 			return tag_list;
 		}
 
-		public void PrepareRoll ()
-		{
-			if (current_roll != null)
-				return;
-
-			current_roll = db.Rolls.Create ();
-		}
-
-		public void FinishRoll ()
-		{
-			current_roll = null;
-		}
-
-		public int ImportPhoto (string path, bool copy, string []tags)
+		public void ImportPhoto (string path, bool copy, string [] tags)
 		{
-			if (current_roll == null)
-				throw new DBusException ("You must use PrepareRoll before you can import a photo.");
-
-			// add tags that exist in tag store
-			List<Tag> tag_list = GetTagsByNames (tags);
-
-			// FIXME: this is more or less a copy of the file import backend code
-			// this should be streamlined
-			try {
-				string new_path = path;
-
-				if (copy)
-					new_path = FileImportBackend.ChooseLocation (new SafeUri (path)).AbsolutePath;
-
-				if (new_path != path)
-					System.IO.File.Copy (path, new_path);
-
-				Photo created = db.Photos.CreateOverDBus (new_path, path, current_roll.Id);
-
-				try {
-					File.SetAttributes (new_path, File.GetAttributes (new_path) & ~FileAttributes.ReadOnly);
-					DateTime create = File.GetCreationTime (path);
-					File.SetCreationTime (new_path, create);
-					DateTime mod = File.GetLastWriteTime (path);
-					File.SetLastWriteTime (new_path, mod);
-				} catch (IOException) {
-					// we don't want an exception here to be fatal.
-				}
-
-				// attach tags we got
-				if (tag_list.Count > 0) {
-					created.AddTag (tag_list.ToArray ());
-					db.Photos.Commit (created);
-				}
-
-				return (int)created.Id;
-			// indicate failure
-			} catch {
-				throw new DBusException ("Failed to import the photo.");
-			}
+			var controller = new ImportController ();
+            var uri = new SafeUri (path);
+            var source = new FileImportSource (uri, String.Empty, String.Empty);
+			controller.ActiveSource = source;
+			controller.CopyFiles = copy;
+            controller.AttachTags (tags);
+            controller.StartImport ();
 		}
 
 		public void RemovePhoto (uint id)
diff --git a/extensions/Services/Makefile.am b/extensions/Services/Makefile.am
index a6f990e..7d61595 100644
--- a/extensions/Services/Makefile.am
+++ b/extensions/Services/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = 			\
-	DBusService
+#SUBDIRS = 			\
+#	DBusService



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