[gthumb] organize files: optionally use the headerbar



commit cd4425e303bc7e6b619693d2887aca3733149cff
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Aug 15 14:33:20 2016 +0200

    organize files: optionally use the headerbar

 extensions/catalogs/data/ui/organize-files-task.ui |  464 +++++++++-----------
 extensions/catalogs/data/ui/organize-files.ui      |  348 ++++++---------
 extensions/catalogs/dlg-organize-files.c           |   22 +-
 extensions/catalogs/gth-organize-task.c            |   58 ++-
 4 files changed, 415 insertions(+), 477 deletions(-)
---
diff --git a/extensions/catalogs/data/ui/organize-files-task.ui 
b/extensions/catalogs/data/ui/organize-files-task.ui
index c0b3d32..64e52ca 100644
--- a/extensions/catalogs/data/ui/organize-files-task.ui
+++ b/extensions/catalogs/data/ui/organize-files-task.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Fri Oct 11 19:38:40 2013 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkListStore" id="results_liststore">
     <columns>
       <!-- column-name catalog -->
@@ -16,200 +16,134 @@
       <column type="GdkPixbuf"/>
     </columns>
   </object>
-  <object class="GtkDialog" id="organize_files_dialog">
+  <object class="GtkBox" id="dialog_content">
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Organize Files</property>
-    <property name="type_hint">normal</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox3">
+    <property name="border_width">15</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">2</property>
+    <child>
+      <object class="GtkBox" id="vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="border_width">5</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area3">
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkBox" id="hbox3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
+            <property name="vexpand">True</property>
+            <property name="spacing">12</property>
             <child>
-              <object class="GtkButton" id="cancel_button">
-                <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
+              <object class="GtkAlignment" id="alignment1">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
+                <property name="can_focus">False</property>
+                <property name="yalign">0</property>
+                <property name="top_padding">1</property>
+                <property name="left_padding">12</property>
+                <property name="right_padding">12</property>
+                <child>
+                  <object class="GtkImage" id="icon_image">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="yalign">0</property>
+                    <property name="pixel_size">48</property>
+                    <property name="icon_name">file-catalog-symbolic</property>
+                    <property name="icon_size">6</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="close_button">
-                <property name="label">gtk-close</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="ok_button">
-                <property name="label">gtk-save</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="spacing">12</property>
-            <child>
-              <object class="GtkHBox" id="hbox3">
+              <object class="GtkBox" id="vbox2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="vexpand">True</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="yalign">0</property>
-                    <property name="top_padding">1</property>
-                    <child>
-                      <object class="GtkImage" id="icon_image">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="yalign">0</property>
-                        <property name="stock">gtk-dialog-info</property>
-                        <property name="pixel_size">24</property>
-                        <property name="icon_size">6</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkVBox" id="vbox2">
+                  <object class="GtkBox" id="hbox2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="spacing">12</property>
                     <child>
-                      <object class="GtkLabel" id="label3">
+                      <object class="GtkLabel" id="progress_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="ellipsize">middle</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Organizing files</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                          <attribute name="size" value="11000"/>
-                        </attributes>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
+                        <property name="expand">True</property>
                         <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHBox" id="hbox2">
+                      <object class="GtkButton" id="cancel_button">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="tooltip_text" translatable="yes">Cancel operation</property>
                         <child>
-                          <object class="GtkLabel" id="progress_label">
+                          <object class="GtkImage">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="ellipsize">middle</property>
+                            <property name="icon_name">window-close-symbolic</property>
                           </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
                         </child>
+                        <style>
+                          <class name="gthumb-circular-button"/>
+                        </style>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">True</property>
+                        <property name="fill">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">5</property>
                     <child>
