[meld/ui-next] meldwindow: Move new-tab to GAction and header bar
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/ui-next] meldwindow: Move new-tab to GAction and header bar
- Date: Sat, 23 Mar 2019 01:59:10 +0000 (UTC)
commit 85731fb34e478a121006e888d259847b6dbd3729
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Jan 28 09:16:19 2019 +1000
meldwindow: Move new-tab to GAction and header bar
data/ui/meldapp-ui.xml | 2 --
meld/meldwindow.py | 10 ++++------
meld/resources/ui/appwindow.ui | 16 ++++++++++++++++
3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/meldapp-ui.xml b/data/ui/meldapp-ui.xml
index 19475f18..efbb6d42 100644
--- a/data/ui/meldapp-ui.xml
+++ b/data/ui/meldapp-ui.xml
@@ -2,7 +2,6 @@
<menubar name="Menubar">
<placeholder name="AppMenuPlaceholder" />
<menu action="FileMenu">
- <menuitem action="New" />
<menuitem action="Save" />
<menuitem action="SaveAs" />
<placeholder name="RevertPlaceholder" />
@@ -55,7 +54,6 @@
</menubar>
<toolbar action="Toolbar">
- <toolitem action="New"/>
<placeholder name="GeneralActions" />
<toolitem action="PrevChange"/>
<toolitem action="NextChange"/>
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 42886467..4366a5a1 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -57,9 +57,6 @@ class MeldWindow(Gtk.ApplicationWindow):
actions = (
("FileMenu", None, _("_File")),
- ("New", Gtk.STOCK_NEW, _("_New Comparison…"), "<Primary>N",
- _("Start a new comparison"),
- self.on_menu_file_new_activate),
("Save", Gtk.STOCK_SAVE, None, None,
_("Save the current file"),
self.on_menu_save_activate),
@@ -185,9 +182,10 @@ class MeldWindow(Gtk.ApplicationWindow):
# Manually handle GAction additions
actions = (
- ("close", self.on_menu_close_activate, None),
+ ("close", self.on_menu_close_activate),
+ ("new-tab", self.on_action_new_tab_activate),
)
- for (name, callback, accel) in actions:
+ for name, callback in actions:
action = Gio.SimpleAction.new(name, None)
action.connect('activate', callback)
self.add_action(action)
@@ -379,7 +377,7 @@ class MeldWindow(Gtk.ApplicationWindow):
self.actiongroup.get_action("PrevChange").set_sensitive(have_prev)
self.actiongroup.get_action("NextChange").set_sensitive(have_next)
- def on_menu_file_new_activate(self, menuitem):
+ def on_action_new_tab_activate(self, action, parameter):
self.append_new_comparison()
def on_menu_save_activate(self, menuitem):
diff --git a/meld/resources/ui/appwindow.ui b/meld/resources/ui/appwindow.ui
index d6dfcee8..96b9262e 100644
--- a/meld/resources/ui/appwindow.ui
+++ b/meld/resources/ui/appwindow.ui
@@ -14,6 +14,22 @@
<object class="GtkHeaderBar" id="header_bar">
<property name="show-close-button">true</property>
<property name="visible">true</property>
+ <child>
+ <object class="GtkButton">
+ <property name="action-name">win.new-tab</property>
+ <property name="visible">true</property>
+ <property name="tooltip-text">Start a new comparison</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">document-new-symbolic</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
<child>
<object class="GtkMenuButton" id="gear_menu_button">
<property name="visible">true</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]