diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-07-25 15:35:59 +0800 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-07-26 21:26:08 +0800 |
commit | 1fd4799efc2579d109deeb4215afd1b6c3d1e838 (patch) | |
tree | 9926e857242680cd77ff9a016a1eccce7f71bc2b /ubuntu-online-accounts | |
parent | a31a050ccad58fda65c076f370c756c1479a644e (diff) | |
download | gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar.gz gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar.bz2 gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar.lz gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar.xz gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.tar.zst gsoc2013-empathy-1fd4799efc2579d109deeb4215afd1b6c3d1e838.zip |
UOA mc-plugin: CANNOT_SET_PARAMETERS depends on account's settings
A special key has been added in .service files of online accounts
telling its args should be considered readonly. Generic accounts (e.g. AIM)
can still be modified.
https://bugzilla.gnome.org/show_bug.cgi?id=680646
Diffstat (limited to 'ubuntu-online-accounts')
-rw-r--r-- | ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c index 87d966f7d..d30ab133d 100644 --- a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c +++ b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c @@ -39,6 +39,7 @@ #define SERVICE_TYPE "IM" #define KEY_PREFIX "telepathy/" #define KEY_ACCOUNT_NAME "mc-account-name" +#define KEY_READONLY_PARAMS "mc-readonly-params" static void account_storage_iface_init (McpAccountStorageIface *iface); @@ -703,11 +704,30 @@ account_manager_uoa_get_identifier (const McpAccountStorage *storage, } static guint -account_manager_uoa_get_restrictions (const McpAccountStorage *self, +account_manager_uoa_get_restrictions (const McpAccountStorage *storage, const gchar *account_name) { + McpAccountManagerUoa *self = (McpAccountManagerUoa *) storage; + AgAccountService *service; + guint restrictions = TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE; + GValue value = G_VALUE_INIT; + + /* 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 G_MAXUINT; + + g_value_init (&value, G_TYPE_BOOLEAN); + ag_account_service_get_value (service, + KEY_PREFIX KEY_READONLY_PARAMS, &value); + + if (g_value_get_boolean (&value)) + restrictions |= TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS; + + g_value_unset (&value); + /* FIXME: We can't set Icon either, but there is no flag for that */ - return TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE; + return restrictions; } static void |