f-spot r4376 - in trunk/extensions: . Tools/SyncCatalog
- From: lmilesi svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4376 - in trunk/extensions: . Tools/SyncCatalog
- Date: Tue, 16 Sep 2008 15:26:04 +0000 (UTC)
Author: lmilesi
Date: Tue Sep 16 15:26:04 2008
New Revision: 4376
URL: http://svn.gnome.org/viewvc/f-spot?rev=4376&view=rev
Log:
2008-09-16 Lorenzo Milesi <maxxer yetopen it>
* Tools/SyncCatalog/Makefile:
* Tools/SyncCatalog/SyncCatalog.cs: allow syncing only a selection of
pics. Patch from Miguel Aguero. Fix bgo#478763.
Modified:
trunk/extensions/ChangeLog
trunk/extensions/Tools/SyncCatalog/Makefile
trunk/extensions/Tools/SyncCatalog/SyncCatalog.cs
Modified: trunk/extensions/Tools/SyncCatalog/Makefile
==============================================================================
--- trunk/extensions/Tools/SyncCatalog/Makefile (original)
+++ trunk/extensions/Tools/SyncCatalog/Makefile Tue Sep 16 15:26:04 2008
@@ -6,7 +6,8 @@
-pkg:gtk-sharp-2.0 \
-pkg:f-spot
-ASSEMBLIES =
+ASSEMBLIES = \
+ -r:Mono.Posix
RESOURCES = \
-resource:$(ADDIN).addin.xml
Modified: trunk/extensions/Tools/SyncCatalog/SyncCatalog.cs
==============================================================================
--- trunk/extensions/Tools/SyncCatalog/SyncCatalog.cs (original)
+++ trunk/extensions/Tools/SyncCatalog/SyncCatalog.cs Tue Sep 16 15:26:04 2008
@@ -9,6 +9,7 @@
using System;
using System.Collections.Generic;
+using Mono.Unix;
using Gtk;
@@ -21,23 +22,73 @@
public class SyncCatalog : ICommand {
public void Run (object o, EventArgs e) {
- if (ResponseType.Ok != HigMessageDialog.RunHigConfirmation (
- MainWindow.Toplevel.Window,
- DialogFlags.DestroyWithParent,
- MessageType.Warning,
- "Sync Catalog with photos",
- "Sync operation of the entire catalog with all photos could take hours, but hopefully it will be run in background. you can stop f-spot any time you want, the sync job will be restarted next time you start f-spot",
- "Do it now"))
- return;
+ SyncCatalogDialog dialog = new SyncCatalogDialog ();
+ dialog.ShowDialog ();
- Photo [] photos = Core.Database.Photos.Query ((Tag [])null, null, null, null);
+ }
+ }
- foreach (Photo photo in photos) {
- SyncMetadataJob.Create (Core.Database.Jobs, photo);
- }
+ public class SyncCatalogDialog : Dialog
+ {
+ private RadioButton RadioSelectedPhotos;
+ private RadioButton RadioEntireCatalog;
+
+ public void ShowDialog ()
+ {
+ string message="";
+ message = Catalog.GetString ("Sync operation of the entire catalog or a lot of selected photos with their files \n" +
+ "could take hours, but hopefully it will be run in background.\n" +
+ "You can stop F-Spot any time you want, the sync job will be restarted next time you start F-Fpot.\n" +
+ "What do you want to do?");
+
+ Gtk.Label label;
+ label = new Gtk.Label (message);
+
+ RadioSelectedPhotos = new RadioButton ("Synchronize selected photos");
+ RadioEntireCatalog = new RadioButton (RadioSelectedPhotos, "Synchronize entire catalog");
+ if (MainWindow.Toplevel.SelectedPhotos ().Length > 0)
+ RadioSelectedPhotos.Active = true;
+ else
+ RadioEntireCatalog.Active = true;
+
+ VBox.PackStart (label, false, false, 5);
+ VBox.PackStart (RadioSelectedPhotos, false, false, 1);
+ VBox.PackStart (RadioEntireCatalog, false, false, 1);
+
+ this.WindowPosition = WindowPosition.Center;
+
+ this.AddButton ("_Run", ResponseType.Apply);
+ this.AddButton ("_Cancel", ResponseType.Cancel);
+ this.Response += HandleResponse;
+
+ ShowAll ();
}
+
+ void HandleResponse (object obj, ResponseArgs args)
+ {
+ switch(args.ResponseId)
+ {
+ case ResponseType.Cancel:
+ this.Destroy ();
+ break;
+ case ResponseType.Apply:
+ Photo [] photos = new Photo [0];
+ if (RadioEntireCatalog.Active)
+ photos = Core.Database.Photos.Query ();
+ else if (RadioSelectedPhotos.Active)
+ photos = MainWindow.Toplevel.SelectedPhotos ();
+
+ this.Hide ();
+ foreach (Photo photo in photos) {
+ SyncMetadataJob.Create (Core.Database.Jobs, photo);
+ }
+ this.Destroy();
+ break;
+ }
+ }
+
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]