aboutsummaryrefslogtreecommitdiffstats
path: root/goa-mc-plugin
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-06-15 01:37:30 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-06 13:37:07 +0800
commit0b4a5527117a282de064b0ea0a9bc920a1029dae (patch)
treee22f9a02cd5cf87290410e7a6aaf5cd59fb3115d /goa-mc-plugin
parent56ad8aa9ae095378b17d9bea03dd3f41fab232e2 (diff)
downloadgsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar.gz
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar.bz2
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar.lz
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar.xz
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.tar.zst
gsoc2013-empathy-0b4a5527117a282de064b0ea0a9bc920a1029dae.zip
Track accounts created and destroyed from GOA
Diffstat (limited to 'goa-mc-plugin')
-rw-r--r--goa-mc-plugin/mcp-account-manager-goa.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c
index b0b86c58b..5a2049532 100644
--- a/goa-mc-plugin/mcp-account-manager-goa.c
+++ b/goa-mc-plugin/mcp-account-manager-goa.c
@@ -209,6 +209,32 @@ mcp_account_manager_goa_init (McpAccountManagerGoa *self)
goa_client_new (NULL, _goa_client_new_cb, self);
}
+static void
+_account_added_cb (GoaClient *client,
+ GoaObject *object,
+ McpAccountManagerGoa *self)
+{
+ GoaAccount *account = goa_object_peek_account (object);
+
+ _new_account (self, account);
+}
+
+static void
+_account_removed_cb (GoaClient *client,
+ GoaObject *object,
+ McpAccountManagerGoa *self)
+{
+ GoaAccount *account = goa_object_peek_account (object);
+ char *name = get_tp_account_name (account);
+
+ if (self->priv->ready)
+ g_signal_emit_by_name (self, "deleted", name);
+
+ g_hash_table_remove (self->priv->accounts, name);
+
+ g_free (name);
+}
+
static void
_goa_client_new_cb (GObject *obj,
@@ -232,14 +258,18 @@ _goa_client_new_cb (GObject *obj,
for (ptr = accounts; ptr != NULL; ptr = ptr->next)
{
- GoaAccount *account = goa_object_get_account (ptr->data);
+ GoaAccount *account = goa_object_peek_account (ptr->data);
_new_account (self, account);
}
g_list_free_full (accounts, g_object_unref);
- /* FIXME: track accounts created/destroyed */
+ g_signal_connect (self->priv->client, "account-added",
+ G_CALLBACK (_account_added_cb), self);
+ g_signal_connect (self->priv->client, "account-removed",
+ G_CALLBACK (_account_removed_cb), self);
+ /* FIXME: do we need to support account-changed ? */
}