summaryrefslogtreecommitdiff
path: root/UpdateManager
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-04-23 17:13:17 +0200
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-04-23 17:13:17 +0200
commit96efe8c5c6e3c2d03026eec77634072a6c013c36 (patch)
tree0d543b4866dffc5da286fdf4cd6eedd562f374d6 /UpdateManager
parent5f1f74aabdbae3796555f57c3784c9c4da610b8f (diff)
downloadpython-apt-96efe8c5c6e3c2d03026eec77634072a6c013c36.tar.gz
* Do not allow to suspend the computer during updating
thanks to Aaron Whitehouse - fixes bug #40697 (needs more testing, the connection to the session dbus failed on my local machine)
Diffstat (limited to 'UpdateManager')
-rw-r--r--UpdateManager/UpdateManager.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 6ac83197..59a19612 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -498,6 +498,8 @@ class UpdateManager(SimpleGladeApp):
self.invoke_manager(INSTALL)
def invoke_manager(self, action):
+ # Do not suspend during the update process
+ (dev, cookie) = self.inhibit_sleep()
# check first if no other package manager is runing
# don't display apt-listchanges, we already showed the changelog
@@ -519,6 +521,30 @@ class UpdateManager(SimpleGladeApp):
self.fillstore()
self.window_main.set_sensitive(True)
self.window_main.window.set_cursor(None)
+ # Allow suspend after synaptic is finished
+ if cookie != False:
+ self.allow_sleep(dev, cookie)
+
+ def inhibit_sleep(self):
+ """Send a dbus signal to gnome-power-manager to not suspend
+ the system"""
+ try:
+ import dbus
+ bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
+ devobj = bus.get_object('org.gnome.PowerManager',
+ '/org/gnome/PowerManager')
+ dev = dbus.Interface(devobj, "org.gnome.PowerManager")
+ cookie = dev.InhibitInactiveSleep('UpdateManager',
+ 'Updating system')
+ return (dev, cookie)
+ except:
+ print "could not send the dbus InhibitInactiveSleep signal"
+ return (False, False)
+
+ def allow_sleep(self, dev, cookie):
+ """Send a dbus signal to gnome-power-manager to allow a suspending
+ the system"""
+ dev.AllowInactiveSleep(cookie)
def toggled(self, renderer, path_string):
""" a toggle button in the listview was toggled """