Skip to content

Commit

Permalink
Merge pull request #10 from special/additional_info
Browse files Browse the repository at this point in the history
[mcp-account-manager] Implement get_additional_info to provide display names
  • Loading branch information
special committed Dec 16, 2013
2 parents f83517c + 930fa56 commit 057112d
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions mcp-account-manager-uoa/mcp-account-manager-uoa.c
Expand Up @@ -727,10 +727,8 @@ account_manager_uoa_get (const McpAccountStorage *storage,

if (key == NULL || !tp_strdiff (key, "DisplayName"))
{
AgProvider *provider = ag_manager_get_provider (self->priv->manager, ag_account_get_provider_name (account));
mcp_account_manager_set_value (am, account_name, "DisplayName",
ag_provider_get_display_name (provider));
ag_provider_unref(provider);
ag_account_get_display_name (account));
handled = TRUE;
}

Expand Down Expand Up @@ -939,6 +937,33 @@ account_manager_uoa_get_identifier (const McpAccountStorage *storage,
g_value_set_uint (identifier, account->id);
}

static GHashTable *
account_manager_uoa_get_additional_info (const McpAccountStorage *storage,
const gchar *account_name)
{
McpAccountManagerUoa *self = (McpAccountManagerUoa *) storage;
AgAccountService *service;
AgAccount *account;
AgProvider *provider;
GHashTable *ret = NULL;

/* If we don't know this account, we cannot do anything */
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)
return ret;

account = ag_account_service_get_account (service);
provider = ag_manager_get_provider (self->priv->manager, ag_account_get_provider_name (account));

ret = tp_asv_new (
"providerDisplayName", G_TYPE_STRING, ag_provider_get_display_name (provider),
"accountDisplayName", G_TYPE_STRING, ag_account_get_display_name (account),
NULL);

ag_provider_unref(provider);
return ret;
}

static guint
account_manager_uoa_get_restrictions (const McpAccountStorage *storage,
const gchar *account_name)
Expand Down Expand Up @@ -987,6 +1012,7 @@ account_storage_iface_init (McpAccountStorageIface *iface)
IMPLEMENT (ready);
IMPLEMENT (get_identifier);
IMPLEMENT (get_restrictions);
IMPLEMENT (get_additional_info);
#undef IMPLEMENT
}

Expand Down

0 comments on commit 057112d

Please sign in to comment.