[f-spot/taglib-metadata] Add preference for XMP sidecars in preferences window.



commit a9da00f1847e50b840f212d365994676764ecdbe
Author: Ruben Vermeersch <ruben savanne be>
Date:   Fri Jul 2 20:27:28 2010 +0200

    Add preference for XMP sidecars in preferences window.

 src/UI.Dialog/PreferenceDialog.cs    |   29 ++++++++++-
 src/UI.Dialog/ui/PreferenceDialog.ui |   88 +++++++++++++++++++++-------------
 2 files changed, 80 insertions(+), 37 deletions(-)
---
diff --git a/src/UI.Dialog/PreferenceDialog.cs b/src/UI.Dialog/PreferenceDialog.cs
index bd4634f..dfaf44a 100644
--- a/src/UI.Dialog/PreferenceDialog.cs
+++ b/src/UI.Dialog/PreferenceDialog.cs
@@ -28,6 +28,7 @@ namespace FSpot.UI.Dialog {
 
 		[GtkBeans.Builder.Object] RadioButton writemetadata_radio;
 		[GtkBeans.Builder.Object] RadioButton dontwrite_radio;
+		[GtkBeans.Builder.Object] CheckButton always_sidecar_check;
 
 		[GtkBeans.Builder.Object] ComboBox theme_combo;
 		[GtkBeans.Builder.Object] ComboBox screenprofile_combo;
@@ -49,6 +50,7 @@ namespace FSpot.UI.Dialog {
 
 			//Write Metadata
 			LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
+			LoadPreference (Preferences.METADATA_ALWAYS_USE_SIDECAR);
 
 			//Screen profile
 			ListStore sprofiles = new ListStore (typeof (string), typeof (int));
@@ -108,7 +110,7 @@ namespace FSpot.UI.Dialog {
 			theme_combo.SetCellDataFunc (themecellrenderer, ThemeCellFunc);
 			LoadPreference (Preferences.GTK_RC);
 
-			Preferences.SettingChanged += OnPreferencesChanged;
+			ConnectEvents ();
 		}
 #endregion
 
@@ -129,11 +131,17 @@ namespace FSpot.UI.Dialog {
 			case Preferences.METADATA_EMBED_IN_IMAGE:
 				bool embed_active = Preferences.Get<bool> (key);
 				if (writemetadata_radio.Active != embed_active) {
-					if (embed_active)
+					if (embed_active) {
 						writemetadata_radio.Active = true;
-					else
+					} else {
 						dontwrite_radio.Active = true;
+					}
 				}
+				always_sidecar_check.Sensitive = embed_active;
+				break;
+			case Preferences.METADATA_ALWAYS_USE_SIDECAR:
+				bool always_use_sidecar = Preferences.Get<bool> (key);
+				always_sidecar_check.Active = always_use_sidecar;
 				break;
 			case Preferences.GTK_RC:
 				pref = Preferences.Get<string> (key);
@@ -189,6 +197,16 @@ namespace FSpot.UI.Dialog {
 #endregion
 
 #region event handlers
+		void ConnectEvents ()
+		{
+			Preferences.SettingChanged += OnPreferencesChanged;
+			screenprofile_combo.Changed += HandleScreenProfileComboChanged;
+			printprofile_combo.Changed += HandlePrintProfileComboChanged;
+			theme_combo.Changed += HandleThemeComboChanged;
+			writemetadata_radio.Toggled += HandleWritemetadataGroupChanged;
+			always_sidecar_check.Toggled += HandleAlwaysSidecareCheckToggled;
+		}
+
 		void HandlePhotosdirChanged (object sender, System.EventArgs args)
 		{
 			photosdir_chooser.CurrentFolderChanged -= HandlePhotosdirChanged;
@@ -202,6 +220,11 @@ namespace FSpot.UI.Dialog {
 			Preferences.Set (Preferences.METADATA_EMBED_IN_IMAGE, writemetadata_radio.Active);
 		}
 
+		void HandleAlwaysSidecareCheckToggled (object sender, EventArgs args)
+		{
+			Preferences.Set (Preferences.METADATA_ALWAYS_USE_SIDECAR, always_sidecar_check.Active);
+		}
+
 		void HandleThemeComboChanged (object sender, EventArgs e)
 		{
 			ComboBox combo = sender as ComboBox;
diff --git a/src/UI.Dialog/ui/PreferenceDialog.ui b/src/UI.Dialog/ui/PreferenceDialog.ui
index 98945ae..ac26a82 100644
--- a/src/UI.Dialog/ui/PreferenceDialog.ui
+++ b/src/UI.Dialog/ui/PreferenceDialog.ui
@@ -22,7 +22,7 @@
             <child>
               <object class="GtkTable" id="table1">
                 <property name="visible">True</property>
-                <property name="n_rows">13</property>
+                <property name="n_rows">14</property>
                 <property name="n_columns">2</property>
                 <property name="column_spacing">12</property>
                 <property name="row_spacing">6</property>
@@ -34,31 +34,14 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="dontwrite_radio">
-                    <property name="label" translatable="yes">Separately from the image files</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">writemetadata_radio</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkLabel" id="label10">
                     <property name="visible">True</property>
                     <property name="xalign">1</property>
                     <property name="label" translatable="yes">Color profile for display:</property>
                   </object>
                   <packing>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
                   </packing>
                 </child>
                 <child>
@@ -68,44 +51,41 @@
                     <property name="label" translatable="yes">Color profile for printing:</property>
                   </object>
                   <packing>
-                    <property name="top_attach">9</property>
-                    <property name="bottom_attach">10</property>
+                    <property name="top_attach">10</property>
+                    <property name="bottom_attach">11</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkComboBox" id="screenprofile_combo">
                     <property name="visible">True</property>
-                    <signal name="changed" handler="HandleScreenProfileComboChanged"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
+                    <property name="top_attach">8</property>
+                    <property name="bottom_attach">9</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkComboBox" id="printprofile_combo">
                     <property name="visible">True</property>
-                    <signal name="changed" handler="HandlePrintProfileComboChanged"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">9</property>
-                    <property name="bottom_attach">10</property>
+                    <property name="top_attach">10</property>
+                    <property name="bottom_attach">11</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkComboBox" id="theme_combo">
                     <property name="visible">True</property>
-                    <signal name="changed" handler="HandleThemeComboChanged"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">12</property>
-                    <property name="bottom_attach">13</property>
+                    <property name="top_attach">13</property>
+                    <property name="bottom_attach">14</property>
                   </packing>
                 </child>
                 <child>
@@ -115,8 +95,8 @@
                     <property name="label" translatable="yes">F-Spot appearance:</property>
                   </object>
                   <packing>
-                    <property name="top_attach">12</property>
-                    <property name="bottom_attach">13</property>
+                    <property name="top_attach">13</property>
+                    <property name="bottom_attach">14</property>
                   </packing>
                 </child>
                 <child>
@@ -136,7 +116,6 @@
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="HandleWritemetadataGroupChanged"/>
                     <child>
                       <object class="GtkLabel" id="label7">
                         <property name="visible">True</property>
@@ -165,6 +144,28 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="always_sidecar_check">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Never modify image files.
+&lt;small&gt;Write XMP files next to the images instead.&lt;/small&gt;</property>
+                        <property name="use_markup">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                  </packing>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
                 <child>
@@ -209,6 +210,25 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="dontwrite_radio">
+                    <property name="label" translatable="yes">Separately from the image files</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">writemetadata_radio</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>



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