[Pkg-telepathy-commits] [telepathy-glib] 91/111: protocol: add TpProtocol:protocol-properties-vardict

Simon McVittie smcv at debian.org
Wed Mar 19 18:07:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib.

commit de7f581297e8cc50d5fe9694bbccfb7e131ee009
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Feb 28 16:57:35 2014 +0100

    protocol: add TpProtocol:protocol-properties-vardict
---
 docs/reference/telepathy-glib-sections.txt |  1 +
 telepathy-glib/protocol.c                  | 44 ++++++++++++++++++++++++++++++
 telepathy-glib/protocol.h                  |  2 ++
 tests/dbus/protocol-objects.c              |  7 +++++
 4 files changed, 54 insertions(+)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 687d127..b8eb124 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 0c39f87..766beda 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 1a06c7f..5d964ea 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 5498d4c..5b73a0a 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);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib.git



More information about the Pkg-telepathy-commits mailing list