diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-09-01 20:03:24 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-09-06 13:37:08 +0800 |
commit | b7c9d3ec599064bee965a017eb6182d56c156e41 (patch) | |
tree | b83b8589add426582f961c3a4293db8ba8367d9f /goa-mc-plugin | |
parent | 08dedb8027eb3947b689ee7c99171406c8e82b47 (diff) | |
download | gsoc2013-empathy-b7c9d3ec599064bee965a017eb6182d56c156e41.tar.gz gsoc2013-empathy-b7c9d3ec599064bee965a017eb6182d56c156e41.tar.zst gsoc2013-empathy-b7c9d3ec599064bee965a017eb6182d56c156e41.zip |
watch for chat properties change to detect if Chat has enabled/disabled
Diffstat (limited to 'goa-mc-plugin')
-rw-r--r-- | goa-mc-plugin/mcp-account-manager-goa.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c index 6f06f340d..8717b2e45 100644 --- a/goa-mc-plugin/mcp-account-manager-goa.c +++ b/goa-mc-plugin/mcp-account-manager-goa.c @@ -158,6 +158,22 @@ get_tp_account_name (GoaAccount *account) return name; } +static void +object_chat_changed_cb (GoaObject *object, + GParamSpec *spec, + McpAccountManagerGoa *self) +{ + GoaAccount *account = goa_object_peek_account (object); + char *name = get_tp_account_name (account); + gboolean enabled; + + enabled = (goa_object_peek_chat (object) != NULL); + + DEBUG ("%s %s", name, enabled ? "enabled" : "disabled"); + + if (self->priv->ready) + g_signal_emit_by_name (self, "toggled", name, enabled); +} static void _new_account (McpAccountManagerGoa *self, @@ -175,6 +191,9 @@ _new_account (McpAccountManagerGoa *self, if (self->priv->ready) g_signal_emit_by_name (self, "created", account_name); + + tp_g_signal_connect_object (object, "notify::chat", + G_CALLBACK (object_chat_changed_cb), self, 0); } @@ -221,23 +240,6 @@ _account_removed_cb (GoaClient *client, } static void -_account_changed_cb (GoaClient *client, - GoaObject *object, - McpAccountManagerGoa *self) -{ - GoaAccount *account = goa_object_peek_account (object); - char *name = get_tp_account_name (account); - gboolean enabled; - - enabled = (goa_object_peek_chat (object) != NULL); - - DEBUG ("%s %s", name, enabled ? "enabled" : "disabled"); - - if (self->priv->ready) - g_signal_emit_by_name (self, "toggled", name, enabled); -} - -static void _goa_client_new_cb (GObject *obj, GAsyncResult *result, gpointer user_data) @@ -268,8 +270,6 @@ _goa_client_new_cb (GObject *obj, G_CALLBACK (_account_added_cb), self); g_signal_connect (self->priv->client, "account-removed", G_CALLBACK (_account_removed_cb), self); - g_signal_connect (self->priv->client, "account-changed", - G_CALLBACK (_account_changed_cb), self); } |