Skip to content

Commit

Permalink
[mcp-account-manager] Implement get_additional_info to provide displa…
Browse files Browse the repository at this point in the history
…y names

This provides both the account and provider display name to clients.
  • Loading branch information
John Brooks committed Oct 18, 2013
1 parent 4adda67 commit 1f9f124
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mcp-account-manager-uoa/mcp-account-manager-uoa.c
Expand Up @@ -887,6 +887,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 @@ -935,6 +962,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 1f9f124

Please sign in to comment.