[meld/ui-next] filediff: Move sync point actions to GActions



commit 2a2eef11e23ff694b415f5ff3efd0869daf019ff
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 24 07:26:04 2019 +1000

    filediff: Move sync point actions to GActions

 data/ui/filediff-ui.xml       |  9 ---------
 data/ui/meldapp-ui.xml        |  2 --
 meld/filediff.py              |  8 ++++----
 meld/resources/gtk/menus.ui   | 14 ++++++++++++++
 meld/resources/ui/filediff.ui | 14 --------------
 5 files changed, 18 insertions(+), 29 deletions(-)
---
diff --git a/data/ui/filediff-ui.xml b/data/ui/filediff-ui.xml
index 36e50a76..2eb7d80c 100644
--- a/data/ui/filediff-ui.xml
+++ b/data/ui/filediff-ui.xml
@@ -1,11 +1,5 @@
 <ui>
   <menubar name="Menubar">
-    <menu action="EditMenu">
-      <placeholder name="EditActionsPlaceholder">
-        <menuitem action="SplitAdd"/>
-        <menuitem action="SplitClear"/>
-      </placeholder>
-    </menu>
     <menu action="ChangesMenu">
       <placeholder name="ChangesActions">
         <menuitem action="PrevConflict"/>
@@ -39,9 +33,6 @@
     <menuitem action="Cut" />
     <menuitem action="Copy" />
     <menuitem action="Paste" />
-    <separator/>
-    <menuitem action="SplitAdd"/>
-    <menuitem action="SplitClear"/>
   </popup>
 
 </ui>
diff --git a/data/ui/meldapp-ui.xml b/data/ui/meldapp-ui.xml
index ca045ad6..7bdc2f14 100644
--- a/data/ui/meldapp-ui.xml
+++ b/data/ui/meldapp-ui.xml
@@ -5,8 +5,6 @@
       <menuitem action="Copy"/>
       <menuitem action="Paste"/>
       <separator/>
-      <placeholder name="EditActionsPlaceholder" />
-      <separator/>
       <menuitem action="Find"/>
       <menuitem action="FindNext"/>
       <menuitem action="FindPrevious"/>
diff --git a/meld/filediff.py b/meld/filediff.py
index c59e5a88..cc19d91b 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -289,6 +289,8 @@ class FileDiff(Gtk.VBox, MeldDoc):
 
         # Manually handle GAction additions
         actions = (
+            ('add-sync-point', self.add_sync_point),
+            ('clear-sync-point', self.clear_sync_points),
             ('format-as-patch', self.action_format_as_patch),
             ('next-change', self.action_next_change),
             ('open-external', self.action_open_external),
@@ -2162,9 +2164,8 @@ class FileDiff(Gtk.VBox, MeldDoc):
         self.textview[src].add_fading_highlight(
             mark0, mark1, 'conflict', 500000)
 
-    @Template.Callback()
     @with_focused_pane
-    def add_sync_point(self, pane, action):
+    def add_sync_point(self, pane, *args):
         # Find a non-complete syncpoint, or create a new one
         if self.syncpoints and None in self.syncpoints[-1]:
             syncpoint = self.syncpoints.pop()
@@ -2213,8 +2214,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
 
         self.refresh_comparison()
 
-    @Template.Callback()
-    def clear_sync_points(self, action):
+    def clear_sync_points(self, *args):
         self.syncpoints = []
         self.linediffer.syncpoints = []
         for t in self.textview:
diff --git a/meld/resources/gtk/menus.ui b/meld/resources/gtk/menus.ui
index 7fafd898..ee0a239e 100644
--- a/meld/resources/gtk/menus.ui
+++ b/meld/resources/gtk/menus.ui
@@ -58,6 +58,20 @@
           </item>
         </section>
       </submenu>
+      <submenu>
+        <attribute name="label" translatable="yes">Comparison</attribute>
+        <section>
+          <attribute name="id">synchronisation-section</attribute>
+          <item>
+            <attribute name="label">Add Synchronization Point</attribute>
+            <attribute name="action">view.add-sync-point</attribute>
+          </item>
+          <item>
+            <attribute name="label">Clear Synchronization Points</attribute>
+            <attribute name="action">view.clear-sync-point</attribute>
+          </item>
+        </section>
+      </submenu>
     </section>
     <section>
       <attribute name="id">submenu-section</attribute>
diff --git a/meld/resources/ui/filediff.ui b/meld/resources/ui/filediff.ui
index 4ae93bee..86fc9026 100644
--- a/meld/resources/ui/filediff.ui
+++ b/meld/resources/ui/filediff.ui
@@ -730,20 +730,6 @@
     </child>
   </template>
   <object class="GtkActionGroup" id="FilediffActions">
-    <child>
-      <object class="GtkAction" id="SplitAdd">
-        <property name="label" translatable="yes">Add Synchronization Point</property>
-        <property name="tooltip" translatable="yes">Add a synchronization point for changes between 
files</property>
-        <signal name="activate" handler="add_sync_point" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkAction" id="SplitClear">
-        <property name="label" translatable="yes">Clear Synchronization Points</property>
-        <property name="tooltip" translatable="yes">Clear sychronization points for changes between 
files</property>
-        <signal name="activate" handler="clear_sync_points" swapped="no"/>
-      </object>
-    </child>
     <child>
       <object class="GtkAction" id="PrevConflict">
         <property name="label" translatable="yes">Previous Conflict</property>


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