summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 14:10:47 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-08 19:54:00 +0100
commit768caa0e6f72fd2ff2826ff6b165abea7a4fcbcd (patch)
tree622e26318cb6a924cb534efb5e3bed217c5db9bd
parent7b66fe684c8cfea0c211e8fa0d099f22021c7415 (diff)
TpObserveChannelContext:observer-info: change type to GVariant
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77139 Reviewed-by: Xavier Claessens
-rw-r--r--telepathy-glib/base-client.c3
-rw-r--r--telepathy-glib/observe-channel-context-internal.h4
-rw-r--r--telepathy-glib/observe-channel-context.c31
-rw-r--r--tests/lib/simple-client.c6
4 files changed, 22 insertions, 22 deletions
diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c
index 686e6c0d9..b3b4d3a88 100644
--- a/telepathy-glib/base-client.c
+++ b/telepathy-glib/base-client.c
@@ -1727,7 +1727,8 @@ _tp_base_client_observe_channel (TpSvcClientObserver *iface,
}
ctx = _tp_observe_channel_context_new (account, connection, channel,
- dispatch_operation, requests, observer_info, context);
+ dispatch_operation, requests, tp_asv_to_vardict (observer_info),
+ context);
account_features = dup_features_for_account (self, account);
connection_features = dup_features_for_connection (self, connection);
diff --git a/telepathy-glib/observe-channel-context-internal.h b/telepathy-glib/observe-channel-context-internal.h
index 3f5d74855..d28efd8be 100644
--- a/telepathy-glib/observe-channel-context-internal.h
+++ b/telepathy-glib/observe-channel-context-internal.h
@@ -48,7 +48,7 @@ struct _TpObserveChannelContext {
TpChannelDispatchOperation *dispatch_operation;
/* Array of reffed TpChannelRequest */
GPtrArray *requests;
- GHashTable *observer_info;
+ GVariant *observer_info;
};
TpObserveChannelContext * _tp_observe_channel_context_new (
@@ -57,7 +57,7 @@ TpObserveChannelContext * _tp_observe_channel_context_new (
TpChannel *channel,
TpChannelDispatchOperation *dispatch_operation,
GPtrArray *requests,
- GHashTable *observer_info,
+ GVariant *observer_info,
GDBusMethodInvocation *dbus_context);
TpObserveChannelContextState _tp_observe_channel_context_get_state (
diff --git a/telepathy-glib/observe-channel-context.c b/telepathy-glib/observe-channel-context.c
index 5b74a4be2..21b55cc93 100644
--- a/telepathy-glib/observe-channel-context.c
+++ b/telepathy-glib/observe-channel-context.c
@@ -145,11 +145,7 @@ tp_observe_channel_context_dispose (GObject *object)
self->requests = NULL;
}
- if (self->observer_info != NULL)
- {
- g_hash_table_unref (self->observer_info);
- self->observer_info = NULL;
- }
+ g_clear_pointer (&self->observer_info, g_variant_unref);
if (self->priv->result != NULL)
{
@@ -187,7 +183,7 @@ tp_observe_channel_context_get_property (GObject *object,
g_value_set_boxed (value, self->requests);
break;
case PROP_OBSERVER_INFO:
- g_value_set_boxed (value, self->observer_info);
+ g_value_set_variant (value, self->observer_info);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -225,7 +221,7 @@ tp_observe_channel_context_set_property (GObject *object,
self->priv->dbus_context = g_value_get_pointer (value);
break;
case PROP_OBSERVER_INFO:
- self->observer_info = g_value_dup_boxed (value);
+ self->observer_info = g_value_dup_variant (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -374,19 +370,17 @@ tp_observe_channel_context_class_init (TpObserveChannelContextClass *cls)
/**
* TpObserveChannelContext:observer-info:
*
- * A #GHashTable where the keys are string and values are GValue instances.
+ * A %G_VARIANT_TYPE_VARDICT.
* It represents the Observer_Info hash table that has been passed to
* ObserveChannels.
* It's recommended to use high-level method such as
* tp_observe_channel_context_is_recovering() to access to its content.
*
- * This property can't be %NULL.
- *
- * Since: 0.11.5
+ * This property can't be %NULL at runtime.
*/
- param_spec = g_param_spec_boxed ("observer-info", "Observer info",
+ param_spec = g_param_spec_variant ("observer-info", "Observer info",
"The Observer_Info that has been passed to ObserveChannels",
- TP_HASH_TYPE_STRING_VARIANT_MAP,
+ G_VARIANT_TYPE_VARDICT, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_OBSERVER_INFO,
param_spec);
@@ -399,10 +393,13 @@ _tp_observe_channel_context_new (
TpChannel *channel,
TpChannelDispatchOperation *dispatch_operation,
GPtrArray *requests,
- GHashTable *observer_info,
+ GVariant *observer_info,
GDBusMethodInvocation *dbus_context)
{
- return g_object_new (TP_TYPE_OBSERVE_CHANNELS_CONTEXT,
+ TpObserveChannelContext *self;
+
+ g_variant_ref_sink (observer_info);
+ self = g_object_new (TP_TYPE_OBSERVE_CHANNELS_CONTEXT,
"account", account,
"connection", connection,
"channel", channel,
@@ -411,6 +408,8 @@ _tp_observe_channel_context_new (
"observer-info", observer_info,
"dbus-context", dbus_context,
NULL);
+ g_variant_unref (observer_info);
+ return self;
}
/**
@@ -498,7 +497,7 @@ tp_observe_channel_context_is_recovering (TpObserveChannelContext *self)
{
/* tp_asv_get_boolean returns FALSE if the key is not set which is what we
* want */
- return tp_asv_get_boolean (self->observer_info, "recovering", NULL);
+ return tp_vardict_get_boolean (self->observer_info, "recovering", NULL);
}
TpObserveChannelContextState
diff --git a/tests/lib/simple-client.c b/tests/lib/simple-client.c
index 8a70ff8ef..0b486277e 100644
--- a/tests/lib/simple-client.c
+++ b/tests/lib/simple-client.c
@@ -34,14 +34,14 @@ simple_observe_channel (
TpObserveChannelContext *context)
{
TpTestsSimpleClient *self = TP_TESTS_SIMPLE_CLIENT (client);
- GHashTable *info;
+ GVariant *info;
gboolean fail;
GList *l;
/* Fail if caller set the fake "FAIL" info */
g_object_get (context, "observer-info", &info, NULL);
- fail = tp_asv_get_boolean (info, "FAIL", NULL);
- g_hash_table_unref (info);
+ fail = tp_vardict_get_boolean (info, "FAIL", NULL);
+ g_variant_unref (info);
if (self->observe_ctx != NULL)
{