[meld/ui-next] filediff: Move view actions to headerbar slot



commit afea151fd83e9cb0de27e6df9b1ca05bad556869
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Mar 15 07:33:25 2019 +1000

    filediff: Move view actions to headerbar slot

 meld/filediff.py                      |   6 +-
 meld/resources/meld.gresource.xml     |   1 +
 meld/resources/ui/filediff-actions.ui | 141 ++++++++++++++++++++++++++++++++
 meld/resources/ui/filediff.ui         | 148 ----------------------------------
 4 files changed, 147 insertions(+), 149 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 84ee8c0f..859e641f 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -126,7 +126,6 @@ class FileDiff(Gtk.VBox, MeldDoc):
     actiongutter1 = Template.Child()
     actiongutter2 = Template.Child()
     actiongutter3 = Template.Child()
-    copy_action_button = Template.Child()
     dummy_toolbar_actiongutter0 = Template.Child()
     dummy_toolbar_actiongutter1 = Template.Child()
     dummy_toolbar_actiongutter2 = Template.Child()
@@ -329,6 +328,11 @@ class FileDiff(Gtk.VBox, MeldDoc):
 
         self.popup_menu = Gtk.Menu()
 
+        builder = Gtk.Builder.new_from_resource(
+            '/org/gnome/meld/ui/filediff-actions.ui')
+        self.toolbar_actions = builder.get_object('view-toolbar')
+        self.copy_action_button = builder.get_object('copy_action_button')
+
         # Handle sourcemap visibility binding
         self.bind_property(
             'show-sourcemap', self.sourcemap_revealer, 'reveal-child',
diff --git a/meld/resources/meld.gresource.xml b/meld/resources/meld.gresource.xml
index 2ac0a9ad..388f326c 100644
--- a/meld/resources/meld.gresource.xml
+++ b/meld/resources/meld.gresource.xml
@@ -17,6 +17,7 @@
     <file>ui/encoding-selector.ui</file>
     <file>ui/filter-list.ui</file>
     <file>ui/filediff.ui</file>
+    <file>ui/filediff-actions.ui</file>
     <file>ui/findbar.ui</file>
     <file>ui/language-selector.ui</file>
     <file>ui/new-diff-tab.ui</file>
diff --git a/meld/resources/ui/filediff-actions.ui b/meld/resources/ui/filediff-actions.ui
new file mode 100644
index 00000000..d72be9f3
--- /dev/null
+++ b/meld/resources/ui/filediff-actions.ui
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkBox" id="view-toolbar">
+    <property name="visible">True</property>
+    <property name="orientation">horizontal</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="action-name">view.file-push-left</property>
+        <property name="use-action-appearance">False</property>
+        <property name="tooltip-text">Push current change to the left</property>
+        <property name="focus_on_click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">go-previous-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="action-name">view.file-push-right</property>
+        <property name="use-action-appearance">False</property>
+        <property name="tooltip-text">Push current change to the right</property>
+        <property name="focus_on_click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">go-next-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="action-name">view.file-pull-left</property>
+        <property name="use-action-appearance">False</property>
+        <property name="tooltip-text">Pull change from the left</property>
+        <property name="focus_on_click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <!-- FIXME: icon abuse -->
+            <property name="icon-name">go-last-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="action-name">view.file-pull-right</property>
+        <property name="use-action-appearance">False</property>
+        <property name="tooltip-text">Pull change from the right</property>
+        <property name="focus_on_click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <!-- FIXME: icon abuse -->
+            <property name="icon-name">go-first-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkMenuButton" id="copy_action_button">
+        <property name="visible">true</property>
+        <property name="focus_on_click">False</property>
+        <property name="tooltip-text">Copy chunks</property>
+        <property name="use_popover">True</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">edit-copy-symbolic</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="action-name">view.file-delete</property>
+        <property name="use-action-appearance">False</property>
+        <property name="tooltip-text">Delete change</property>
+        <property name="focus_on_click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">edit-delete-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">start</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/meld/resources/ui/filediff.ui b/meld/resources/ui/filediff.ui
index a0febbf4..62c2e26c 100644
--- a/meld/resources/ui/filediff.ui
+++ b/meld/resources/ui/filediff.ui
@@ -8,154 +8,6 @@
     <property name="can_focus">False</property>
     <signal name="key-press-event" handler="on_key_event" swapped="no"/>
     <signal name="key-release-event" handler="on_key_event" swapped="no"/>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <style>
-          <class name="meld-actionbar"/>
-        </style>
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="action-name">view.file-push-left</property>
-            <property name="use-action-appearance">False</property>
-            <property name="tooltip-text">Push current change to the left</property>
-            <property name="focus_on_click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">go-previous-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="action-name">view.file-push-right</property>
-            <property name="use-action-appearance">False</property>
-            <property name="tooltip-text">Push current change to the right</property>
-            <property name="focus_on_click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">go-next-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="action-name">view.file-pull-left</property>
-            <property name="use-action-appearance">False</property>
-            <property name="tooltip-text">Pull change from the left</property>
-            <property name="focus_on_click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <!-- FIXME: icon abuse -->
-                <property name="icon-name">go-last-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="action-name">view.file-pull-right</property>
-            <property name="use-action-appearance">False</property>
-            <property name="tooltip-text">Pull change from the right</property>
-            <property name="focus_on_click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <!-- FIXME: icon abuse -->
-                <property name="icon-name">go-first-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkMenuButton" id="copy_action_button">
-            <property name="visible">true</property>
-            <property name="focus_on_click">False</property>
-            <property name="tooltip-text">Copy chunks</property>
-            <property name="use_popover">True</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">edit-copy-symbolic</property>
-                <property name="visible">true</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton">
-            <property name="visible">True</property>
-            <property name="action-name">view.file-delete</property>
-            <property name="use-action-appearance">False</property>
-            <property name="tooltip-text">Delete change</property>
-            <property name="focus_on_click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">edit-delete-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">start</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="DiffGrid" id="grid">
         <property name="visible">True</property>


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