Merge lp:~nskaggs/update-manager/fix-for-702418 into lp:update-manager

Proposed by Nicholas Skaggs on 2011-11-21
Status: Merged
Merged at revision: 2278
Proposed branch: lp:~nskaggs/update-manager/fix-for-702418
Merge into: lp:update-manager
Diff against target: 60 lines (+10/-34)
1 file modified
UpdateManager/Core/utils.py (+10/-34)
To merge this branch: bzr merge lp:~nskaggs/update-manager/fix-for-702418
Reviewer Review Type Date Requested Status
Michael Vogt 2011-11-21 Pending
Review via email: mp+82946@code.launchpad.net

This proposal supersedes a proposal from 2011-11-04.

Description of the change

This is a fix for bug 702418. I added a check to prevent the calling the old dbus interface check for gnome-power-manager under any desktop environment that is not gnome. This will instead simply call the FreeDesktop powermanager without attempting the old check.

To post a comment you must log in.
Michael Vogt (mvo) wrote : Posted in a previous version of this proposal

Thanks for your branch!

Testing for gnome in the env is not quite sufficient as the default session will use
"XDG_CURRENT_DESKTOP=Unity" and DESKTOP_SESSION=ubuntu these days. Actually this makes
me wonder if calling the old interface can be dropped entirely? Could you maybe check
if gnome now supports the freedesktop one?

review: Needs Information
Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

Michael, my idea in only checking for "gnome" was that only gnome 2.x
would need the old gnome dbus check. Unity and gnome shell both
support the the new freedesktop interace, as does kde and xfce and
lxde.

I'll go ahead and drop the old interface call completely and update
the branch. I will also attempt to confirm with the gnome developers
that we are free to drop legacy support. Thanks,

Nicholas

On Mon, Nov 7, 2011 at 4:16 AM, Michael Vogt <email address hidden> wrote:
> Review: Needs Information
>
> Thanks for your branch!
>
> Testing for gnome in the env is not quite sufficient as the default session will use
> "XDG_CURRENT_DESKTOP=Unity" and DESKTOP_SESSION=ubuntu these days. Actually this makes
> me wonder if calling the old interface can be dropped entirely? Could you maybe check
> if gnome now supports the freedesktop one?
> --
> https://code.launchpad.net/~nskaggs/update-manager/fix-for-702418/+merge/81298
> You are the owner of lp:~nskaggs/update-manager/fix-for-702418.
>

Michael Vogt (mvo) wrote : Posted in a previous version of this proposal

Thanks Nocholas! I think dropping the old interface is indeed the best option. We just need to make sure that that works on lucid, but I bet it does :)

Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

Pushed a commit that removed the old interface completely. Are we
wanting backport the fix to lucid or ?

Nicholas

On Tue, Nov 8, 2011 at 5:54 AM, Michael Vogt <email address hidden> wrote:
> Thanks Nocholas! I think dropping the old interface is indeed the best option. We just need to make sure that that works on lucid, but I bet it does :)
> --
> https://code.launchpad.net/~nskaggs/update-manager/fix-for-702418/+merge/81298
> You are the owner of lp:~nskaggs/update-manager/fix-for-702418.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/Core/utils.py'
2--- UpdateManager/Core/utils.py 2011-11-07 14:29:56 +0000
3+++ UpdateManager/Core/utils.py 2011-11-21 23:05:28 +0000
4@@ -311,46 +311,22 @@
5 #print >>sys.stderr, "on_battery returned error: ", e
6 return False
7
8-def _inhibit_sleep_old_interface():
9- """
10- Send a dbus signal to org.gnome.SettingsDaemon.Power to not suspend
11- the system, this is to support upgrades from pre-gutsy g-p-m
12- """
13- import dbus
14- bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
15- devobj = bus.get_object('org.gnome.SettingsDaemon',
16- '/org/gnome/SettingsDaemon/Power')
17- dev = dbus.Interface(devobj, "org.gnome.SettingsDaemon.Power")
18- cookie = dev.Inhibit('UpdateManager', 'Updating system')
19- return (dev, cookie)
20-
21-def _inhibit_sleep_new_interface():
22- """
23- Send a dbus signal to gnome-power-manager to not suspend
24- the system
25- """
26- import dbus
27- bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
28- devobj = bus.get_object('org.freedesktop.PowerManagement',
29- '/org/freedesktop/PowerManagement/Inhibit')
30- dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit")
31- cookie = dev.Inhibit('UpdateManager', 'Updating system')
32- return (dev, cookie)
33-
34 def inhibit_sleep():
35 """
36 Send a dbus signal to power-manager to not suspend
37- the system, try both the new freedesktop and the
38- old gnome dbus interface
39+ the system, using the freedesktop common interface
40 """
41 try:
42- return _inhibit_sleep_old_interface()
43+ import dbus
44+ bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
45+ devobj = bus.get_object('org.freedesktop.PowerManagement',
46+ '/org/freedesktop/PowerManagement/Inhibit')
47+ dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit")
48+ cookie = dev.Inhibit('UpdateManager', 'Updating system')
49+ return (dev, cookie)
50 except Exception:
51- try:
52- return _inhibit_sleep_new_interface()
53- except Exception:
54- #print "could not send the dbus Inhibit signal: %s" % e
55- return (False, False)
56+ #print "could not send the dbus Inhibit signal: %s" % e
57+ return (False, False)
58
59 def allow_sleep(dev, cookie):
60 """Send a dbus signal to gnome-power-manager to allow a suspending

Subscribers

People subscribed via source and target branches

to status/vote changes: