diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-11-12 15:37:29 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-11-12 15:37:29 +0000 |
commit | 692946fe470eae3f3e9fa9453dec7d1f62cff7f2 (patch) | |
tree | 63910f057f5278fe163130db67eaf5d4f7aaf4be /mission-control-plugins | |
parent | bdf7c51b8ab76917a46714df784e838f323938cb (diff) |
Revert "Remove all notion of secret parameter"
This reverts commit ae64063c953840f99b1204a222fabf5aa7a37b69.
Diffstat (limited to 'mission-control-plugins')
-rw-r--r-- | mission-control-plugins/account-storage.c | 3 | ||||
-rw-r--r-- | mission-control-plugins/account.c | 59 | ||||
-rw-r--r-- | mission-control-plugins/account.h | 8 | ||||
-rw-r--r-- | mission-control-plugins/implementation.h | 8 | ||||
-rw-r--r-- | mission-control-plugins/mission-control-plugins.h | 1 |
5 files changed, 78 insertions, 1 deletions
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c index 0d7c9323..7b813c4c 100644 --- a/mission-control-plugins/account-storage.c +++ b/mission-control-plugins/account-storage.c @@ -444,7 +444,8 @@ mcp_account_storage_priority (const McpAccountStorage *storage) * Before emitting this signal, the plugin must call * either mcp_account_manager_set_attribute(), * mcp_account_manager_set_parameter(), - * or mcp_account_manager_set_value() + * or mcp_account_manager_set_value() and (if appropriate) + * mcp_account_manager_parameter_make_secret() * before returning from this method call. * * Note that mcp_account_manager_set_parameter() does not use the diff --git a/mission-control-plugins/account.c b/mission-control-plugins/account.c index 493a34c0..1744ef6a 100644 --- a/mission-control-plugins/account.c +++ b/mission-control-plugins/account.c @@ -216,6 +216,65 @@ mcp_account_manager_get_value (const McpAccountManager *mcpa, } /** + * mcp_account_manager_parameter_is_secret: + * @mcpa: an #McpAccountManager instance + * @account: the unique name of an account + * @key: the constant string "param-", plus a parameter name like + * "account" or "password" + * + * Determine whether a given account parameter is secret. + * Generally this is determined by MC and passed down to plugins, + * but any #McpAccountStorage plugin may decide a parameter is + * secret, in which case the return value for this call will + * indicate that fact too. + * + * For historical reasons, this function only operates on parameters, + * but requires its argument to be prefixed with "param-". + * + * Returns: %TRUE for secret settings, %FALSE otherwise + */ +gboolean +mcp_account_manager_parameter_is_secret (const McpAccountManager *mcpa, + const gchar *account, + const gchar *key) +{ + McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); + + g_return_val_if_fail (iface != NULL, FALSE); + g_return_val_if_fail (iface->is_secret != NULL, FALSE); + + return iface->is_secret (mcpa, account, key); +} + +/** + * mcp_account_manager_parameter_make_secret: + * @mcpa: an #McpAccountManager instance + * @account: the unique name of an account + * @key: the constant string "param-", plus a parameter name like + * "account" or "password" + * + * Flag an account setting as secret for the lifetime of this + * #McpAccountManager. For instance, this should be called if + * @key has been retrieved from gnome-keyring. + * + * For historical reasons, this function only operates on parameters, + * but requires its argument to be prefixed with "param-". + */ +void +mcp_account_manager_parameter_make_secret (const McpAccountManager *mcpa, + const gchar *account, + const gchar *key) +{ + McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); + + g_return_if_fail (iface != NULL); + g_return_if_fail (iface->make_secret != NULL); + + g_debug ("%s.%s should be secret", account, key); + iface->make_secret (mcpa, account, key); +} + +/** * mcp_account_manager_get_unique_name: * @mcpa: an #McpAccountManager instance * @manager: the name of the manager diff --git a/mission-control-plugins/account.h b/mission-control-plugins/account.h index c283ef99..4015457b 100644 --- a/mission-control-plugins/account.h +++ b/mission-control-plugins/account.h @@ -66,6 +66,14 @@ gchar * mcp_account_manager_get_value (const McpAccountManager *mcpa, const gchar *account, const gchar *key); +gboolean mcp_account_manager_parameter_is_secret (const McpAccountManager *mcpa, + const gchar *account, + const gchar *key); + +void mcp_account_manager_parameter_make_secret (const McpAccountManager *mcpa, + const gchar *account, + const gchar *key); + gchar * mcp_account_manager_get_unique_name (McpAccountManager *mcpa, const gchar *manager, const gchar *protocol, diff --git a/mission-control-plugins/implementation.h b/mission-control-plugins/implementation.h index 9cc04b4e..2ad28938 100644 --- a/mission-control-plugins/implementation.h +++ b/mission-control-plugins/implementation.h @@ -86,6 +86,14 @@ struct _McpAccountManagerIface { const gchar *acct, const gchar *key); + gboolean (*is_secret) (const McpAccountManager *ma, + const gchar *acct, + const gchar *key); + + void (* make_secret) (const McpAccountManager *ma, + const gchar *acct, + const gchar *key); + gchar * (* unique_name) (const McpAccountManager *ma, const gchar *manager, const gchar *protocol, diff --git a/mission-control-plugins/mission-control-plugins.h b/mission-control-plugins/mission-control-plugins.h index 806f472a..13d87e6f 100644 --- a/mission-control-plugins/mission-control-plugins.h +++ b/mission-control-plugins/mission-control-plugins.h @@ -27,6 +27,7 @@ typedef enum { MCP_PARAMETER_FLAG_NONE = 0, + MCP_PARAMETER_FLAG_SECRET = TP_CONN_MGR_PARAM_FLAG_SECRET } McpParameterFlags; typedef enum { |