-                      <object class="GtkHBox" id="hbox1">
+                      <object class="GtkBox" id="vbox3">
+                        <property name="width_request">400</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="margin_right">5</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkVBox" id="vbox3">
+                          <object class="GtkBox" id="vbox4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">6</property>
+                            <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkVBox" id="vbox4">
+                              <object class="GtkBox" id="hbox4">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkHBox" id="hbox4">
+                                  <object class="GtkLabel" id="label2">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <object class="GtkLabel" id="label2">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">Organization:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="n_catalogs_label">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="xalign">0</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
+                                    <property name="label" translatable="yes">Organization:</property>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
@@ -218,86 +152,10 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox5">
+                                  <object class="GtkLabel" id="n_catalogs_label">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <object class="GtkScrolledWindow" id="scrolledwindow1">
-                                        <property name="width_request">300</property>
-                                        <property name="height_request">250</property>
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="shadow_type">in</property>
-                                        <child>
-                                          <object class="GtkTreeView" id="organization_treeview">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">True</property>
-                                            <property name="model">results_liststore</property>
-                                            <property name="headers_clickable">False</property>
-                                            <property name="rules_hint">True</property>
-                                            <property name="search_column">0</property>
-                                            <child internal-child="selection">
-                                              <object class="GtkTreeSelection" id="treeview-selection1"/>
-                                            </child>
-                                            <child>
-                                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
-                                                <property name="title">Catalog</property>
-                                                <property name="expand">True</property>
-                                                <property name="clickable">True</property>
-                                                <property name="reorderable">True</property>
-                                                <property name="sort_indicator">True</property>
-                                                <property name="sort_column_id">3</property>
-                                                <child>
-                                                  <object class="GtkCellRendererPixbuf" 
id="icon_cellrendererpixbuf"/>
-                                                  <attributes>
-                                                    <attribute name="pixbuf">4</attribute>
-                                                  </attributes>
-                                                </child>
-                                                <child>
-                                                  <object class="GtkCellRendererText" 
id="catalog_name_cellrenderertext"/>
-                                                  <attributes>
-                                                    <attribute name="text">0</attribute>
-                                                  </attributes>
-                                                </child>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
-                                                <property name="title">Files</property>
-                                                <property name="expand">True</property>
-                                                <property name="clickable">True</property>
-                                                <property name="reorderable">True</property>
-                                                <property name="sort_indicator">True</property>
-                                                <property name="sort_column_id">1</property>
-                                                <child>
-                                                  <object class="GtkCellRendererText" 
id="cellrenderertext2"/>
-                                                  <attributes>
-                                                    <attribute name="text">1</attribute>
-                                                  </attributes>
-                                                </child>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkTreeViewColumn" id="treeviewcolumn3">
-                                                <property name="title">Create</property>
-                                                <child>
-                                                  <object class="GtkCellRendererToggle" 
id="create_cellrenderertoggle"/>
-                                                  <attributes>
-                                                    <attribute name="active">2</attribute>
-                                                  </attributes>
-                                                </child>
-                                              </object>
-                                            </child>
-                                          </object>
-                                        </child>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
+                                    <property name="xalign">0</property>
                                   </object>
                                   <packing>
                                     <property name="expand">True</property>
@@ -307,47 +165,101 @@
                                 </child>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="hbox6">
+                              <object class="GtkBox" id="hbox5">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkButton" id="select_all_button">
-                                    <property name="label" translatable="yes">Select All</property>
-                                    <property name="use_action_appearance">False</property>
+                                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                                    <property name="width_request">450</property>
+                                    <property name="height_request">300</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
+                                    <property name="shadow_type">in</property>
+                                    <child>
+                                      <object class="GtkTreeView" id="organization_treeview">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="model">results_liststore</property>
+                                        <property name="headers_clickable">False</property>
+                                        <property name="rules_hint">True</property>
+                                        <property name="search_column">0</property>
+                                        <child internal-child="selection">
+                                          <object class="GtkTreeSelection" id="treeview-selection1"/>
+                                        </child>
+                                        <child>
+                                          <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                                            <property name="max_width">300</property>
+                                            <property name="title" translatable="yes">Catalog</property>
+                                            <property name="expand">True</property>
+                                            <property name="clickable">True</property>
+                                            <property name="reorderable">True</property>
+                                            <property name="sort_indicator">True</property>
+                                            <property name="sort_column_id">3</property>
+                                            <child>
+                                              <object class="GtkCellRendererPixbuf" 
id="icon_cellrendererpixbuf"/>
+                                              <attributes>
+                                                <attribute name="pixbuf">4</attribute>
+                                              </attributes>
+                                            </child>
+                                            <child>
+                                              <object class="GtkCellRendererText" 
id="catalog_name_cellrenderertext">
+                                                <property name="ellipsize">end</property>
+                                              </object>
+                                              <attributes>
+                                                <attribute name="text">0</attribute>
+                                              </attributes>
+                                            </child>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                                            <property name="sizing">fixed</property>
+                                            <property name="title" translatable="yes">Files</property>
+                                            <property name="clickable">True</property>
+                                            <property name="reorderable">True</property>
+                                            <property name="sort_indicator">True</property>
+                                            <property name="sort_column_id">1</property>
+                                            <child>
+                                              <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                                              <attributes>
+                                                <attribute name="text">1</attribute>
+                                              </attributes>
+                                            </child>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                                            <property name="sizing">fixed</property>
+                                            <property name="title" translatable="yes">Create</property>
+                                            <property name="reorderable">True</property>
+                                            <property name="sort_column_id">2</property>
+                                            <child>
+                                              <object class="GtkCellRendererToggle" 
id="create_cellrenderertoggle"/>
+                                              <attributes>
+                                                <attribute name="active">2</attribute>
+                                              </attributes>
+                                            </child>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
                                   </object>
                                   <packing>
