[gnome-music: 1/2] Eliminate clone for self.proxy.call_sync() func



commit 5823c405abdd68c3544f967135d13ee4552b3431
Author: shivanipoddariiith <shivani poddar92 gmail com>
Date:   Wed Aug 14 19:25:59 2013 +0530

    Eliminate clone for self.proxy.call_sync() func

 gnomemusic/window.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 418a0d4..a603da7 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -30,20 +30,19 @@ class Window(Gtk.ApplicationWindow):
                                             '/org/gnome/SettingsDaemon/MediaKeys',
                                             'org.gnome.SettingsDaemon.MediaKeys',
                                             None)
-        self.proxy.call_sync('GrabMediaPlayerKeys',
-                             GLib.Variant('(su)', ('Music', 0)),
-                             Gio.DBusCallFlags.NONE,
-                             -1,
-                             None)
+        self._grab_media_player_keys()
         self.proxy.connect('g-signal', self._handle_media_keys)
 
-    def _windows_focus_cb(self, window, event):
+    def _grab_media_player_keys(self):
         self.proxy.call_sync('GrabMediaPlayerKeys',
                              GLib.Variant('(su)', ('Music', 0)),
                              Gio.DBusCallFlags.NONE,
                              -1,
                              None)
 
+    def _windows_focus_cb(self, window, event):
+        self._grab_media_player_keys()
+
     def _handle_media_keys(self, proxy, sender, signal, parameters):
         if signal != 'MediaPlayerKeyPressed':
             print('Received an unexpected signal \'%s\' from media player'.format(signal))


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