f-spot r4514 - in branches/FSPOT_0_5_0_STABLE: . extensions/Tools extensions/Tools/HashJob



Author: sdelcroix
Date: Fri Oct 17 19:02:54 2008
New Revision: 4514
URL: http://svn.gnome.org/viewvc/f-spot?rev=4514&view=rev

Log:
2008-10-17  Stephane Delcroix  <sdelcroix novell com>

	* HashJob/: new HashJob extension

Added:
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/.gitignore
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.addin.xml
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.cs
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/Makefile.am
Modified:
   branches/FSPOT_0_5_0_STABLE/configure.in
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/ChangeLog
   branches/FSPOT_0_5_0_STABLE/extensions/Tools/Makefile.am

Modified: branches/FSPOT_0_5_0_STABLE/configure.in
==============================================================================
--- branches/FSPOT_0_5_0_STABLE/configure.in	(original)
+++ branches/FSPOT_0_5_0_STABLE/configure.in	Fri Oct 17 19:02:54 2008
@@ -387,6 +387,7 @@
 extensions/Tools/Makefile
 extensions/Tools/RawPlusJpeg/Makefile
 extensions/Tools/ChangePhotoPath/Makefile
+extensions/Tools/HashJob/Makefile
 extensions/Tools/DevelopInUFraw/Makefile
 extensions/Tools/MergeDb/Makefile
 f-spot.pc

Added: branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/.gitignore
==============================================================================
--- (empty file)
+++ branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/.gitignore	Fri Oct 17 19:02:54 2008
@@ -0,0 +1 @@
+/*.dll

Added: branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.addin.xml
==============================================================================
--- (empty file)
+++ branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.addin.xml	Fri Oct 17 19:02:54 2008
@@ -0,0 +1,15 @@
+<Addin namespace="FSpot"
+	id="HashJob"
+	version="0.5.0.0"
+	description="Process your photo collection for duplicate detection"
+	author="Stephane Delcroix"
+	url="http://f-spot.org/Extensions";
+	name="Hash for Duplicates"
+	category="Tools">
+	<Dependencies>
+		<Addin id="Core" version="0.5.0.0"/>
+	</Dependencies>
+	<Extension path = "/FSpot/Menus/Tools">
+		<Command id = "HashDupes" _label = "Hash for Duplicates" command_type = "HashJobExtension.HashJob" />
+	</Extension>
+</Addin>

Added: branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.cs
==============================================================================
--- (empty file)
+++ branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/HashJob.cs	Fri Oct 17 19:02:54 2008
@@ -0,0 +1,83 @@
+/*
+ * HashJob.cs
+ *
+ * Author(s)
+ * 	Stephane Delcroix  <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details
+ */
+
+using System;
+using System.Collections.Generic;
+using Mono.Unix;
+using Mono.Data.SqliteClient;
+
+using Gtk;
+
+using FSpot;
+using FSpot.UI.Dialog;
+using FSpot.Extensions;
+using FSpot.Jobs;
+
+namespace HashJobExtension {
+
+	public class HashJob : ICommand {
+		public void Run (object o, EventArgs e) {
+			HashJobDialog dialog = new HashJobDialog ();  
+			dialog.ShowDialog ();
+
+		}
+	}
+
+	public class HashJobDialog : Dialog 
+	{
+
+		public void ShowDialog ()
+		{ 			
+			VBox.Spacing = 6;
+			Label l = new Label ("In order to detect duplicates on pictures you imported before f-spot 0.5.0, f-spot need to analyze your image collection. This is is not done by default as it's time consuming. You can Start or Pause this update process using this dialog."); 
+			l.LineWrap = true;
+			VBox.PackStart (l);
+
+			Button execute = new Button (Stock.Execute);
+			execute.Clicked += HandleExecuteClicked;
+			VBox.PackStart (execute);
+
+			Button stop = new Button (Stock.Stop);
+			stop.Clicked += HandleStopClicked;
+			VBox.PackStart (stop);
+
+			this.AddButton ("_Close", ResponseType.Close);
+			this.Response += HandleResponse;
+
+			ShowAll ();
+
+		}
+
+		void HandleResponse (object obj, ResponseArgs args)
+	        {
+			switch(args.ResponseId)
+			{
+				case ResponseType.Close:
+					this.Destroy ();
+					break;
+			}
+	        }
+
+		void HandleExecuteClicked (object o, EventArgs e)
+		{
+			SqliteDataReader reader = FSpot.Core.Database.Database.Query ("SELECT id from photos WHERE md5_sum IS NULL");
+			FSpot.Core.Database.Database.BeginTransaction ();
+			while (reader.Read ())
+				FSpot.Jobs.CalculateHashJob.Create (FSpot.Core.Database.Jobs, Convert.ToUInt32 (reader[0]));
+			reader.Close ();
+			FSpot.Core.Database.Database.CommitTransaction ();
+		}
+
+		void HandleStopClicked (object o, EventArgs e)
+		{
+			FSpot.Core.Database.Database.ExecuteNonQuery (String.Format ("DELETE FROM jobs WHERE job_type = '{0}'", typeof(FSpot.Jobs.CalculateHashJob).ToString ()));
+		}
+	}
+
+}

Added: branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/Makefile.am
==============================================================================
--- (empty file)
+++ branches/FSPOT_0_5_0_STABLE/extensions/Tools/HashJob/Makefile.am	Fri Oct 17 19:02:54 2008
@@ -0,0 +1,46 @@
+include $(top_srcdir)/Makefile.include
+
+PLUGIN_NAME = HashJob
+
+PLUGIN_MANIFEST = $(PLUGIN_NAME).addin.xml
+
+PLUGIN_ASSEMBLY = $(PLUGIN_NAME).dll
+
+PLUGIN_SOURCES =			\
+	$(srcdir)/HashJob.cs
+
+REFS =					\
+	-r:Mono.Posix			\
+	-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	\
+	-r:Mono.Data.SqliteClient
+
+PKGS =					\
+	-pkg:gtk-sharp-2.0
+
+RESOURCES =				\
+	-resource:$(srcdir)/$(PLUGIN_MANIFEST)
+
+all: $(PLUGIN_ASSEMBLY)
+
+mpack: $(PLUGIN_ASSEMBLY)
+	mautil p $(PLUGIN_ASSEMBLY)
+
+$(PLUGIN_ASSEMBLY): $(PLUGIN_SOURCES) $(PLUGIN_MANIFEST)
+	$(CSC_LIB) -out:$@ $(PLUGIN_SOURCES) $(REFS) $(PKGS) $(ASSEMBLIES) $(RESOURCES)
+
+plugindir = $(pkglibdir)/extensions
+
+plugin_DATA =			\
+	$(PLUGIN_ASSEMBLY)
+
+EXTRA_DIST = 			\
+	$(PLUGIN_SOURCES)	\
+	$(PLUGIN_MANIFEST)
+
+CLEANFILES =			\
+	$(PLUGIN_ASSEMBLY)	\
+	$(PLUGIN_ASSEMBLY).mdb	\
+	*.mpack

Modified: branches/FSPOT_0_5_0_STABLE/extensions/Tools/Makefile.am
==============================================================================
--- branches/FSPOT_0_5_0_STABLE/extensions/Tools/Makefile.am	(original)
+++ branches/FSPOT_0_5_0_STABLE/extensions/Tools/Makefile.am	Fri Oct 17 19:02:54 2008
@@ -1,5 +1,6 @@
 SUBDIRS = 			\
 	ChangePhotoPath		\
 	DevelopInUFraw		\
+	HashJob			\
 	RawPlusJpeg		\
 	MergeDb



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