[meld] dirdiff: Migrate to same in-pane toolbar as filediff



commit 9f6b49791e31aaee220c136d721adb25c35f9439
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu Feb 6 07:58:01 2014 +1000

    dirdiff: Migrate to same in-pane toolbar as filediff

 data/ui/dirdiff.ui |  138 +++++++++++++++++++++++++++++++++++++++++++++++-----
 meld/dirdiff.py    |   22 +++++---
 2 files changed, 139 insertions(+), 21 deletions(-)
---
diff --git a/data/ui/dirdiff.ui b/data/ui/dirdiff.ui
index b935cad..c5d229b 100644
--- a/data/ui/dirdiff.ui
+++ b/data/ui/dirdiff.ui
@@ -106,12 +106,30 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkFileChooserButton" id="fileentry0">
+              <object class="GtkToolbar" id="file_toolbar0">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <property name="action">select-folder</property>
-                <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                <property name="show-arrow">False</property>
+                <property name="icon-size">1</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+                <child>
+                  <object class="GtkToolItem" id="fileentry_toolitem0">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
+                    <child>
+                      <object class="GtkFileChooserButton" id="fileentry0">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="action">select-folder</property>
+                        <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -121,12 +139,30 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFileChooserButton" id="fileentry1">
+              <object class="GtkToolbar" id="file_toolbar1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <property name="action">select-folder</property>
-                <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                <property name="show-arrow">False</property>
+                <property name="icon-size">1</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+                <child>
+                  <object class="GtkToolItem" id="fileentry_toolitem1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
+                    <child>
+                      <object class="GtkFileChooserButton" id="fileentry1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="action">select-folder</property>
+                        <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">3</property>
@@ -136,12 +172,30 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFileChooserButton" id="fileentry2">
+              <object class="GtkToolbar" id="file_toolbar2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <property name="action">select-folder</property>
-                <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                <property name="show-arrow">False</property>
+                <property name="icon-size">1</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+                <child>
+                  <object class="GtkToolItem" id="fileentry_toolitem2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
+                    <child>
+                      <object class="GtkFileChooserButton" id="fileentry2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="action">select-folder</property>
+                        <signal name="file-set" handler="on_fileentry_file_set" swapped="no"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
@@ -151,6 +205,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkToolbar" id="dummy_toolbar_diffmap1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">6</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="DiffMap" id="diffmap1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -164,6 +233,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkToolbar" id="dummy_toolbar_linkmap1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">4</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkDrawingArea" id="linkmap1">
                 <property name="width_request">50</property>
                 <property name="visible">True</property>
@@ -179,6 +263,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkToolbar" id="dummy_toolbar_diffmap0">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="DiffMap" id="diffmap0">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -192,6 +291,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkToolbar" id="dummy_toolbar_linkmap0">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkDrawingArea" id="linkmap0">
                 <property name="width_request">50</property>
                 <property name="visible">True</property>
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 4119421..4705bc2 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -323,7 +323,11 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
 
         self.map_widgets_into_lists(["treeview", "fileentry", "scrolledwindow",
                                      "diffmap", "linkmap", "msgarea_mgr",
-                                     "vbox"])
+                                     "vbox", "dummy_toolbar_linkmap",
+                                     "file_toolbar", "fileentry_toolitem"])
+
+        for toolitem in self.fileentry_toolitem:
+            toolitem.set_expand(True)
 
         self.widget.ensure_style()
         self.on_style_updated(self.widget)
@@ -1403,16 +1407,16 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 idx = 1 if i else 0
                 w.setup(scroll, self.get_state_traversal(idx), [self.fill_colors, self.line_colors])
 
-            toshow =  self.scrolledwindow[:n] + self.fileentry[:n]
-            toshow += self.linkmap[:n-1] + self.diffmap[:n]
-            toshow += self.vbox[:n] + self.msgarea_mgr[:n]
-            for widget in toshow:
+            for widget in (
+                    self.vbox[:n] + self.file_toolbar[:n] + self.diffmap[:n] +
+                    self.linkmap[:n - 1] + self.dummy_toolbar_linkmap[:n - 1]):
                 widget.show()
-            tohide =  self.scrolledwindow[n:] + self.fileentry[n:]
-            tohide += self.linkmap[n-1:] + self.diffmap[n:]
-            tohide += self.vbox[n:] + self.msgarea_mgr[n:]
-            for widget in tohide:
+
+            for widget in (
+                    self.vbox[n:] + self.file_toolbar[n:] + self.diffmap[n:] +
+                    self.linkmap[n - 1:] + self.dummy_toolbar_linkmap[n - 1:]):
                 widget.hide()
+
             if self.num_panes != 0: # not first time through
                 self.num_panes = n
                 self.on_fileentry_file_set(None)


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