[gnome-music/freeze-break: 42/107] window: Properly check for Ctrl+F



commit 6b6f2241413a76c380ff13feaebafd6458e05ece
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Sat Sep 7 23:22:42 2013 +0800

    window: Properly check for Ctrl+F
    
    Before pressing just F will open the search bar because the modifiers
    are not checked.

 gnomemusic/window.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index ed31df4..681d0c9 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -30,7 +30,7 @@
 # delete this exception statement from your version.
 
 
-from gi.repository import Gtk, Gio, GLib, Tracker
+from gi.repository import Gtk, Gdk, Gio, GLib, Tracker
 from gettext import gettext as _
 
 from gnomemusic.toolbar import Toolbar, ToolbarState
@@ -144,7 +144,9 @@ class Window(Gtk.ApplicationWindow):
         self.show()
 
     def _on_key_press(self, widget, event):
-        if event.keyval == 102:  # Ctrl-f
+        modifiers = Gtk.accelerator_get_default_mod_mask()
+        if (event.keyval == Gdk.KEY_f and
+                (event.state & modifiers) == Gdk.ModifierType.CONTROL_MASK):
             self._show_searchbar(not self.toolbar.searchbar.get_child_revealed())
 
     def _notify_mode_disconnect(self, data=None):


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