[gthumb] [change_date] use a combo box to specify the adjustment sign



commit 6108dadb094efa29cf2f1e6a1acadcf0b392e9ff
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 14 18:12:33 2010 +0100

    [change_date] use a combo box to specify the adjustment sign
    
    this allows to specify a negative value when the adjustment is
    less than an hour.

 extensions/change_date/data/ui/change-date.ui |   55 +++++++++++++++++++++----
 extensions/change_date/dlg-change-date.c      |    4 +-
 2 files changed, 49 insertions(+), 10 deletions(-)
---
diff --git a/extensions/change_date/data/ui/change-date.ui b/extensions/change_date/data/ui/change-date.ui
index 01b8c4b..054afa8 100644
--- a/extensions/change_date/data/ui/change-date.ui
+++ b/extensions/change_date/data/ui/change-date.ui
@@ -13,7 +13,6 @@
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="time_h_adjustment">
-    <property name="lower">-999999</property>
     <property name="upper">999999</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
@@ -248,6 +247,7 @@
                                     <child>
                                       <object class="GtkAlignment" id="alignment4">
                                         <property name="visible">True</property>
+                                        <property name="top_padding">4</property>
                                         <child>
                                           <object class="GtkRadioButton" id="adjust_time_radiobutton">
                                             <property name="label" translatable="yes">A_djust by</property>
@@ -277,7 +277,7 @@
                                   <object class="GtkTable" id="time_box">
                                     <property name="visible">True</property>
                                     <property name="n_rows">3</property>
-                                    <property name="n_columns">2</property>
+                                    <property name="n_columns">3</property>
                                     <property name="column_spacing">6</property>
                                     <property name="row_spacing">6</property>
                                     <child>
@@ -292,6 +292,8 @@
                                         <property name="numeric">True</property>
                                       </object>
                                       <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
                                         <property name="x_options"></property>
                                       </packing>
                                     </child>
@@ -307,6 +309,8 @@
                                         <property name="numeric">True</property>
                                       </object>
                                       <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>
                                         <property name="x_options"></property>
@@ -324,6 +328,8 @@
                                         <property name="numeric">True</property>
                                       </object>
                                       <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>
                                         <property name="x_options"></property>
@@ -336,8 +342,8 @@
                                         <property name="label" translatable="yes">hours</property>
                                       </object>
                                       <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
+                                        <property name="left_attach">2</property>
+                                        <property name="right_attach">3</property>
                                         <property name="x_options">GTK_FILL</property>
                                       </packing>
                                     </child>
@@ -348,8 +354,8 @@
                                         <property name="label" translatable="yes">minutes</property>
                                       </object>
                                       <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
+                                        <property name="left_attach">2</property>
+                                        <property name="right_attach">3</property>
                                         <property name="top_attach">1</property>
                                         <property name="bottom_attach">2</property>
                                         <property name="x_options">GTK_FILL</property>
@@ -362,13 +368,32 @@
                                         <property name="label" translatable="yes">seconds</property>
                                       </object>
                                       <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="right_attach">2</property>
+                                        <property name="left_attach">2</property>
+                                        <property name="right_attach">3</property>
                                         <property name="top_attach">2</property>
                                         <property name="bottom_attach">3</property>
                                         <property name="x_options">GTK_FILL</property>
                                       </packing>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <object class="GtkComboBox" id="adjust_sign_combobox">
+                                        <property name="visible">True</property>
+                                        <property name="model">adjust_sign_liststore</property>
+                                        <property name="active">0</property>
+                                        <child>
+                                          <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                                          <attributes>
+                                            <attribute name="text">0</attribute>
+                                          </attributes>
+                                        </child>
+                                      </object>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="position">1</property>
@@ -466,4 +491,18 @@
       <action-widget response="0">ok_button</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkListStore" id="adjust_sign_liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">+</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">-</col>
+      </row>
+    </data>
+  </object>
 </interface>
diff --git a/extensions/change_date/dlg-change-date.c b/extensions/change_date/dlg-change-date.c
index 3e5c837..266da15 100644
--- a/extensions/change_date/dlg-change-date.c
+++ b/extensions/change_date/dlg-change-date.c
@@ -85,10 +85,10 @@ ok_button_clicked (GtkWidget  *button,
 		change_type = GTH_CHANGE_TO_PHOTO_ORIGINAL_DATE;
 	else if (IS_ACTIVE (GET_WIDGET ("adjust_time_radiobutton"))) {
 		change_type = GTH_CHANGE_ADJUST_TIME;
-		time_adjustment = (HOURS_TO_SECONDS (ABS (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_time_h_spinbutton")))))
+		time_adjustment = (HOURS_TO_SECONDS (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_time_h_spinbutton"))))
 				   + MINS_TO_SECONDS (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_timem_spinbutton"))))
 				   + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_times_spinbutton"))));
-		if (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_time_h_spinbutton"))) < 0)
+		if (gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("adjust_sign_combobox"))) == 1)
 			time_adjustment = -time_adjustment;
 	}
 



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