[gnome-music/wip/mschraal/gtk-event-controller: 4/7] mediakeys: Use Gtk.EventController for focus-in
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/gtk-event-controller: 4/7] mediakeys: Use Gtk.EventController for focus-in
- Date: Tue, 18 Dec 2018 10:12:36 +0000 (UTC)
commit 21df8cffcf7becb39ee8b6bd74bb15db73703ddb
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Aug 28 21:12:07 2018 +0200
mediakeys: Use Gtk.EventController for focus-in
gnomemusic/mediakeys.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/mediakeys.py b/gnomemusic/mediakeys.py
index 7e8836f7..18d87488 100644
--- a/gnomemusic/mediakeys.py
+++ b/gnomemusic/mediakeys.py
@@ -22,7 +22,7 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
-from gi.repository import GObject, Gio, GLib
+from gi.repository import GObject, Gio, GLib, Gtk
from gnomemusic import log
@@ -79,12 +79,14 @@ class MediaKeys(GObject.GObject):
"Error: Failed to contact settings daemon:", e.message)
return
- self._grab_media_player_keys()
self._media_keys_proxy.connect("g-signal", self._handle_media_keys)
- self._window.connect("focus-in-event", self._grab_media_player_keys)
+
+ self._ctrlr = Gtk.EventControllerKey().new(self._window)
+ self._ctrlr.props.propagation_phase = Gtk.PropagationPhase.CAPTURE
+ self._ctrlr.connect("focus-in", self._grab_media_player_keys)
@log
- def _grab_media_player_keys(self, window=None, event=None):
+ def _grab_media_player_keys(self, controllerkey=None):
def proxy_call_finished(proxy, result, data=None):
try:
proxy.call_finish(result)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]