[gthumb] [change_date] simplified the dialog



commit 45f8c1e2918edb641383cb152a069725ea6fbe9b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 14 12:50:31 2010 +0100

    [change_date] simplified the dialog
    
    removed the adjust timezone option; removed the
    minus checkbox allowing to set a negative hour.

 extensions/change_date/data/ui/change-date.ui |  197 +++++++++----------------
 extensions/change_date/dlg-change-date.c      |   23 ++--
 2 files changed, 80 insertions(+), 140 deletions(-)
---
diff --git a/extensions/change_date/data/ui/change-date.ui b/extensions/change_date/data/ui/change-date.ui
index 621fd3d..01b8c4b 100644
--- a/extensions/change_date/data/ui/change-date.ui
+++ b/extensions/change_date/data/ui/change-date.ui
@@ -1,18 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkAdjustment" id="times_adjustment">
+  <object class="GtkAdjustment" id="time_s_adjustment">
     <property name="upper">59</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" id="timem_adjustment">
+  <object class="GtkAdjustment" id="time_m_adjustment">
     <property name="upper">59</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" id="timeh_adjustment">
+  <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>
@@ -111,6 +112,7 @@
                 </child>
               </object>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
@@ -241,184 +243,130 @@
                                 <property name="visible">True</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkRadioButton" id="adjust_timezone_radiobutton">
-                                    <property name="label" translatable="yes">A_djust by</property>
+                                  <object class="GtkVBox" id="vbox6">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">to_following_date_radiobutton</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkHBox" id="timezone_box">
-                                    <property name="visible">True</property>
-                                    <property name="spacing">6</property>
                                     <child>
-                                      <object class="GtkSpinButton" id="adjust_timezone_spinbutton">
+                                      <object class="GtkAlignment" id="alignment4">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="invisible_char">â??</property>
-                                        <property name="adjustment">timezone_adjustment</property>
-                                        <property name="climb_rate">1</property>
-                                        <property name="numeric">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label102">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes">hours</property>
+                                        <child>
+                                          <object class="GtkRadioButton" id="adjust_time_radiobutton">
+                                            <property name="label" translatable="yes">A_djust by</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">False</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="draw_indicator">True</property>
+                                            <property name="group">to_following_date_radiobutton</property>
+                                          </object>
+                                        </child>
                                       </object>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">1</property>
+                                        <property name="position">0</property>
                                       </packing>
                                     </child>
                                   </object>
                                   <packing>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="position">4</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkVBox" id="vbox4">
-                            <property name="visible">True</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkHBox" id="hbox1">
-                                <property name="visible">True</property>
-                                <property name="spacing">6</property>
-                                <child>
-                                  <object class="GtkRadioButton" id="adjust_timehms_radiobutton">
-                                    <property name="label" translatable="yes">A_djust by</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="group">to_following_date_radiobutton</property>
-                                  </object>
-                                  <packing>
                                     <property name="expand">False</property>
                                     <property name="fill">False</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="timehms_box">
+                                  <object class="GtkTable" id="time_box">
                                     <property name="visible">True</property>
-                                    <property name="spacing">6</property>
+                                    <property name="n_rows">3</property>
+                                    <property name="n_columns">2</property>
+                                    <property name="column_spacing">6</property>
+                                    <property name="row_spacing">6</property>
                                     <child>
-                                      <object class="GtkCheckButton" id="negative_offset">
-                                        <property name="label" translatable="yes">-</property>
+                                      <object class="GtkSpinButton" id="adjust_time_h_spinbutton">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="receives_default">False</property>
-                                        <property name="use_action_appearance">False</property>
-                                        <property name="draw_indicator">True</property>
+                                        <property name="invisible_char">&#x25CF;</property>
+                                        <property name="width_chars">5</property>
+                                        <property name="invisible_char_set">True</property>
+                                        <property name="adjustment">time_h_adjustment</property>
+                                        <property name="climb_rate">1</property>
+                                        <property name="numeric">True</property>
                                       </object>
                                       <packing>
-                                        <property name="position">0</property>
+                                        <property name="x_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkSpinButton" id="adjust_timeh_spinbutton">
+                                      <object class="GtkSpinButton" id="adjust_time_m_spinbutton">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="invisible_char">â??</property>
+                                        <property name="invisible_char">&#x25CF;</property>
+                                        <property name="width_chars">5</property>
                                         <property name="invisible_char_set">True</property>
-                                        <property name="adjustment">timeh_adjustment</property>
+                                        <property name="adjustment">time_m_adjustment</property>
                                         <property name="climb_rate">1</property>
                                         <property name="numeric">True</property>
                                       </object>
                                       <packing>
-                                        <property name="expand">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label3">
-                                        <property name="visible">True</property>
-                                        <property name="label" translatable="yes">h</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">2</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="bottom_attach">2</property>
+                                        <property name="x_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkSpinButton" id="adjust_timem_spinbutton">
+                                      <object class="GtkSpinButton" id="adjust_time_s_spinbutton">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="invisible_char">â??</property>
+                                        <property name="invisible_char">&#x25CF;</property>
+                                        <property name="width_chars">5</property>
                                         <property name="invisible_char_set">True</property>
