From 7879be8a05651c288363acd03008d2f3bfb73ffa Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 31 Mar 2012 18:14:56 +0200 Subject: [PATCH] [Rigo] implement restarting_system_upgrade() signal handling --- rigo/rigo_app.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/rigo/rigo_app.py b/rigo/rigo_app.py index 67feebf39..330a5129a 100644 --- a/rigo/rigo_app.py +++ b/rigo/rigo_app.py @@ -185,6 +185,7 @@ class RigoServiceController(GObject.Object): _APPLICATION_PROCESSED_SIGNAL = "application_processed" _APPLICATIONS_MANAGED_SIGNAL = "applications_managed" _UNSUPPORTED_APPLICATIONS_SIGNAL = "unsupported_applications" + _RESTARTING_UPGRADE_SIGNAL = "restarting_system_upgrade" _SUPPORTED_APIS = [0] def __init__(self, rigo_app, activity_rwsem, @@ -460,6 +461,14 @@ class RigoServiceController(GObject.Object): self._unsupported_applications_signal, dbus_interface=self.DBUS_INTERFACE) + # RigoDaemon tells us that the currently scheduled + # System Upgrade is being restarted due to further + # updates being available + self.__entropy_bus.connect_to_signal( + self._RESTARTING_UPGRADE_SIGNAL, + self._restarting_system_upgrade_signal, + dbus_interface=self.DBUS_INTERFACE) + return self.__entropy_bus ### GOBJECT EVENTS @@ -650,6 +659,22 @@ class RigoServiceController(GObject.Object): __name__, "_applications_managed_signal: applications-managed") + def _restarting_system_upgrade_signal(self, updates_amount): + """ + System Upgrade Activity is being restarted due to further updates + being available. This happens when RigoDaemon processed critical + updates during the previous activity execution. + """ + if self._nc is not None: + msg = "%s. %s" % ( + _("System Upgrade Activity is being restarted"), + ngettext("There is %i more update", + "There are %i more updates", + int(updates_amount)) % (updates_amount,),) + box = self.ServiceNotificationBox( + prepare_markup(msg), Gtk.MessageType.INFO) + self._nc.append(box, timeout=20) + def _unsupported_applications_signal(self, manual_package_ids, package_ids): const_debug_write(