-                                    <property name="expand">False</property>
+                                    <property name="expand">True</property>
                                     <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
-                                <child>
-                                  <object class="GtkButton" id="select_none_button">
-                                    <property name="label" translatable="yes">Select None</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
+                                <property name="expand">True</property>
                                 <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
@@ -360,17 +272,17 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkVBox" id="preview_box">
-                            <property name="width_request">380</property>
-                            <property name="height_request">350</property>
+                          <object class="GtkBox" id="hbox6">
+                            <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="label1">
+                              <object class="GtkButton" id="select_all_button">
+                                <property name="label" translatable="yes">Select All</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Catalog _Preview:</property>
-                                <property name="use_underline">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -379,20 +291,60 @@
                               </packing>
                             </child>
                             <child>
-                              <placeholder/>
+                              <object class="GtkButton" id="select_none_button">
+                                <property name="label" translatable="yes">Select None</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
+                            <property name="expand">False</property>
                             <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="preview_box">
+                        <property name="can_focus">False</property>
+                        <property name="margin_left">5</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkLabel" id="label1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Catalog _Preview:</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
                         <property name="expand">True</property>
                         <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
@@ -406,22 +358,22 @@
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
     </child>
-    <action-widgets>
-      <action-widget response="-6">cancel_button</action-widget>
-      <action-widget response="-7">close_button</action-widget>
-      <action-widget response="-5">ok_button</action-widget>
-    </action-widgets>
   </object>
 </interface>
diff --git a/extensions/catalogs/data/ui/organize-files.ui b/extensions/catalogs/data/ui/organize-files.ui
index 2c3b4db..85b9c1b 100644
--- a/extensions/catalogs/data/ui/organize-files.ui
+++ b/extensions/catalogs/data/ui/organize-files.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <object class="GtkListStore" id="group_by_liststore">
@@ -12,134 +12,180 @@
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkDialog" id="organize_files_dialog">
+  <object class="GtkBox" id="dialog_content">
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Organize Files</property>
-    <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <property name="border_width">15</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">2</property>
+    <child>
+      <object class="GtkBox" id="vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="border_width">5</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkBox" id="hbox3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="cancel_button">
-                <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="spacing">12</property>
             <child>
-              <object class="GtkButton" id="start_button">
-                <property name="label">gtk-execute</property>
-                <property name="use_action_appearance">False</property>
+              <object class="GtkAlignment" id="alignment3">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-                <property name="use_stock">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">12</property>
+                <property name="right_padding">12</property>
+                <child>
+                  <object class="GtkImage" id="icon_image">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="yalign">0</property>
+                    <property name="pixel_size">48</property>
+                    <property name="icon_name">file-catalog-symbolic</property>
+                    <property name="icon_size">6</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="spacing">12</property>
             <child>
-              <object class="GtkHBox" id="hbox3">
+              <object class="GtkBox" id="vbox2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment3">
+                  <object class="GtkBox" id="vbox4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="left_padding">12</property>
-                    <property name="right_padding">12</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkImage" id="icon_image">
+                      <object class="GtkAlignment" id="info_alignment">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="yalign">0</property>
-                        <property name="pixel_size">48</property>
-                        <property name="icon_name">file-catalog-symbolic</property>
-                        <property name="icon_size">6</property>
+                        <property name="top_padding">6</property>
+                        <property name="bottom_padding">12</property>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkVBox" id="vbox2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">12</property>
                     <child>
