Merge lp:~laney/exaile/logind-shutdown into lp:exaile/3.4.x

Proposed by Iain Lane
Status: Merged
Approved by: Dustin Spicuzza
Approved revision: 4369
Merged at revision: 4395
Proposed branch: lp:~laney/exaile/logind-shutdown
Merge into: lp:exaile/3.4.x
Diff against target: 34 lines (+13/-8)
1 file modified
plugins/shutdown/__init__.py (+13/-8)
To merge this branch: bzr merge lp:~laney/exaile/logind-shutdown
Reviewer Review Type Date Requested Status
Dustin Spicuzza Pending
Review via email: mp+161988@code.launchpad.net

Description of the change

ConsoleKit is deprecated; we should use logind to shut the computer down if we can.

To post a comment you must log in.
Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

I apologize for reviewing this way after the merge was proposed.

I'm showing my ignorance here, but some questions come to mind about this:
- Is logind supported on all computers that ConsoleKit was found on? Or should we have something that uses both?
- Why shouldn't we use both interfaces, or do a detect of some kind to see if one or the other is there, and use the appropriate one?

Thanks!

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Oh, never mind. I missed that. You did try to use both interfaces.

Sigh. More sleep required. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/shutdown/__init__.py'
2--- plugins/shutdown/__init__.py 2012-10-03 04:43:15 +0000
3+++ plugins/shutdown/__init__.py 2013-05-01 23:37:33 +0000
4@@ -118,17 +118,22 @@
5 bus = dbus.SystemBus()
6
7 try:
8- proxy = bus.get_object('org.freedesktop.ConsoleKit',
9- '/org/freedesktop/ConsoleKit/Manager')
10- proxy.Stop(dbus_interface='org.freedesktop.ConsoleKit.Manager')
11+ proxy = bus.get_object('org.freedesktop.login1',
12+ '/org/freedesktop/login1')
13+ proxy.PowerOff(False, dbus_interface='org.freedesktop.login1.Manager')
14 except dbus.exceptions.DBusException:
15 try:
16- proxy = bus.get_object('org.freedesktop.Hal',
17- '/org/freedesktop/Hal/devices/computer')
18- proxy.Shutdown(dbus_interface='org.freedesktop.Hal.Device.SystemPowerManagement')
19+ proxy = bus.get_object('org.freedesktop.ConsoleKit',
20+ '/org/freedesktop/ConsoleKit/Manager')
21+ proxy.Stop(dbus_interface='org.freedesktop.ConsoleKit.Manager')
22 except dbus.exceptions.DBusException:
23- self.message.show_warning(_('Shutdown failed'),
24- _('Computer could not be shutdown using D-Bus.'))
25+ try:
26+ proxy = bus.get_object('org.freedesktop.Hal',
27+ '/org/freedesktop/Hal/devices/computer')
28+ proxy.Shutdown(dbus_interface='org.freedesktop.Hal.Device.SystemPowerManagement')
29+ except dbus.exceptions.DBusException:
30+ self.message.show_warning(_('Shutdown failed'),
31+ _('Computer could not be shutdown using D-Bus.'))
32
33 def destroy(self):
34 """

Subscribers

People subscribed via source and target branches