summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-28 16:57:35 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-28 16:57:35 +0100
commitde7f581297e8cc50d5fe9694bbccfb7e131ee009 (patch)
treed95f34f7e892253eefdbdac67afa3d4eb2e8cd4d
parent2d8217676a5765fa580d48f37310ecc0b2c8a5f1 (diff)
downloadtelepathy-glib-de7f581297e8cc50d5fe9694bbccfb7e131ee009.tar.gz
protocol: add TpProtocol:protocol-properties-vardict
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/protocol.c44
-rw-r--r--telepathy-glib/protocol.h2
-rw-r--r--tests/dbus/protocol-objects.c7
4 files changed, 54 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 687d12782..b8eb124b3 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -6177,6 +6177,7 @@ tp_protocol_get_param
tp_protocol_dup_param
tp_protocol_has_param
tp_protocol_can_register
+tp_protocol_dup_immutable_properties
<SUBSECTION>
TP_PROTOCOL_FEATURE_CORE
tp_protocol_get_capabilities
diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c
index 0c39f873e..766beda4d 100644
--- a/telepathy-glib/protocol.c
+++ b/telepathy-glib/protocol.c
@@ -156,6 +156,7 @@ enum
{
PROP_PROTOCOL_NAME = 1,
PROP_PROTOCOL_PROPERTIES,
+ PROP_PROTOCOL_PROPERTIES_VARDICT,
PROP_ENGLISH_NAME,
PROP_VCARD_FIELD,
PROP_ICON_NAME,
@@ -277,6 +278,11 @@ tp_protocol_get_property (GObject *object,
g_value_set_boxed (value, self->priv->protocol_properties);
break;
+ case PROP_PROTOCOL_PROPERTIES_VARDICT:
+ g_value_take_variant (value,
+ tp_protocol_dup_immutable_properties (self));
+ break;
+
case PROP_ENGLISH_NAME:
g_value_set_string (value, tp_protocol_get_english_name (self));
break;
@@ -752,6 +758,28 @@ tp_protocol_class_init (TpProtocolClass *klass)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
+ * TpProtocol:protocol-properties-vardict:
+ *
+ * The immutable properties of this Protocol, as provided at construction
+ * time. This is a #G_VARIANT_TYPE_VARDICT #GVariant,
+ * which must not be modified.
+ *
+ * If the immutable properties were not provided at construction time,
+ * the %TP_PROTOCOL_FEATURE_PARAMETERS and %TP_PROTOCOL_FEATURE_CORE features
+ * will both be unavailable, and this #TpProtocol object will only be useful
+ * as a way to access lower-level D-Bus calls.
+ *
+ * Since: UNRELEASED
+ */
+ g_object_class_install_property (object_class,
+ PROP_PROTOCOL_PROPERTIES_VARDICT,
+ g_param_spec_variant ("protocol-properties-vardict",
+ "Protocol properties",
+ "The immutable properties of this Protocol",
+ G_VARIANT_TYPE_VARDICT, NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ /**
* TpProtocol:english-name:
*
* The name of the protocol in a form suitable for display to users,
@@ -2346,3 +2374,19 @@ tp_protocol_dup_presence_statuses (TpProtocol *self)
return g_list_reverse (l);
}
+
+/**
+ * tp_protocol_dup_immutable_properties:
+ * @self: a #TpProtocol object
+ *
+ * Return the #TpProtocol:protocol-properties-vardict property.
+ *
+ * Returns: (transfer full): the value of
+ * #TpProtocol:protocol-properties-vardict
+ * Since: UNRELEASED
+ */
+GVariant *
+tp_protocol_dup_immutable_properties (TpProtocol *self)
+{
+ return _tp_asv_to_vardict (self->priv->protocol_properties);
+}
diff --git a/telepathy-glib/protocol.h b/telepathy-glib/protocol.h
index 1a06c7fe2..5d964ea5f 100644
--- a/telepathy-glib/protocol.h
+++ b/telepathy-glib/protocol.h
@@ -102,6 +102,8 @@ GStrv tp_protocol_dup_param_names (TpProtocol *self) G_GNUC_WARN_UNUSED_RESULT;
_TP_AVAILABLE_IN_0_18
GList *tp_protocol_dup_params (TpProtocol *self) G_GNUC_WARN_UNUSED_RESULT;
+GVariant * tp_protocol_dup_immutable_properties (TpProtocol *self);
+
#ifndef TP_DISABLE_DEPRECATED
_TP_DEPRECATED_IN_0_20_FOR(tp_protocol_dup_params)
_TP_AVAILABLE_IN_0_18
diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c
index 5498d4c9f..5b73a0abe 100644
--- a/tests/dbus/protocol-objects.c
+++ b/tests/dbus/protocol-objects.c
@@ -453,6 +453,7 @@ test_protocol_object (Test *test,
{
GHashTable *props;
TpProtocol *protocol;
+ GVariant *vardict;
g_assert_cmpstr (tp_connection_manager_get_name (test->cm), ==,
"example_echo_2");
@@ -475,6 +476,12 @@ test_protocol_object (Test *test,
check_tp_protocol (protocol);
+ vardict = tp_protocol_dup_immutable_properties (test->protocol);
+ g_assert (vardict != NULL);
+ g_assert (g_variant_is_of_type (vardict, G_VARIANT_TYPE_VARDICT));
+
+ g_variant_unref (vardict);
+
g_object_unref (protocol);
g_hash_table_unref (props);
}