1
##########################################################################
2
# Copyright 2009 Carlos Ribeiro
4
# This file is part of Radio Tray
6
# Radio Tray is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 1 of the License, or
9
# (at your option) any later version.
11
# Radio Tray is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with Radio Tray. If not, see <http://www.gnu.org/licenses/>.
19
##########################################################################
21
from Plugin import Plugin
24
class MateMediaKeysPlugin(Plugin):
27
super(MateMediaKeysPlugin, self).__init__()
30
def initialize(self, name, eventManagerWrapper, eventSubscriber, provider, cfgProvider, mediator, tooltip):
33
self.eventManagerWrapper = eventManagerWrapper
34
self.eventSubscriber = eventSubscriber
35
self.provider = provider
36
self.cfgProvider = cfgProvider
37
self.mediator = mediator
38
self.tooltip = tooltip
47
self.bus = dbus.SessionBus()
48
self.bus_object = self.bus.get_object('org.mate.SettingsDaemon', '/org/mate/SettingsDaemon/MediaKeys')
49
self.bus_object.GrabMediaPlayerKeys("RadioTray", 0, dbus_interface='org.mate.SettingsDaemon.MediaKeys')
50
self.bus_object.connect_to_signal('MediaPlayerKeyPressed', self.handle_mediakey)
52
print "Could not bind to mate for Media Keys"
55
def handle_mediakey(self, *mmkeys):
58
if (self.mediator.isPlaying()):
61
self.mediator.playLast()
63
if (self.mediator.isPlaying()):