[meld] meldwindow: Add F10 as a main menu accelerator (#539)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] meldwindow: Add F10 as a main menu accelerator (#539)
- Date: Wed, 30 Dec 2020 20:50:47 +0000 (UTC)
commit fc430ed8d5273042aca32f88bbd134f360d041c1
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu Dec 31 06:48:55 2020 +1000
meldwindow: Add F10 as a main menu accelerator (#539)
meld/accelerators.py | 1 +
meld/meldwindow.py | 8 ++++++--
meld/resources/ui/appwindow.ui | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/meld/accelerators.py b/meld/accelerators.py
index ad116e06..ccf2ea7e 100644
--- a/meld/accelerators.py
+++ b/meld/accelerators.py
@@ -23,6 +23,7 @@ VIEW_ACCELERATORS: Dict[str, Union[str, Sequence[str]]] = {
'view.save-as': '<Primary><Shift>S',
'view.undo': '<Primary>Z',
'win.close': '<Primary>W',
+ 'win.gear-menu': 'F10',
'win.new-tab': '<Primary>N',
'win.stop': 'Escape',
# File comparison actions
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 73535233..0235a1e6 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -74,12 +74,16 @@ class MeldWindow(Gtk.ApplicationWindow):
state_actions = (
(
"fullscreen", self.action_fullscreen_change,
- GLib.Variant.new_boolean(False)
+ GLib.Variant.new_boolean(False),
+ ),
+ (
+ "gear-menu", None, GLib.Variant.new_boolean(False),
),
)
for (name, callback, state) in state_actions:
action = Gio.SimpleAction.new_stateful(name, None, state)
- action.connect('change-state', callback)
+ if callback:
+ action.connect('change-state', callback)
self.add_action(action)
# Initialise sensitivity for important actions
diff --git a/meld/resources/ui/appwindow.ui b/meld/resources/ui/appwindow.ui
index bd18b640..f0122083 100644
--- a/meld/resources/ui/appwindow.ui
+++ b/meld/resources/ui/appwindow.ui
@@ -168,6 +168,7 @@
</child>
<child>
<object class="GtkMenuButton" id="gear_menu_button">
+ <property name="action-name">win.gear-menu</property>
<property name="visible">true</property>
<property name="can_focus">False</property>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]