[meld/ui-next] Move format-as-patch to a GAction
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/ui-next] Move format-as-patch to a GAction
- Date: Sat, 23 Mar 2019 01:59:46 +0000 (UTC)
commit 0f9c741892dab45689bedaaecc85d6863c93fe54
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Feb 17 13:14:14 2019 +1000
Move format-as-patch to a GAction
data/ui/filediff-ui.xml | 3 ---
data/ui/meldapp-ui.xml | 2 --
meld/filediff.py | 6 +++---
meld/resources/gtk/menus.ui | 13 +++++++++++++
meld/resources/ui/filediff.ui | 7 -------
5 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/filediff-ui.xml b/data/ui/filediff-ui.xml
index 9f33feb1..f3fc2e66 100644
--- a/data/ui/filediff-ui.xml
+++ b/data/ui/filediff-ui.xml
@@ -5,9 +5,6 @@
<menuitem action="SaveAll"/>
<menuitem action="Revert"/>
</placeholder>
- <placeholder name="FileActionsPlaceholder">
- <menuitem action="MakePatch"/>
- </placeholder>
</menu>
<menu action="EditMenu">
<placeholder name="EditActionsPlaceholder">
diff --git a/data/ui/meldapp-ui.xml b/data/ui/meldapp-ui.xml
index 64628a15..9cca039e 100644
--- a/data/ui/meldapp-ui.xml
+++ b/data/ui/meldapp-ui.xml
@@ -6,8 +6,6 @@
<menuitem action="SaveAs" />
<placeholder name="RevertPlaceholder" />
<separator/>
- <placeholder name="FileActionsPlaceholder" />
- <separator/>
<menuitem action="Recent" />
<menuitem action="Close" />
</menu>
diff --git a/meld/filediff.py b/meld/filediff.py
index 2d44c896..20fd45c6 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -278,6 +278,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
# Manually handle GAction additions
actions = (
+ ('format-as-patch', self.action_format_as_patch),
('next-change', self.action_next_change),
('previous-change', self.action_previous_change),
('refresh', self.action_refresh),
@@ -1809,8 +1810,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
else:
self.state = ComparisonState.Normal
- @Template.Callback()
- def make_patch(self, *extra):
+ def action_format_as_patch(self, *extra):
dialog = PatchDialog(self)
dialog.run()
@@ -2037,7 +2037,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
self.dummy_toolbar_actiongutter[(n - 1) * 2:]):
widget.hide()
- self.actiongroup.get_action("MakePatch").set_sensitive(n > 1)
+ self.set_action_enabled('format-as-patch', n > 1)
def chunk_iter(i):
def chunks(bounds):
diff --git a/meld/resources/gtk/menus.ui b/meld/resources/gtk/menus.ui
index d0030b06..b90e0148 100644
--- a/meld/resources/gtk/menus.ui
+++ b/meld/resources/gtk/menus.ui
@@ -32,6 +32,19 @@
</section>
</submenu>
</section>
+ <section>
+ <attribute name="id">submenu-section</attribute>
+ <submenu>
+ <attribute name="label" translatable="yes">Tools</attribute>
+ <section>
+ <attribute name="id">tool-section</attribute>
+ <item>
+ <attribute name="label">Format as Patch…</attribute>
+ <attribute name="action">view.format-as-patch</attribute>
+ </item>
+ </section>
+ </submenu>
+ </section>
<section>
<attribute name="id">preferences-section</attribute>
<item>
diff --git a/meld/resources/ui/filediff.ui b/meld/resources/ui/filediff.ui
index a5b580b1..1af42ec8 100644
--- a/meld/resources/ui/filediff.ui
+++ b/meld/resources/ui/filediff.ui
@@ -730,13 +730,6 @@
</child>
</template>
<object class="GtkActionGroup" id="FilediffActions">
- <child>
- <object class="GtkAction" id="MakePatch">
- <property name="label" translatable="yes">Format as Patch…</property>
- <property name="tooltip" translatable="yes">Create a patch using differences between files</property>
- <signal name="activate" handler="make_patch" swapped="no"/>
- </object>
- </child>
<child>
<object class="GtkAction" id="SaveAll">
<property name="label" translatable="yes">Save A_ll</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]