-                      <object class="GtkVBox" id="vbox4">
+                      <object class="GtkBox" id="hbox6">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkAlignment" id="info_alignment">
+                          <object class="GtkLabel" id="label1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="top_padding">6</property>
-                            <property name="bottom_padding">12</property>
+                            <property name="label" translatable="yes">_Group files by:</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="group_by_combobox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="model">group_by_liststore</property>
+                            <property name="active">0</property>
                             <child>
-                              <placeholder/>
+                              <object class="GtkCellRendererPixbuf" id="cellrenderertext1">
+                                <property name="xpad">3</property>
+                              </object>
+                              <attributes>
+                                <attribute name="icon-name">2</attribute>
+                              </attributes>
+                            </child>
+                            <child>
+                              <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                              <attributes>
+                                <attribute name="text">1</attribute>
+                              </attributes>
                             </child>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
+                            <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">0</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="include_subfolders_checkbutton">
+                        <property name="label" translatable="yes">_Include sub-folders</property>
+                        <property name="use_action_appearance">False</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="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="ignore_singletons_checkbutton">
+                        <property name="label" translatable="yes">Ignore catalogs with a single 
file</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="left_padding">12</property>
                         <child>
-                          <object class="GtkHBox" id="hbox6">
+                          <object class="GtkBox" id="single_catalog_box">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="label1">
+                              <object class="GtkCheckButton" id="use_singletons_catalog_checkbutton">
+                                <property name="label" translatable="yes">Put single files in the 
catalog:</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
                                 <property name="xalign">0</property>
-                                <property name="label" translatable="yes">_Group files by:</property>
-                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -148,159 +194,55 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkComboBox" id="group_by_combobox">
+                              <object class="GtkEntry" id="single_catalog_entry">
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="model">group_by_liststore</property>
-                                <property name="active">0</property>
-                                <child>
-                                  <object class="GtkCellRendererPixbuf" id="cellrenderertext1">
-                                    <property name="xpad">3</property>
-                                  </object>
-                                  <attributes>
-                                    <attribute name="icon-name">2</attribute>
-                                  </attributes>
-                                </child>
-                                <child>
-                                  <object class="GtkCellRendererText" id="cellrenderertext2"/>
-                                  <attributes>
-                                    <attribute name="text">1</attribute>
-                                  </attributes>
-                                </child>
+                                <property name="sensitive">False</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">●</property>
+                                <property name="text" translatable="yes">Singles</property>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
+                                <property name="expand">True</property>
                                 <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkCheckButton" id="include_subfolders_checkbutton">
-                            <property name="label" translatable="yes">_Include sub-folders</property>
-                            <property name="use_action_appearance">False</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="xalign">0</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkCheckButton" id="ignore_singletons_checkbutton">
-                            <property name="label" translatable="yes">Ignore catalogs with a single 
file</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment1">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkHBox" id="single_catalog_box">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="spacing">6</property>
-                                <child>
-                                  <object class="GtkCheckButton" id="use_singletons_catalog_checkbutton">
-                                    <property name="label" translatable="yes">Put single files in the 
catalog:</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="xalign">0</property>
-                                    <property name="draw_indicator">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkEntry" id="single_catalog_entry">
-                                    <property name="visible">True</property>
-                                    <property name="sensitive">False</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">●</property>
-                                    <property name="text" translatable="yes">Singles</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">4</property>
-                          </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">True</property>
                         <property name="fill">True</property>
-                        <property name="position">0</property>
+                        <property name="position">4</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">False</property>
+                <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
     </child>
-    <action-widgets>
-      <action-widget response="0">cancel_button</action-widget>
-      <action-widget response="0">start_button</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkImage" id="image1">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="stock">gtk-execute</property>
   </object>
 </interface>
