Commits

Vladimir Kolev  committed 07d54b3

Updated the Multimedia Key functionality. Now works as expected on GNOME.

  • Participants
  • Parent commits 08b1f38

Comments (0)

Files changed (1)

File lib/tfuncs.py

         self.win = _window
 
     def run(self):
-        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-        bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
-        bus_object = bus.get_object('org.gnome.SettingsDaemon',
+        try:
+            dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+            bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
+            bus_object = bus.get_object('org.gnome.SettingsDaemon',
                                 '/org/gnome/SettingsDaemon/MediaKeys')
     
-        dbus_interface = 'org.gnome.SettingsDaemon.MediaKeys'
-        bus_object.GrabMediaPlayerKeys("MyMultimediaThingy", 0,
+            dbus_interface = 'org.gnome.SettingsDaemon.MediaKeys'
+            bus_object.GrabMediaPlayerKeys("MyMultimediaThingy", 0,
                                   dbus_interface=dbus_interface)
 
-        bus_object.connect_to_signal('MediaPlayerKeyPressed',
+            bus_object.connect_to_signal('MediaPlayerKeyPressed',
                                 self.on_media_key)
+        except:
+            pass
     
     def on_media_key(self, comes_from, what):
         if what in ['Stop', 'Play', 'Next', 'Previous']: