diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-17 15:51:59 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-17 15:51:59 +0200 |
commit | 8dd23a0617edfc8fbc9adf1c855834ccd60ff531 (patch) | |
tree | 4766d3a9969c432c4117f28dca953d086ae2e454 | |
parent | 248a1c9c0dc909e6ebd4bf93d3f83b873a697f06 (diff) |
add tp_account_request_set_storage_provider()
-rw-r--r-- | docs/reference/telepathy-glib-sections.txt | 1 | ||||
-rw-r--r-- | telepathy-glib/account-request.c | 46 | ||||
-rw-r--r-- | telepathy-glib/account-request.h | 4 | ||||
-rw-r--r-- | tests/dbus/account-request.c | 21 |
4 files changed, 71 insertions, 1 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index d225152cc..a41a3be1e 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -5281,6 +5281,7 @@ tp_account_request_set_connect_automatically tp_account_request_add_supersedes tp_account_request_set_avatar tp_account_request_set_service +tp_account_request_set_storage_provider <SUBSECTION> tp_account_request_set_parameter tp_account_request_set_parameter_string diff --git a/telepathy-glib/account-request.c b/telepathy-glib/account-request.c index 3eea2f4a6..f7c881565 100644 --- a/telepathy-glib/account-request.c +++ b/telepathy-glib/account-request.c @@ -144,6 +144,7 @@ enum { PROP_AVATAR, PROP_AVATAR_MIME_TYPE, PROP_SERVICE, + PROP_STORAGE_PROVIDER, N_PROPS }; @@ -294,6 +295,10 @@ tp_account_request_get_property (GObject *object, g_value_set_string (value, tp_asv_get_string (self->priv->properties, TP_PROP_ACCOUNT_SERVICE)); break; + case PROP_STORAGE_PROVIDER: + g_value_set_string (value, tp_asv_get_string (self->priv->properties, + TP_PROP_ACCOUNT_INTERFACE_STORAGE_STORAGE_PROVIDER)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -698,6 +703,21 @@ tp_account_request_class_init (TpAccountRequestClass *klass) "The account's service", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); + + /** + * TpAccountRequest:storage-provider: + * + * The account's storage provider. To change this property use + * tp_account_request_set_storage_provider(). + * + * Since: UNRELEASED + */ + g_object_class_install_property (object_class, PROP_STORAGE_PROVIDER, + g_param_spec_string ("storage-provider", + "Storage Provider", + "The account's storage provider", + NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); } /** @@ -1111,6 +1131,32 @@ tp_account_request_set_service (TpAccountRequest *self, } /** + * tp_account_request_set_storage_provider: + * @self: a #TpAccountRequest + * @provider: the name of an account storage implementation + * + * Set the account storage to use when creating the account. Use the + * #TpAccountRequest:storage-provider property to read the current value. + * + * Since: UNRELEASED + */ +void +tp_account_request_set_storage_provider (TpAccountRequest *self, + const gchar *provider) +{ + TpAccountRequestPrivate *priv; + + g_return_if_fail (TP_IS_ACCOUNT_REQUEST (self)); + + priv = self->priv; + + g_return_if_fail (priv->result == NULL && !priv->created); + + tp_asv_set_string (priv->properties, + TP_PROP_ACCOUNT_INTERFACE_STORAGE_STORAGE_PROVIDER, provider); +} + +/** * tp_account_request_set_parameter: * @self: a #TpAccountRequest * @key: the parameter key diff --git a/telepathy-glib/account-request.h b/telepathy-glib/account-request.h index 9ec441255..a589ef6e2 100644 --- a/telepathy-glib/account-request.h +++ b/telepathy-glib/account-request.h @@ -120,6 +120,10 @@ _TP_AVAILABLE_IN_0_20 void tp_account_request_set_service (TpAccountRequest *self, const gchar *service); +_TP_AVAILABLE_IN_UNRELEASED +void tp_account_request_set_storage_provider (TpAccountRequest *self, + const gchar *provider); + /* parameters */ _TP_AVAILABLE_IN_0_20 void tp_account_request_set_parameter (TpAccountRequest *self, diff --git a/tests/dbus/account-request.c b/tests/dbus/account-request.c index 96a2ad669..bc3b7d2b6 100644 --- a/tests/dbus/account-request.c +++ b/tests/dbus/account-request.c @@ -200,7 +200,7 @@ test_properties (Test *test, const gchar *s; gboolean b; GVariant *v; - gchar *service; + gchar *service, *storage_provider; test->account = tp_account_request_new (test->account_manager, "gabble", "jabber", "Walter Jr."); @@ -373,6 +373,25 @@ test_properties (Test *test, g_variant_unref (props); g_free (service); + + /* storage provider */ + tp_account_request_set_storage_provider (test->account, "my.provider"); + + g_object_get (test->account, + "properties", &props, + "storage-provider", &storage_provider, + NULL); + + v = g_variant_lookup_value (props, + TP_PROP_ACCOUNT_INTERFACE_STORAGE_STORAGE_PROVIDER, NULL); + g_assert (v != NULL); + g_assert_cmpstr (g_variant_get_string (v, NULL), ==, "my.provider"); + g_variant_unref (v); + + g_assert_cmpstr (storage_provider, ==, "my.provider"); + + g_variant_unref (props); + g_free (storage_provider); } static void |