[next] telepathy-glib: client-factory: take a vardict for new account props
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Mon Mar 3 02:12:22 PST 2014
Module: telepathy-glib
Branch: next
Commit: 137746c610c0da746f6a1a5ec2e0d67ef978da8b
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=137746c610c0da746f6a1a5ec2e0d67ef978da8b
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Thu Feb 27 13:07:16 2014 +0100
client-factory: take a vardict for new account props
---
telepathy-glib/client-factory.c | 29 +++++++++++++++++++-------
telepathy-glib/client-factory.h | 4 ++--
tests/logger/dbus/test-tpl-log-iter-pidgin.c | 2 +-
tests/logger/dbus/test-tpl-log-walker.c | 2 +-
4 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c
index 8187878..a6f2ffa 100644
--- a/telepathy-glib/client-factory.c
+++ b/telepathy-glib/client-factory.c
@@ -193,7 +193,7 @@ _tp_client_factory_insert_proxy (TpClientFactory *self,
static TpAccount *
create_account_impl (TpClientFactory *self,
const gchar *object_path,
- const GHashTable *immutable_properties G_GNUC_UNUSED,
+ GVariant *immutable_properties G_GNUC_UNUSED,
GError **error)
{
return _tp_account_new_with_factory (self, self->priv->dbus, object_path,
@@ -435,8 +435,8 @@ tp_client_factory_get_dbus_daemon (TpClientFactory *self)
* tp_client_factory_ensure_account:
* @self: a #TpClientFactory object
* @object_path: the object path of an account
- * @immutable_properties: (transfer none) (element-type utf8 GObject.Value):
- * the immutable properties of the account, or %NULL.
+ * @immutable_properties: (allow-none) a #G_VARIANT_TYPE_VARDICT containing
+ * the immutable properties of the account, or %NULL.
* @error: Used to raise an error if @object_path is not valid
*
* Returns a #TpAccount proxy for the account at @object_path. The returned
@@ -451,6 +451,8 @@ tp_client_factory_get_dbus_daemon (TpClientFactory *self)
* and #TpAccountManager::usability-changed are more appropriate for most
* applications.
*
+ * @immutable_properties is consumed if it is floating.
+ *
* Returns: (transfer full): a reference to a #TpAccount;
* see tp_account_new().
*
@@ -459,7 +461,7 @@ tp_client_factory_get_dbus_daemon (TpClientFactory *self)
TpAccount *
tp_client_factory_ensure_account (TpClientFactory *self,
const gchar *object_path,
- const GHashTable *immutable_properties,
+ GVariant *immutable_properties,
GError **error)
{
TpAccount *account;
@@ -467,13 +469,24 @@ tp_client_factory_ensure_account (TpClientFactory *self,
g_return_val_if_fail (TP_IS_CLIENT_FACTORY (self), NULL);
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
+ if (immutable_properties != NULL)
+ g_variant_ref_sink (immutable_properties);
+ else
+ immutable_properties = g_variant_new ("a{sv}", NULL);
+
account = lookup_proxy (self, object_path);
if (account != NULL)
- return g_object_ref (account);
+ {
+ g_object_ref (account);
+ }
+ else
+ {
+ account = TP_CLIENT_FACTORY_GET_CLASS (self)->create_account (self,
+ object_path, immutable_properties, error);
+ insert_proxy (self, account);
+ }
- account = TP_CLIENT_FACTORY_GET_CLASS (self)->create_account (self,
- object_path, immutable_properties, error);
- insert_proxy (self, account);
+ g_variant_unref (immutable_properties);
return account;
}
diff --git a/telepathy-glib/client-factory.h b/telepathy-glib/client-factory.h
index ff59c3b..bf3e698 100644
--- a/telepathy-glib/client-factory.h
+++ b/telepathy-glib/client-factory.h
@@ -46,7 +46,7 @@ struct _TpClientFactoryClass {
/* TpAccount */
TpAccount * (*create_account) (TpClientFactory *self,
const gchar *object_path,
- const GHashTable *immutable_properties,
+ GVariant *immutable_properties,
GError **error);
GArray * (*dup_account_features) (TpClientFactory *self,
TpAccount *account);
@@ -111,7 +111,7 @@ TpDBusDaemon *tp_client_factory_get_dbus_daemon (TpClientFactory *self);
/* TpAccount */
TpAccount *tp_client_factory_ensure_account (TpClientFactory *self,
const gchar *object_path,
- const GHashTable *immutable_properties,
+ GVariant *immutable_properties,
GError **error);
GArray *tp_client_factory_dup_account_features (TpClientFactory *self,
TpAccount *account);
diff --git a/tests/logger/dbus/test-tpl-log-iter-pidgin.c b/tests/logger/dbus/test-tpl-log-iter-pidgin.c
index 48810e8..63ad87e 100644
--- a/tests/logger/dbus/test-tpl-log-iter-pidgin.c
+++ b/tests/logger/dbus/test-tpl-log-iter-pidgin.c
@@ -93,7 +93,7 @@ setup (PidginTestCaseFixture* fixture,
fixture->account = tp_client_factory_ensure_account (fixture->factory,
tp_asv_get_string (params, "account-path"),
- params,
+ tp_asv_to_vardict (params),
&error);
g_assert_no_error (error);
g_assert (fixture->account != NULL);
diff --git a/tests/logger/dbus/test-tpl-log-walker.c b/tests/logger/dbus/test-tpl-log-walker.c
index 5a8e721..5edb5d1 100644
--- a/tests/logger/dbus/test-tpl-log-walker.c
+++ b/tests/logger/dbus/test-tpl-log-walker.c
@@ -93,7 +93,7 @@ setup (WalkerTestCaseFixture* fixture,
fixture->account = tp_client_factory_ensure_account (fixture->factory,
tp_asv_get_string (params, "account-path"),
- params,
+ tp_asv_to_vardict (params),
&error);
g_assert_no_error (error);
g_assert (fixture->account != NULL);
More information about the telepathy-commits
mailing list