-                                        <property name="adjustment">timem_adjustment</property>
+                                        <property name="adjustment">time_s_adjustment</property>
                                         <property name="climb_rate">1</property>
                                         <property name="numeric">True</property>
                                       </object>
                                       <packing>
-                                        <property name="expand">False</property>
-                                        <property name="position">3</property>
+                                        <property name="top_attach">2</property>
+                                        <property name="bottom_attach">3</property>
+                                        <property name="x_options"></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label4">
+                                      <object class="GtkLabel" id="label3">
                                         <property name="visible">True</property>
-                                        <property name="label" translatable="yes">m</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">hours</property>
                                       </object>
                                       <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                        <property name="x_options">GTK_FILL</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkSpinButton" id="adjust_times_spinbutton">
+                                      <object class="GtkLabel" id="label4">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="invisible_char">â??</property>
-                                        <property name="invisible_char_set">True</property>
-                                        <property name="adjustment">times_adjustment</property>
-                                        <property name="climb_rate">1</property>
-                                        <property name="numeric">True</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">minutes</property>
                                       </object>
                                       <packing>
-                                        <property name="expand">False</property>
-                                        <property name="position">5</property>
+                                        <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">GTK_FILL</property>
                                       </packing>
                                     </child>
                                     <child>
                                       <object class="GtkLabel" id="label5">
                                         <property name="visible">True</property>
-                                        <property name="label" translatable="yes">s</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">seconds</property>
                                       </object>
                                       <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">6</property>
+                                        <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">GTK_FILL</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -435,7 +383,7 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="position">5</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                       </object>
@@ -447,6 +395,7 @@
                 </child>
               </object>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -517,10 +466,4 @@
       <action-widget response="0">ok_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkAdjustment" id="timezone_adjustment">
-    <property name="lower">-23</property>
-    <property name="upper">23</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
 </interface>
diff --git a/extensions/change_date/dlg-change-date.c b/extensions/change_date/dlg-change-date.c
index 98993f5..3e5c837 100644
--- a/extensions/change_date/dlg-change-date.c
+++ b/extensions/change_date/dlg-change-date.c
@@ -83,13 +83,15 @@ ok_button_clicked (GtkWidget  *button,
 		change_type = GTH_CHANGE_TO_FILE_CREATION_DATE;
 	else if (IS_ACTIVE (GET_WIDGET ("to_photo_original_date_radiobutton")))
 		change_type = GTH_CHANGE_TO_PHOTO_ORIGINAL_DATE;
-	else if (IS_ACTIVE (GET_WIDGET ("adjust_timezone_radiobutton"))) {
+	else if (IS_ACTIVE (GET_WIDGET ("adjust_time_radiobutton"))) {
 		change_type = GTH_CHANGE_ADJUST_TIME;
-		time_adjustment = HOURS_TO_SECONDS(gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_timezone_spinbutton"))));}
-	else if (IS_ACTIVE (GET_WIDGET ("adjust_timehms_radiobutton"))) {
-		change_type = GTH_CHANGE_ADJUST_TIME;
-		time_adjustment = HOURS_TO_SECONDS(gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_timeh_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 (IS_ACTIVE (GET_WIDGET ("negative_offset"))) { time_adjustment =-time_adjustment;}}
+		time_adjustment = (HOURS_TO_SECONDS (ABS (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)
+			time_adjustment = -time_adjustment;
+	}
+
 	task = gth_change_date_task_new (gth_browser_get_location (data->browser),
 					 data->file_list,
 					 change_fields,
@@ -120,8 +122,7 @@ update_sensitivity (DialogData *data)
 				   || IS_ACTIVE (GET_WIDGET ("change_comment_checkbutton"))
 				   || IS_ACTIVE (GET_WIDGET ("change_datetimeoriginal_checkbutton"))));
 	gtk_widget_set_sensitive (data->date_selector, IS_ACTIVE (GET_WIDGET ("to_following_date_radiobutton")));
-	gtk_widget_set_sensitive (GET_WIDGET ("timezone_box"), IS_ACTIVE (GET_WIDGET ("adjust_timezone_radiobutton")));
-	gtk_widget_set_sensitive (GET_WIDGET ("timehms_box"), IS_ACTIVE (GET_WIDGET ("adjust_timehms_radiobutton")));
+	gtk_widget_set_sensitive (GET_WIDGET ("time_box"), IS_ACTIVE (GET_WIDGET ("adjust_time_radiobutton")));
 
 	if (IS_ACTIVE (GET_WIDGET ("change_last_modified_checkbutton"))) {
 		gtk_widget_set_sensitive (GET_WIDGET ("to_last_modified_date_radiobutton"), FALSE);
@@ -219,11 +220,7 @@ dlg_change_date (GthBrowser *browser,
 			  "clicked",
 			  G_CALLBACK (radio_button_clicked),
 			  data);
-	g_signal_connect (GET_WIDGET ("adjust_timezone_radiobutton"),
-			  "clicked",
-			  G_CALLBACK (radio_button_clicked),
-			  data);
-	g_signal_connect (GET_WIDGET ("adjust_timehms_radiobutton"),
+	g_signal_connect (GET_WIDGET ("adjust_time_radiobutton"),
 			  "clicked",
 			  G_CALLBACK (radio_button_clicked),
 			  data);



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