diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-09-07 15:34:50 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-09-07 15:34:50 +0100 |
commit | bc14f0aeb2dbd61c077f1f61c41303f0db4b9781 (patch) | |
tree | 17b5bc6e21fb33fd2b4b40296b0f41c0313d3fb0 | |
parent | d0d4fd57cf3a25547c570139cc6a311ce05eed44 (diff) | |
download | ayatana-indicator-session-bc14f0aeb2dbd61c077f1f61c41303f0db4b9781.tar.gz ayatana-indicator-session-bc14f0aeb2dbd61c077f1f61c41303f0db4b9781.tar.bz2 ayatana-indicator-session-bc14f0aeb2dbd61c077f1f61c41303f0db4b9781.zip |
more hoop jumping for apt
-rw-r--r-- | src/apt-watcher.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 1f88868..d2cd1b5 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -272,18 +272,23 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, self->reboot_query = g_timeout_add_seconds (2, apt_watcher_query_reboot_status, self); + self->current_state = state; } else if (state == UPDATES_AVAILABLE){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Available…")); + self->current_state = state; } else if (state == UPGRADE_IN_PROGRESS){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Installing…")); + self->current_state = state; } else if (state == FINISHED){ + gboolean query_again = FALSE; + // Only query if the previous state was an upgrade. if (self->current_state == UPGRADE_IN_PROGRESS){ if (self->reboot_query != 0){ @@ -296,14 +301,30 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, apt_watcher_query_reboot_status, self); } - } - // Set the current state - self->current_state = state; - - if (self->current_state != UPGRADE_IN_PROGRESS){ + else{ + query_again = TRUE; + } + self->current_state = state; + g_object_unref (G_OBJECT(self->current_transaction)); self->current_transaction = NULL; - } + // Mental ah yes, because a real transaction (like one which is manually triggered by the user + // by hitting check on update-mgr) does not return a 'dependency' prop update which means + // I cannot figure out from that transaction if an update is available. + // Only when it finishes and I'm confident it was not an transaction concerned with actually updating should i then fire off another transaction, + // this time being a simulation which 'should' figure out if an update is available. + // The Reality is all APT transactions behave differently, an obsolutely nightmare of an API to use. + if (query_again){ + g_dbus_proxy_call (self->proxy, + "UpgradeSystem", + g_variant_new("(b)", TRUE), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + apt_watcher_upgrade_system_cb, + self); + } + } } |