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

Proposed by Nicholas Skaggs
Status: Superseded
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 (community) Needs Information
Review via email: mp+81298@code.launchpad.net

This proposal has been superseded by a proposal from 2011-11-21.

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.
Revision history for this message
Michael Vogt (mvo) wrote :

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
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

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.
>

Revision history for this message
Michael Vogt (mvo) 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 :)

2260. By Nicholas Skaggs

removed dbus interface completely and only use freedesktop interface

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

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.
>

Unmerged revisions

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-09 02:47:24 +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: