[f-spot: 2/3] From 7bbf4f3a8d87b7cb72cdb4153ace6b9487ab4acf Mon Sep 17 00:00:00 2001



commit 48a2ccb7856868cf5eae20a38970f5fc514554b3
Author: Wojciech Dzierżanowski <wojciech dzierzanowski gmail com>
Date:   Tue Jun 9 13:34:00 2009 +0200

    From 7bbf4f3a8d87b7cb72cdb4153ace6b9487ab4acf Mon Sep 17 00:00:00 2001
    From: =?utf-8?q?Wojciech=20Dzier=C5=BCanowski?=
    Author: Wojciech Dzierżanowski <wojciech dzierzanowski gmail com>
    <wojciech dzierzanowski gmail com>
    Date: Mon, 11 May 2009 23:09:31 +0200
    Subject: [PATCH] TabbloExport refactorings and bugfixes
    
       * `Mono.Tabblo' namespace now uses `System.Diagnostics' for logging.
         `Mono.Tabblo' must not depend on F-Spot.  When `Mono.Tabblo' runs
    within
         F-Spot, its diagnostic output still goes through `FSpot.Utils.Log'
    thanks
         to a listener attached by `TabbloExport' to
    `System.Diagnostics.Debug'.
       * `FSpotTabbloExport' namespace adopted an MVC design.
       * Some other minor refactorings.
       * Fixed bug: The "Export" button should have the initial input focus.
       * Fixed bug: Work around tabblo.com's  way of determining the
       * expected
         image file format.  tabblo.com expects the file type to match the
         file extension specified as one of the POST arguments.
    TabbloExport
         used to set this argument to the name of the original file rather
    than
         the version actually being exported.  This caused trouble e.g. when
         exporting photos developed from RAW with DevelopInUFRaw.
       * Bumped version number.
---
 extensions/Exporters/TabbloExport/AssemblyInfo.cs  |    2 +-
 .../Exporters/TabbloExport/Tabblo/AssemblyInfo.cs  |    2 +-
 .../Exporters/TabbloExport/TabbloExport.addin.xml  |    2 +-
 extensions/Exporters/TabbloExport/TabbloExport.cs  |  140 ++++++++++++++++++++
 .../Exporters/TabbloExport/TabbloExport.glade      |  137 +++++++++++++++++++
 5 files changed, 280 insertions(+), 3 deletions(-)

diff --git a/extensions/Exporters/TabbloExport/AssemblyInfo.cs b/extensions/Exporters/TabbloExport/AssemblyInfo.cs
index 7da6049..776edc6 100644
--- a/extensions/Exporters/TabbloExport/AssemblyInfo.cs
+++ b/extensions/Exporters/TabbloExport/AssemblyInfo.cs
@@ -29,4 +29,4 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can use the default the Revision and
 // Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion ("0.2.*")]
+[assembly: AssemblyVersion ("0.3.*")]
diff --git a/extensions/Exporters/TabbloExport/Tabblo/AssemblyInfo.cs b/extensions/Exporters/TabbloExport/Tabblo/AssemblyInfo.cs
index 977e76e..5e27d6e 100644
--- a/extensions/Exporters/TabbloExport/Tabblo/AssemblyInfo.cs
+++ b/extensions/Exporters/TabbloExport/Tabblo/AssemblyInfo.cs
@@ -29,4 +29,4 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can use the default the Revision and
 // Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion ("0.2.*")]
+[assembly: AssemblyVersion ("0.3.*")]
diff --git a/extensions/Exporters/TabbloExport/TabbloExport.addin.xml b/extensions/Exporters/TabbloExport/TabbloExport.addin.xml
index 5ef56b6..42cb077 100644
--- a/extensions/Exporters/TabbloExport/TabbloExport.addin.xml
+++ b/extensions/Exporters/TabbloExport/TabbloExport.addin.xml
@@ -1,5 +1,5 @@
 <Addin namespace="FSpot"
-	version="0.6.0.1"
+	version="0.6.0.2"
 	name="Tabblo Export"
 	description="This extension allows you to export your photos to Tabblo."
  	author="Wojciech Dzierżanowski"
diff --git a/extensions/Exporters/TabbloExport/TabbloExport.cs b/extensions/Exporters/TabbloExport/TabbloExport.cs
index 015876f..458fa17 100644
--- a/extensions/Exporters/TabbloExport/TabbloExport.cs
+++ b/extensions/Exporters/TabbloExport/TabbloExport.cs
@@ -101,6 +101,25 @@ namespace FSpotTabbloExport {
 			model.PasswordChanged += HandlePasswordChanged;
 			main_dialog.password_entry.Changed +=
 					HandlePasswordChanged;
+
+			// Tags
+			model.AttachTagsChanged += HandleAttachTagsToggled;
+			main_dialog.attach_tags_button.Toggled +=
+					HandleAttachTagsToggled;
+
+			model.AttachedTagsChanged += HandleAttachedTagsChanged;
+
+			main_dialog.attached_tags_select_button.Clicked +=
+					HandleSelectAttachedTagsClicked;
+
+			model.RemoveTagsChanged += HandleRemoveTagsToggled;
+			main_dialog.remove_tags_button.Toggled +=
+					HandleRemoveTagsToggled;
+
+			model.RemovedTagsChanged += HandleRemovedTagsChanged;
+
+			main_dialog.removed_tags_select_button.Clicked +=
+					HandleSelectRemovedTagsClicked;
 		}
 
 
