aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-07-22 13:37:16 +0100
committerConor Curran <conor.curran@canonical.com>2011-07-22 13:37:16 +0100
commitbc829db4eb65f7373b2ff13cd5dc8ce96a469af3 (patch)
tree80aec548a655d5ed458747a24d53b45851238011 /src
parent3bfa1c305fbba42c48ed7338e5064745bb122a91 (diff)
downloadayatana-indicator-session-bc829db4eb65f7373b2ff13cd5dc8ce96a469af3.tar.gz
ayatana-indicator-session-bc829db4eb65f7373b2ff13cd5dc8ce96a469af3.tar.bz2
ayatana-indicator-session-bc829db4eb65f7373b2ff13cd5dc8ce96a469af3.zip
transaction object now properly disposed of
Diffstat (limited to 'src')
-rw-r--r--src/apt-transaction.c40
-rw-r--r--src/apt-watcher.c13
-rw-r--r--src/dbus-shared-names.h3
3 files changed, 45 insertions, 11 deletions
diff --git a/src/apt-transaction.c b/src/apt-transaction.c
index e613507..4f800ad 100644
--- a/src/apt-transaction.c
+++ b/src/apt-transaction.c
@@ -54,14 +54,16 @@ apt_transaction_init (AptTransaction *self)
{
self->proxy = NULL;
self->id = NULL;
-
}
static void
apt_transaction_finalize (GObject *object)
{
- /* TODO: Add deinitalization code here */
AptTransaction* self = APT_TRANSACTION(object);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (self->proxy),
+ G_CALLBACK (apt_transaction_receive_signal),
+ self);
+
if (self->proxy != NULL){
g_object_unref (self->proxy);
self->proxy = NULL;
@@ -91,7 +93,7 @@ apt_transaction_investigate(AptTransaction* self)
GError * error = NULL;
self->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ G_DBUS_PROXY_FLAGS_NONE,
NULL, /* GDBusInterfaceInfo */
"org.debian.apt",
self->id,
@@ -127,14 +129,42 @@ apt_transaction_receive_signal (GDBusProxy * proxy,
gpointer user_data)
{
g_return_if_fail (APT_IS_TRANSACTION (user_data));
- AptTransaction* self = APT_TRANSACTION(user_data);
-
+ AptTransaction* self = APT_TRANSACTION(user_data);
+
+ GVariant* role = g_dbus_proxy_get_cached_property (self->proxy,
+ "Role");
+ g_debug ("Role variant type = %s", g_variant_get_type_string (role));
+ if (g_variant_is_of_type (role, G_VARIANT_TYPE_STRING) == TRUE){
+ gchar* current_role = NULL;
+ g_variant_get (role, "s", &current_role);
+ g_debug ("Current transaction role = %s", current_role);
+ if (g_strcmp0 (current_role, "role-commit-packages") == 0 ||
+ g_strcmp0 (current_role, "role-upgrade-system") == 0){
+ g_debug ("UPGRADE IN PROGRESS");
+ g_signal_emit (self,
+ signals[UPDATE],
+ 0,
+ UPGRADE_IN_PROGRESS);
+ // Return from here because an upgrade is in progress so
+ // any other information is irrelevant.
+ return;
+ }
+ }
+
if (g_strcmp0(signal_name, "PropertyChanged") == 0)
{
gchar* prop_name= NULL;
GVariant* value = NULL;
g_variant_get (parameters, "(sv)", &prop_name, &value);
+ g_debug ("transaction prop update - prop = %s", prop_name);
+
+ if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING) == TRUE){
+ gchar* key = NULL;
+ g_variant_get (value, "s", &key);
+ g_debug ("transaction prop update - value = %s", key);
+ }
+
if (g_strcmp0 (prop_name, "Dependencies") == 0){
diff --git a/src/apt-watcher.c b/src/apt-watcher.c
index 546c733..c7238ec 100644
--- a/src/apt-watcher.c
+++ b/src/apt-watcher.c
@@ -235,18 +235,23 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans,
AptState state = (AptState)update;
- if ( state == UP_TO_DATE ){
+ if (state == UP_TO_DATE){
dbusmenu_menuitem_property_set (self->apt_item,
DBUSMENU_MENUITEM_PROP_LABEL,
_("Software Up to Date"));
}
- else if ( state == UPDATES_AVAILABLE ){
+ else if (state == UPDATES_AVAILABLE){
dbusmenu_menuitem_property_set (self->apt_item,
DBUSMENU_MENUITEM_PROP_LABEL,
_("Updates Available…"));
+ }
+ else if (state == UPGRADE_IN_PROGRESS){
+ dbusmenu_menuitem_property_set (self->apt_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Updates Installing…"));
}
self->current_state = state;
- g_object_unref (self->current_transaction);
+ g_object_unref (G_OBJECT(self->current_transaction));
self->current_transaction = NULL;
}
@@ -255,7 +260,7 @@ apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id)
{
if (self->current_transaction == NULL){
self->current_transaction = apt_transaction_new (transaction_id);
- g_object_ref (self->current_transaction);
+ //g_object_ref (self->current_transaction);
g_signal_connect (G_OBJECT(self->current_transaction),
"state-update",
G_CALLBACK(apt_watcher_transaction_state_update_cb), self);
diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h
index 13ad227..7c6c14f 100644
--- a/src/dbus-shared-names.h
+++ b/src/dbus-shared-names.h
@@ -24,8 +24,7 @@ typedef enum {
UP_TO_DATE,
CHECKING_FOR_UPDATES,
UPDATES_AVAILABLE,
- FINISHED_CHECKING,
- UPDATING,
+ UPGRADE_IN_PROGRESS,
RESTART_NEEDED
}AptState;