[gnome-music] window: Cleanup searchbar keyboard trigger



commit 98525aa3e454fd7959fc417c772248d88529db5e
Author: Marinus Schraal <mschraal src gnome org>
Date:   Sun Sep 11 23:38:05 2016 +0200

    window: Cleanup searchbar keyboard trigger
    
    The logic and comment for the searchbar keyboard trigger was still
    considering space for play/pause, remove it.

 gnomemusic/window.py |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index a619423..bff112d 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -437,20 +437,14 @@ class Window(Gtk.ApplicationWindow):
                 if self.toolbar._selectionMode:
                     self.toolbar.set_selection_mode(False)
 
-        # Open search bar when typing printable chars if it not opened
-        # Make sure we skip unprintable chars and don't grab space press
-        # (this is used for play/pause)
-        if (not self.toolbar.searchbar.get_search_mode()
-                and not event.keyval == Gdk.KEY_space):
-            if (event_and_modifiers == Gdk.ModifierType.SHIFT_MASK or
-                    event_and_modifiers == 0) and \
-                    GLib.unichar_isprint(chr(Gdk.keyval_to_unicode(event.keyval))):
-                self.toolbar.searchbar.show_bar(True)
-        else:
-            if not self.toolbar.searchbar.get_search_mode():
-                if event.keyval == Gdk.KEY_space and self.player.actionbar.get_visible():
-                    if self.get_focus() != self.player.playBtn:
-                        self.player.play_pause()
+        # Open the search bar when typing printable chars.
+        key_unic = Gdk.keyval_to_unicode(event.keyval)
+        if ((not self.toolbar.searchbar.get_search_mode()
+                and not event.keyval == Gdk.KEY_space)
+                and GLib.unichar_isprint(chr(key_unic))
+                and (event_and_modifiers == Gdk.ModifierType.SHIFT_MASK
+                    or event_and_modifiers == 0)):
+            self.toolbar.searchbar.show_bar(True)
 
     @log
     def _notify_mode_disconnect(self, data=None):


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