@@ -138,6 +157,107 @@ namespace FSpotTabbloExport {
 		}
 
 
+		private void HandleAttachTagsToggled (object sender,
+		                                      EventArgs args)
+		{
+			if (model == sender) {
+				main_dialog.attach_tags_button.Active =
+						model.AttachTags;
+				main_dialog.attached_tags_select_button
+						.Sensitive = model.AttachTags;
+
+				if (model.AttachTags && 0 == model
+							.AttachedTags.Length) {
+					model.AttachedTags = SelectTags ();
+				}
+			} else {
+				model.AttachTags =
+					main_dialog.attach_tags_button.Active;
+			}
+		}
+
+		private void HandleRemoveTagsToggled (object sender,
+		                                      EventArgs args)
+		{
+			if (model == sender) {
+				main_dialog.remove_tags_button.Active =
+						model.RemoveTags;
+				main_dialog.removed_tags_select_button
+						.Sensitive = model.RemoveTags;
+
+				if (model.RemoveTags && 0 == model
+							.RemovedTags.Length) {
+					model.RemovedTags = SelectTags ();
+				}
+			} else {
+				model.RemoveTags =
+					main_dialog.remove_tags_button.Active;
+			}
+		}
+
+
+		private void HandleSelectAttachedTagsClicked (object sender,
+		                                              EventArgs args)
+		{
+			Debug.Assert (model != sender);
+
+			FSpot.Tag [] tags = SelectTags ();
+			if (null != tags) {
+				model.AttachedTags = tags;
+			}
+		}
+
+		private void HandleSelectRemovedTagsClicked (object sender,
+		                                             EventArgs args)
+		{
+			Debug.Assert (model != sender);
+
+			FSpot.Tag [] tags = SelectTags ();
+			if (null != tags) {
+				model.RemovedTags = tags;
+			}
+		}
+
+
+		private void HandleAttachedTagsChanged (object sender,
+		                                        EventArgs args)
+		{
+			Debug.Assert (model == sender);
+
+			main_dialog.attached_tags_view.Tags =
+					model.AttachedTags;
+			main_dialog.attach_tags_button.Active =
+					model.AttachTags
+					&& model.AttachedTags.Length > 0;
+		}
+
+		private void HandleRemovedTagsChanged (object sender,
+		                                       EventArgs args)
+		{
+			Debug.Assert (model == sender);
+
+			main_dialog.removed_tags_view.Tags =
+					model.RemovedTags;
+			main_dialog.remove_tags_button.Active =
+					model.RemoveTags
+					&& model.RemovedTags.Length > 0;
+		}
+
+
+		private FSpot.Tag [] SelectTags ()
+		{
+			TagStore tag_store = FSpot.Core.Database.Tags;
+			FSpot.UI.Dialog.TagSelectionDialog tagDialog =
+					new FSpot.UI.Dialog.TagSelectionDialog (
+							tag_store);
+			FSpot.Tag [] tags = tagDialog.Run ();
+
+			tagDialog.Hide ();
+
+			return tags;
+		}
+
+
 		private void HandleResponse (object sender,
 		                             Gtk.ResponseArgs args)
 		{
@@ -241,6 +361,26 @@ namespace FSpotTabbloExport {
 		private void OnPhotoUploaded (FSpot.IBrowsableItem item)
 		{
 			Debug.Assert (null != item);
+
+			if (!model.AttachTags && !model.RemoveTags) {
+				return;
+			}
+
+			PhotoStore photo_store = FSpot.Core.Database.Photos;
+			FSpot.Photo photo = photo_store.GetByUri (
+					item.DefaultVersionUri);
+			Debug.Assert (null != photo);
+			if (null == photo) {
+				return;
+			}
+
+			if (model.AttachTags) {
+				photo.AddTag (model.AttachedTags);
+			}
+			if (model.RemoveTags) {
+				photo.RemoveTag (model.RemovedTags);
+			}
+			photo_store.Commit (photo);
 		}
 
 		
diff --git a/extensions/Exporters/TabbloExport/TabbloExport.glade b/extensions/Exporters/TabbloExport/TabbloExport.glade
index 2ebfae8..71454fc 100644
--- a/extensions/Exporters/TabbloExport/TabbloExport.glade
+++ b/extensions/Exporters/TabbloExport/TabbloExport.glade
@@ -146,6 +146,143 @@
                     <property name="fill">False</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkFrame" id="frame10">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">GTK_SHADOW_NONE</property>
+                    <child>
+                      <widget class="GtkTable" id="table11">
+                        <property name="visible">True</property>
+                        <property name="border_width">12</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">3</property>
+                        <property name="column_spacing">7</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <widget class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="xpad">12</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">&lt;small&gt;&lt;i&gt;F-Spot tags can help you track the export status of photos. Example: Use one tag for the photos that you plan to export, and another one for those already exported. Here, you can tell F-Spot to automatically replace these tags as appropriate.&lt;/i&gt;&lt;/small&gt;</property>
+                            <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
+                            <property name="width_chars">42</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="right_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkAlignment" id="removed_tags_alignment">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkAlignment" id="attached_tags_alignment">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="removed_tags_select_button">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Select...</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="attached_tags_select_button">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Select...</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="remove_tags_button">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Rem_ove from exported photos:</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="attach_tags_button">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">_Attach to exported photos:</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">&lt;b&gt;F-Spot tags&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </widget>
               <packing>
                 <property name="position">1</property>



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