diff --git a/extensions/catalogs/dlg-organize-files.c b/extensions/catalogs/dlg-organize-files.c
index 7f93a50..562b6e3 100644
--- a/extensions/catalogs/dlg-organize-files.c
+++ b/extensions/catalogs/dlg-organize-files.c
@@ -101,7 +101,21 @@ dlg_organize_files (GthBrowser *browser,
        data->browser = browser;
        data->folder = g_file_dup (folder);
        data->builder = _gtk_builder_new_from_file ("organize-files.ui", "catalogs");
-       data->dialog = GET_WIDGET ("organize_files_dialog");
+
+       data->dialog = g_object_new (GTK_TYPE_DIALOG,
+                                    "title", _("Organize Files"),
+                                    "transient-for", GTK_WINDOW (browser),
+                                    "modal", TRUE,
+                                    "resizable", FALSE,
+                                    "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+                                    NULL);
+       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))),
+                          _gtk_builder_get_widget (data->builder, "dialog_content"));
+       gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
+                               _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+                               _GTK_LABEL_EXECUTE, GTK_RESPONSE_OK,
+                               NULL);
+       _gtk_dialog_add_class_to_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, 
GTK_STYLE_CLASS_SUGGESTED_ACTION);
 
        info_bar = gth_info_bar_new ();
        gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_INFO);
@@ -155,11 +169,11 @@ dlg_organize_files (GthBrowser *browser,
                          "destroy",
                          G_CALLBACK (destroy_cb),
                          data);
-       g_signal_connect_swapped (G_OBJECT (GET_WIDGET ("cancel_button")),
+       g_signal_connect_swapped (gtk_dialog_get_widget_for_response (GTK_DIALOG (data->dialog), 
GTK_RESPONSE_CANCEL),
                                  "clicked",
                                  G_CALLBACK (gtk_widget_destroy),
                                  data->dialog);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("start_button")),
+       g_signal_connect (gtk_dialog_get_widget_for_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK),
                          "clicked",
                          G_CALLBACK (start_button_clicked_cb),
                          data);
@@ -179,7 +193,5 @@ dlg_organize_files (GthBrowser *browser,
 
        /* run dialog. */
 
-       gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
-       gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
        gtk_widget_show (data->dialog);
 }
diff --git a/extensions/catalogs/gth-organize-task.c b/extensions/catalogs/gth-organize-task.c
index 21f05ec..ce4cebf 100644
--- a/extensions/catalogs/gth-organize-task.c
+++ b/extensions/catalogs/gth-organize-task.c
@@ -48,6 +48,7 @@ struct _GthOrganizeTaskPrivate
        gboolean        create_singletons;
        GthCatalog     *singletons_catalog;
        GtkBuilder     *builder;
+       GtkWidget      *dialog;
        GtkListStore   *results_liststore;
        GHashTable     *catalogs;
        GdkPixbuf      *icon_pixbuf;
@@ -69,7 +70,7 @@ gth_organize_task_finalize (GObject *object)
 
        self = GTH_ORGANIZE_TASK (object);
 
-       gtk_widget_destroy (GET_WIDGET ("organize_files_dialog"));
+       gtk_widget_destroy (self->priv->dialog);
        g_object_unref (self->priv->folder);
        _g_object_unref (self->priv->singletons_catalog);
        g_object_unref (self->priv->builder);
@@ -204,9 +205,8 @@ done_func (GError   *error,
        gtk_label_set_ellipsize (GTK_LABEL (GET_WIDGET ("progress_label")), PANGO_ELLIPSIZE_NONE);
        g_free (status_text);
 
-       gtk_widget_hide (GET_WIDGET ("cancel_button"));
-       gtk_widget_show (GET_WIDGET ("close_button"));
-       gtk_widget_show (GET_WIDGET ("ok_button"));
+       gtk_widget_set_sensitive (GET_WIDGET ("cancel_button"), FALSE);
+       gtk_dialog_set_response_sensitive (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_OK, TRUE);
 }
 
 
@@ -576,14 +576,13 @@ gth_organize_task_exec (GthTask *base)
                                   done_func,
                                   self);
 
-       gtk_widget_show (GET_WIDGET ("cancel_button"));
-       gtk_widget_hide (GET_WIDGET ("close_button"));
-       gtk_widget_hide (GET_WIDGET ("ok_button"));
-       gtk_window_set_transient_for (GTK_WINDOW (GET_WIDGET ("organize_files_dialog")), GTK_WINDOW 
(self->priv->browser));
-       gtk_window_set_modal (GTK_WINDOW (GET_WIDGET ("organize_files_dialog")), TRUE);
-       gtk_widget_show (GET_WIDGET ("organize_files_dialog"));
+       gtk_widget_set_sensitive (GET_WIDGET ("cancel_button"), TRUE);
+       gtk_dialog_set_response_sensitive (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_OK, FALSE);
+       gtk_window_set_transient_for (GTK_WINDOW (self->priv->dialog), GTK_WINDOW (self->priv->browser));
+       gtk_window_set_modal (GTK_WINDOW (self->priv->dialog), TRUE);
+       gtk_widget_show (self->priv->dialog);
 
