summaryrefslogtreecommitdiff
path: root/mission-control-plugins
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-15 18:10:00 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-29 11:27:37 +0000
commit76e09aa96406ed8219769c497ba50b9c8ca56e9b (patch)
tree81d1382a15eb8f24a99608b25879ff07a442167a /mission-control-plugins
parent62dda025c5961fc05705eccac7e753f730259f7b (diff)
Call IdentifyAccount to get new accounts' names
It's exposed through the plugin API so that exemplary plugins can use the same utility functions to decide how to name accounts for the ::created signal, if they want to. Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34640
Diffstat (limited to 'mission-control-plugins')
-rw-r--r--mission-control-plugins/account.c42
-rw-r--r--mission-control-plugins/account.h11
-rw-r--r--mission-control-plugins/implementation.h11
3 files changed, 64 insertions, 0 deletions
diff --git a/mission-control-plugins/account.c b/mission-control-plugins/account.c
index 62318d44..1744ef6a 100644
--- a/mission-control-plugins/account.c
+++ b/mission-control-plugins/account.c
@@ -290,6 +290,7 @@ mcp_account_manager_parameter_make_secret (const McpAccountManager *mcpa,
* Changed in 5.17: instead of a map from string to GValue, the last
* argument is the result of calling IdentifyAccount on the parameters,
* which normalizes the account's name in a protocol-dependent way.
+ * Use mcp_account_manager_identify_account_async() to do that.
*
* Returns: the newly allocated account name, which should be freed
* once the caller is done with it.
@@ -308,6 +309,47 @@ mcp_account_manager_get_unique_name (McpAccountManager *mcpa,
return iface->unique_name (mcpa, manager, protocol, identification);
}
+void
+mcp_account_manager_identify_account_async (McpAccountManager *mcpa,
+ const gchar *manager,
+ const gchar *protocol,
+ GVariant *parameters,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa);
+
+ g_return_if_fail (iface != NULL);
+ g_return_if_fail (iface->identify_account_async != NULL);
+ g_return_if_fail (iface->identify_account_finish != NULL);
+
+ g_return_if_fail (manager != NULL);
+ g_return_if_fail (protocol != NULL);
+ g_return_if_fail (parameters != NULL);
+ g_return_if_fail (g_variant_is_of_type (parameters, G_VARIANT_TYPE_VARDICT));
+
+ iface->identify_account_async (mcpa, manager, protocol, parameters,
+ cancellable, callback, user_data);
+}
+
+/**
+ * Returns: (transfer full): a newly allocated string, free with g_free()
+ */
+gchar *
+mcp_account_manager_identify_account_finish (McpAccountManager *mcpa,
+ GAsyncResult *res,
+ GError **error)
+{
+ McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa);
+
+ g_return_val_if_fail (iface != NULL, NULL);
+ g_return_val_if_fail (iface->identify_account_async != NULL, NULL);
+ g_return_val_if_fail (iface->identify_account_finish != NULL, NULL);
+
+ return iface->identify_account_finish (mcpa, res, error);
+}
+
/**
* mcp_account_manager_escape_value_from_keyfile:
* @mcpa: a #McpAccountManager
diff --git a/mission-control-plugins/account.h b/mission-control-plugins/account.h
index a4763427..4015457b 100644
--- a/mission-control-plugins/account.h
+++ b/mission-control-plugins/account.h
@@ -101,6 +101,17 @@ gboolean mcp_account_manager_init_value_for_attribute (
GValue *value,
const gchar *attribute);
+void mcp_account_manager_identify_account_async (McpAccountManager *mcpa,
+ const gchar *manager,
+ const gchar *protocol,
+ GVariant *parameters,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gchar *mcp_account_manager_identify_account_finish (McpAccountManager *mcpa,
+ GAsyncResult *res,
+ GError **error);
+
G_END_DECLS
#endif
diff --git a/mission-control-plugins/implementation.h b/mission-control-plugins/implementation.h
index 29d29377..2ad28938 100644
--- a/mission-control-plugins/implementation.h
+++ b/mission-control-plugins/implementation.h
@@ -128,6 +128,17 @@ struct _McpAccountManagerIface {
const gchar *parameter,
GVariant *value,
McpParameterFlags flags);
+
+ void (* identify_account_async) (McpAccountManager *mcpa,
+ const gchar *manager,
+ const gchar *protocol,
+ GVariant *parameters,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gchar * (* identify_account_finish) (McpAccountManager *mcpa,
+ GAsyncResult *res,
+ GError **error);
};
G_END_DECLS