Skip to content

Commit

Permalink
Add support for the N9 cable headset (bug 1526)
Browse files Browse the repository at this point in the history
The button on the cable headset will toggle the
pause state of gPodder's built-in media player.
  • Loading branch information
thp committed Dec 29, 2011
1 parent 2419552 commit 684cc20
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gpodder/qmlui/helper.py
Expand Up @@ -78,6 +78,7 @@ def __init__(self):

if gpodder.ui.harmattan:
headset_path = '/org/freedesktop/Hal/devices/computer_logicaldev_input_0'
headset_path2 = '/org/freedesktop/Hal/devices/computer_logicaldev_input'
elif gpodder.ui.fremantle:
headset_path = '/org/freedesktop/Hal/devices/computer_logicaldev_input_1'
else:
Expand All @@ -87,10 +88,13 @@ def __init__(self):
system_bus = dbus.SystemBus()
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path)
if gpodder.ui.harmattan:
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path2)

def handle_button(self, signal, button):
if signal == 'ButtonPressed':
if button == 'play-cd':
if button in ('play-cd', 'phone'):
self.playPressed.emit()
elif button == 'pause-cd':
self.pausePressed.emit()
Expand Down

0 comments on commit 684cc20

Please sign in to comment.