aboutsummaryrefslogtreecommitdiffstats
path: root/goa-mc-plugin/mcp-account-manager-goa.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-31 20:09:47 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-06 13:37:07 +0800
commit79df4629d7890f5d3a70e2d66afea1ded744e9d6 (patch)
tree0278f9488deb4f50087265de5a356d6ba6024c02 /goa-mc-plugin/mcp-account-manager-goa.c
parenteb9d398e95bbb9972df1ac26374da11234a82989 (diff)
downloadgsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar.gz
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar.bz2
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar.lz
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar.xz
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.tar.zst
gsoc2013-empathy-79df4629d7890f5d3a70e2d66afea1ded744e9d6.zip
store the GoaObject rather than the GoaAccount
We need to keep the GoaObject to check if Chat is enabled on it.
Diffstat (limited to 'goa-mc-plugin/mcp-account-manager-goa.c')
-rw-r--r--goa-mc-plugin/mcp-account-manager-goa.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c
index 2b724cfdf..4c84a7950 100644
--- a/goa-mc-plugin/mcp-account-manager-goa.c
+++ b/goa-mc-plugin/mcp-account-manager-goa.c
@@ -55,7 +55,7 @@ struct _McpAccountManagerGoaPrivate
gboolean ready;
GoaClient *client;
- GHashTable *accounts; /* alloc'ed string -> ref'ed GoaAccount */
+ GHashTable *accounts; /* alloc'ed string -> ref'ed GoaObject */
};
@@ -184,8 +184,9 @@ get_tp_account_name (GoaAccount *account)
static void
_new_account (McpAccountManagerGoa *self,
- GoaAccount *account)
+ GoaObject *object)
{
+ GoaAccount *account = goa_object_peek_account (object);
char *account_name = get_tp_account_name (account);
if (account_name == NULL)
@@ -193,7 +194,7 @@ _new_account (McpAccountManagerGoa *self,
/* @account_name now is owned by the hash table */
g_hash_table_insert (self->priv->accounts, account_name,
- g_object_ref (account));
+ g_object_ref (object));
if (self->priv->ready)
g_signal_emit_by_name (self, "created", account_name);
@@ -222,9 +223,7 @@ _account_added_cb (GoaClient *client,
GoaObject *object,
McpAccountManagerGoa *self)
{
- GoaAccount *account = goa_object_peek_account (object);
-
- _new_account (self, account);
+ _new_account (self, object);
}
@@ -267,9 +266,7 @@ _goa_client_new_cb (GObject *obj,
for (ptr = accounts; ptr != NULL; ptr = ptr->next)
{
- GoaAccount *account = goa_object_peek_account (ptr->data);
-
- _new_account (self, account);
+ _new_account (self, ptr->data);
}
g_list_free_full (accounts, g_object_unref);
@@ -335,11 +332,17 @@ mcp_account_manager_goa_get (const McpAccountStorage *self,
const gchar *key)
{
McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self);
+ GoaObject *object;
GoaAccount *account;
DEBUG ("%s: %s, %s", G_STRFUNC, acct, key);
- account = g_hash_table_lookup (priv->accounts, acct);
+ object = g_hash_table_lookup (priv->accounts, acct);
+
+ if (object == NULL)
+ return FALSE;
+
+ account = goa_object_peek_account (object);
if (account == NULL)
return FALSE;
@@ -477,10 +480,13 @@ mcp_account_manager_goa_get_identifier (const McpAccountStorage *self,
GValue *identifier)
{
McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self);
+ GoaObject *object;
GoaAccount *account;
- account = g_hash_table_lookup (priv->accounts, acct);
+ object = g_hash_table_lookup (priv->accounts, acct);
+ g_return_if_fail (object != NULL);
+ account = goa_object_peek_account (object);
g_return_if_fail (account != NULL);
g_value_init (identifier, G_TYPE_STRING);