[gnome-tweak-tool/wip/pwood/app-chooser: 4/4] StartUpTwea k: Add mnemonic to activate ‘+’ button



commit 296d1d716b86e5d5806980762fc425cebaae22c5
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Tue Apr 14 14:16:39 2015 +0100

    StartUpTweak: Add mnemonic to activate ‘+’ button
    
    Add a mnemonics for ‘+’ and ‘=’ to open the AppChooser dialog.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747986

 gtweak/tweaks/tweak_group_startup.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
index f825b55..3c84460 100644
--- a/gtweak/tweaks/tweak_group_startup.py
+++ b/gtweak/tweaks/tweak_group_startup.py
@@ -254,6 +254,20 @@ class AddStartupTweak(Gtk.ListBoxRow, Tweak):
         self.btn.get_style_context().remove_class("button")
         self.add(self.btn)
         self.get_style_context().add_class('tweak-startup')
+        self.connect("map", self._on_map)
+        self.connect("unmap", self._on_unmap)
+
+    def _on_map(self, row):
+        toplevel=self.get_toplevel()
+        if toplevel.is_toplevel:
+            for k in [Gdk.KEY_equal, Gdk.KEY_plus, Gdk.KEY_KP_Add]:
+                toplevel.add_mnemonic(k, self.btn)
+
+    def _on_unmap(self, row):
+        toplevel=self.get_toplevel()
+        if toplevel.is_toplevel:
+            for k in [Gdk.KEY_equal, Gdk.KEY_plus, Gdk.KEY_KP_Add]:
+                toplevel.remove_mnemonic(k, self.btn)
 
 class AutostartListBoxTweakGroup(ListBoxTweakGroup):
     def __init__(self):


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