summaryrefslogtreecommitdiff
path: root/UpdateManager/UpdateManager.py
diff options
context:
space:
mode:
authorglatzor@ubuntu.com <>2006-09-02 11:51:49 +0200
committerglatzor@ubuntu.com <>2006-09-02 11:51:49 +0200
commitb139b31fd1adc363d59338b45b7c82dcec51d44b (patch)
tree688ce53f51c39e34c496763b4392b92dbaa393fa /UpdateManager/UpdateManager.py
parenta53e49c46faae31eccd7e65b8ffbcb91fbcaf18a (diff)
parent650cb474d23914be801af09d5f9c31cfc9765b07 (diff)
downloadpython-apt-b139b31fd1adc363d59338b45b7c82dcec51d44b.tar.gz
* merge with mvo
Diffstat (limited to 'UpdateManager/UpdateManager.py')
-rw-r--r--UpdateManager/UpdateManager.py39
1 files changed, 34 insertions, 5 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 78348e60..3e958db0 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -219,8 +219,9 @@ class UpdateList:
" of Ubuntu"), 10),
("%s-updates" % dist, "Ubuntu", _("Recommended updates of "
"Ubuntu"), 9),
- ("%s-backports" % dist, "Ubuntu", _("Backports of Ubuntu"), 8),
- (dist, "Ubuntu", _("Updates of Ubuntu"), 7)]
+ ("%s-proposed" % dist, "Ubuntu", _("Proposed updates for Ubuntu"), 8),
+ ("%s-backports" % dist, "Ubuntu", _("Backports of Ubuntu"), 7),
+ (dist, "Ubuntu", _("Updates of Ubuntu"), 6)]
self.pkgs = {}
self.matcher = {}
@@ -671,7 +672,6 @@ class UpdateManager(SimpleGladeApp):
apt_pkg.PkgSystemUnLock()
except SystemError:
pass
-# cmd = ["gksu","--",
cmd = ["gksu", "--desktop", "/usr/share/applications/synaptic.desktop",
"--", "/usr/sbin/synaptic", "--hide-main-window",
"--non-interactive", "--parent-window-id", "%s" % (id) ]
@@ -713,6 +713,9 @@ class UpdateManager(SimpleGladeApp):
# don't display apt-listchanges, we already showed the changelog
os.environ["APT_LISTCHANGES_FRONTEND"]="none"
+ # Do not suspend during the update process
+ (dev, cookie) = self.inhibit_sleep()
+
# set window to insensitive
self.window_main.set_sensitive(False)
self.window_main.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
@@ -727,18 +730,44 @@ class UpdateManager(SimpleGladeApp):
while gtk.events_pending():
gtk.main_iteration()
self.fillstore()
+
+ # Allow suspend after synaptic is finished
+ if cookie != False:
+ self.allow_sleep(dev, cookie)
self.window_main.set_sensitive(True)
self.window_main.window.set_cursor(None)
+ def inhibit_sleep(self):
+ """Send a dbus signal to gnome-power-manager to not suspend
+ the system"""
+ try:
+ 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.Inhibit('UpdateManager', 'Updating system')
+ return (dev, cookie)
+ except Exception, e:
+ print "could not send the dbus Inhibit signal: %s" % e
+ return (False, False)
+
+ def allow_sleep(self, dev, cookie):
+ """Send a dbus signal to gnome-power-manager to allow a suspending
+ the system"""
+ dev.UnInhibit(cookie)
+
def toggled(self, renderer, path):
""" a toggle button in the listview was toggled """
iter = self.store.get_iter(path)
+ pkg = self.store.get_value(iter, LIST_PKG)
+ if pkg is None:
+ return
if self.store.get_value(iter, LIST_INSTALL):
self.store.set_value(iter, LIST_INSTALL, False)
- self.remove_update(self.store.get_value(iter, LIST_PKG))
+ self.remove_update(pkg)
else:
self.store.set_value(iter, LIST_INSTALL, True)
- self.add_update(self.store.get_value(iter, LIST_PKG))
+ self.add_update(pkg)
def on_treeview_update_row_activated(self, treeview, path, column, *args):
"""