f-spot r4154 - in trunk/extensions: . RetroactiveRoll
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4154 - in trunk/extensions: . RetroactiveRoll
- Date: Fri, 4 Jul 2008 15:11:30 +0000 (UTC)
Author: sdelcroix
Date: Fri Jul 4 15:11:30 2008
New Revision: 4154
URL: http://svn.gnome.org/viewvc/f-spot?rev=4154&view=rev
Log:
2008-07-04 Stephane Delcroix <sdelcroix novell com>
* RetroactiveRoll/*: new extension from Andy Wingo. bgo 497136
Added:
trunk/extensions/RetroactiveRoll/
trunk/extensions/RetroactiveRoll/.gitignore
trunk/extensions/RetroactiveRoll/Makefile
trunk/extensions/RetroactiveRoll/RetroactiveRoll.addin.xml
trunk/extensions/RetroactiveRoll/RetroactiveRoll.cs
Modified:
trunk/extensions/ChangeLog
Added: trunk/extensions/RetroactiveRoll/.gitignore
==============================================================================
--- (empty file)
+++ trunk/extensions/RetroactiveRoll/.gitignore Fri Jul 4 15:11:30 2008
@@ -0,0 +1 @@
+/*.dll
Added: trunk/extensions/RetroactiveRoll/Makefile
==============================================================================
--- (empty file)
+++ trunk/extensions/RetroactiveRoll/Makefile Fri Jul 4 15:11:30 2008
@@ -0,0 +1,29 @@
+all: RetroactiveRoll.dll
+
+PACKAGES = \
+ -pkg:f-spot \
+ -pkg:gnome-vfs-sharp-2.0
+
+ASSEMBLIES = \
+ -r:Mono.Posix -r:Mono.Data.SqliteClient
+
+RESOURCES = \
+ -resource:RetroactiveRoll.addin.xml
+
+SOURCES = \
+ RetroactiveRoll.cs
+
+install: all
+ cp *.dll ~/.gnome2/f-spot/addins/
+
+mpack: RetroactiveRoll.dll
+ mautil p RetroactiveRoll.dll
+
+%.dll: $(SOURCES) RetroactiveRoll.addin.xml
+ gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
+
+clean:
+ rm -f *.dll *~ *.bak .mpack
+
+PHONY:
+ install clean all mpack
Added: trunk/extensions/RetroactiveRoll/RetroactiveRoll.addin.xml
==============================================================================
--- (empty file)
+++ trunk/extensions/RetroactiveRoll/RetroactiveRoll.addin.xml Fri Jul 4 15:11:30 2008
@@ -0,0 +1,16 @@
+<Addin namespace="FSpot"
+ id="RetroactiveRoll"
+ version="0.1"
+ description="Retroactively assign old photos to import rolls"
+ author="Andy Wingo"
+ url="http://f-spot.org/Extensions"
+ category="Tools">
+ <Dependencies>
+ <Addin id="Core" version="0.4.0.3347"/>
+ </Dependencies>
+ <Extension path = "/FSpot/Menus/PhotoPopup">
+ <Command id = "RetroactiveRoll" _label = "Reassign to new import roll" command_type = "RetroactiveRoll.RetroactiveRoll"/>
+ </Extension>
+</Addin>
+
+
Added: trunk/extensions/RetroactiveRoll/RetroactiveRoll.cs
==============================================================================
--- (empty file)
+++ trunk/extensions/RetroactiveRoll/RetroactiveRoll.cs Fri Jul 4 15:11:30 2008
@@ -0,0 +1,49 @@
+/*
+ * RetroactiveRoll.cs
+ *
+ * Author(s)
+ * Andy Wingo <wingo pobox com>
+ *
+ * This is free software. See COPYING for details
+ */
+
+
+using FSpot;
+using FSpot.Extensions;
+using Mono.Unix;
+using System;
+using Mono.Data.SqliteClient;
+using Banshee.Database;
+
+namespace RetroactiveRoll
+{
+ public class RetroactiveRoll: ICommand
+ {
+ public void Run (object o, EventArgs e)
+ {
+ Photo[] photos = MainWindow.Toplevel.SelectedPhotos ();
+
+ if (photos.Length == 0) {
+ Console.WriteLine ("no photos selected, returning");
+ return;
+ }
+
+ DateTime import_time = photos[0].Time;
+ foreach (Photo p in photos)
+ if (p.Time > import_time)
+ import_time = p.Time;
+
+ RollStore rolls = Core.Database.Rolls;
+ Roll roll = rolls.Create(import_time);
+ foreach (Photo p in photos) {
+ DbCommand cmd = new DbCommand ("UPDATE photos SET roll_id = :roll_id " +
+ "WHERE id = :id ",
+ "roll_id", roll.Id,
+ "id", p.Id);
+ Core.Database.Database.ExecuteNonQuery (cmd);
+ p.RollId = roll.Id;
+ }
+ Console.WriteLine ("RetroactiveRoll done: " + photos.Length + " photos in roll " + roll.Id);
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]