-       gth_task_dialog (base, TRUE, GET_WIDGET ("organize_files_dialog"));
+       gth_task_dialog (base, TRUE, self->priv->dialog);
 }
 
 
@@ -607,6 +606,9 @@ organize_files_dialog_response_cb (GtkDialog *dialog,
                        response_id = GTK_RESPONSE_CANCEL;
        }
 
+       if (self->priv->organized && (response_id == GTK_RESPONSE_CANCEL))
+               response_id = GTK_RESPONSE_CLOSE;
+
        switch (response_id) {
        case GTK_RESPONSE_CANCEL:
                gth_task_cancel (GTH_TASK (self));
@@ -782,6 +784,17 @@ select_none_button_clicked_cb (GtkButton *button,
 
 
 static void
+cancel_button_clicked_cb (GtkButton *button,
+                         gpointer   user_data)
+{
+       GthOrganizeTask *self = user_data;
+
+       if (! self->priv->organized)
+               gth_task_cancel (GTH_TASK (self));
+}
+
+
+static void
 gth_organize_task_init (GthOrganizeTask *self)
 {
        GIcon *icon;
@@ -792,6 +805,20 @@ gth_organize_task_init (GthOrganizeTask *self)
        self->priv->catalogs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
        self->priv->filter = gth_main_get_general_filter ();
 
+       self->priv->dialog = g_object_new (GTK_TYPE_DIALOG,
+                                          "title", _("Organize Files"),
+                                          "transient-for", GTK_WINDOW (self->priv->browser),
+                                          "resizable", TRUE,
+                                          "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+                                          NULL);
+       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self->priv->dialog))),
+                          _gtk_builder_get_widget (self->priv->builder, "dialog_content"));
+       gtk_dialog_add_buttons (GTK_DIALOG (self->priv->dialog),
+                               _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+                               _GTK_LABEL_SAVE, GTK_RESPONSE_OK,
+                               NULL);
+       _gtk_dialog_add_class_to_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_OK, 
GTK_STYLE_CLASS_SUGGESTED_ACTION);
+
        gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->priv->results_liststore), KEY_COLUMN, 
GTK_SORT_ASCENDING);
        g_object_set (GET_WIDGET ("catalog_name_cellrenderertext"), "editable", TRUE, NULL);
 
@@ -804,6 +831,7 @@ gth_organize_task_init (GthOrganizeTask *self)
        self->priv->file_list = gth_file_list_new (gth_grid_view_new (), GTH_FILE_LIST_MODE_NORMAL, FALSE);
        gth_file_list_set_caption (GTH_FILE_LIST (self->priv->file_list), "standard::display-name");
        gtk_widget_show (self->priv->file_list);
+       gtk_widget_set_size_request (self->priv->file_list, 350, -1);
        gtk_box_pack_start (GTK_BOX (GET_WIDGET ("preview_box")), self->priv->file_list, TRUE, TRUE, 0);
 
        g_signal_connect (GET_WIDGET ("catalog_name_cellrenderertext"),
@@ -814,11 +842,11 @@ gth_organize_task_init (GthOrganizeTask *self)
                          "toggled",
                          G_CALLBACK (create_cellrenderertoggle_toggled_cb),
                          self);
-       g_signal_connect (GET_WIDGET ("organize_files_dialog"),
+       g_signal_connect (self->priv->dialog,
                          "delete-event",
                          G_CALLBACK (gtk_true),
                          NULL);
-       g_signal_connect (GET_WIDGET ("organize_files_dialog"),
+       g_signal_connect (self->priv->dialog,
                          "response",
                          G_CALLBACK (organize_files_dialog_response_cb),
                          self);
@@ -834,6 +862,10 @@ gth_organize_task_init (GthOrganizeTask *self)
                          "clicked",
                          G_CALLBACK (select_none_button_clicked_cb),
                          self);
+       g_signal_connect (GET_WIDGET ("cancel_button"),
+                         "clicked",
+                         G_CALLBACK (cancel_button_clicked_cb),
+                         self);
 }
 
 


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