[nautilus] batch-rename-dialog: revealer for auto numbering



commit 568193ea2fccbeb0c7bef684a563d4b3f646a252
Author: Sirbu Lavinia Stefania <sirbu lavinia stefania gmail com>
Date:   Tue Sep 27 18:57:21 2016 -0400

    batch-rename-dialog: revealer for auto numbering
    
    Currently we have a big padding that initially has no meaning.
    
    The problem is that when using the rename for multiple files, we initially
    have an extra padding due to auto numbering. Even if the automatic numbering
    is not used, the space for the toggle button used for the numbering options
    is now blank and waiting for a possible use of the automatic option.
    
    Add a GtkReaveler that contains a child represented by a GtkBox. The GtkBox
    contains a label and the toggle button for choosing an option of automatic
    renaming. The child is revealed only when necesarry, more specifically when
    the automatic numbering option is added.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771813

 src/nautilus-batch-rename-dialog.c               |    8 ++--
 src/resources/ui/nautilus-batch-rename-dialog.ui |   60 ++++++++++++----------
 2 files changed, 37 insertions(+), 31 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 7f805ae..050d566 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -56,6 +56,7 @@ struct _NautilusBatchRenameDialog
     GtkWidget *scrolled_window;
     GtkWidget *numbering_order_popover;
     GtkWidget *numbering_order_button;
+    GtkWidget *numbering_revealer;
     GtkWidget *conflict_box;
     GtkWidget *conflict_label;
     GtkWidget *conflict_down;
@@ -1523,13 +1524,11 @@ update_display_text (NautilusBatchRenameDialog *dialog)
 
     if (!numbering_tag_is_some_added (dialog))
     {
-        gtk_label_set_label (GTK_LABEL (dialog->numbering_label), "");
-        gtk_widget_hide (dialog->numbering_order_button);
+        gtk_revealer_set_reveal_child(GTK_REVEALER(dialog->numbering_revealer), FALSE);
     }
     else
     {
-        gtk_label_set_label (GTK_LABEL (dialog->numbering_label), _("Automatic Numbering Order"));
-        gtk_widget_show (dialog->numbering_order_button);
+        gtk_revealer_set_reveal_child(GTK_REVEALER(dialog->numbering_revealer), TRUE);
     }
 
     dialog->new_names = batch_rename_dialog_get_new_names (dialog);
@@ -2095,6 +2094,7 @@ nautilus_batch_rename_dialog_class_init (NautilusBatchRenameDialogClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, scrolled_window);
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, numbering_order_popover);
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, numbering_order_button);
+    gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, numbering_revealer);
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, numbering_order_menu);
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, conflict_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusBatchRenameDialog, conflict_label);
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui 
b/src/resources/ui/nautilus-batch-rename-dialog.ui
index d4bef6d..c01a8fa 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -154,51 +154,57 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="numbering_label">
+                      <object class="GtkRevealer" id="numbering_revealer">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Automatic Numbering Order</property>
-                        <property name="can_focus">False</property>
-                        <property name="height-request">35</property>
-                        <property name="sensitive">False</property>
-                      </object>
-                      <packing>
-                        <property name="left-attach">0</property>
-                        <property name="top-attach">1</property>
-                        <property name="width">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToggleButton" id="numbering_order_button">
-                        <property name="visible">True</property>
-                        <signal name="toggled" handler="numbering_order_button_clicked" swapped="yes" />
+                        <property name="halign">center</property>
                         <child>
-                          <object class="GtkBox">
+                          <object class="GtkBox" id="numbering_box">
                             <property name="visible">True</property>
                             <property name="orientation">horizontal</property>
-                            <property name="spacing">15</property>
+                            <property name="spacing">10</property>
                             <child>
-                              <object class="GtkLabel" id="numbering_order_label">
+                              <object class="GtkLabel" id="numbering_label">
                                 <property name="visible">True</property>
-                                <property name="width-request">180</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Original Name 
(Ascending)</property>
+                                <property name="label" translatable="yes">Automatic Numbering 
Order</property>
                                 <property name="can_focus">False</property>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkImage" id="action_icon">
+                              <object class="GtkToggleButton" id="numbering_order_button">
                                 <property name="visible">True</property>
-                                <property name="icon-name">pan-down-symbolic</property>
-                                <property name="icon-size">1</property>
+                                <signal name="toggled" handler="numbering_order_button_clicked" 
swapped="yes" />
+                                <child>
+                                  <object class="GtkBox">
+                                    <property name="visible">True</property>
+                                    <property name="orientation">horizontal</property>
+                                    <property name="spacing">15</property>
+                                    <child>
+                                      <object class="GtkLabel" id="numbering_order_label">
+                                        <property name="visible">True</property>
+                                        <property name="width-request">180</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">Original Name 
(Ascending)</property>
+                                        <property name="can_focus">False</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkImage" id="action_icon">
+                                        <property name="visible">True</property>
+                                        <property name="icon-name">pan-down-symbolic</property>
+                                        <property name="icon-size">1</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
                         </child>
                       </object>
                       <packing>
-                        <property name="left-attach">4</property>
+                        <property name="left-attach">0</property>
                         <property name="top-attach">1</property>
-                        <property name="width">1</property>
+                        <property name="width">5</property>
                       </packing>
                     </child>
                   </object>


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