[Pkg-telepathy-commits] [telepathy-glib] 72/111: tp_connection_manager_param_dup_variant_type: add

Simon McVittie smcv at debian.org
Wed Mar 19 18:07:27 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 bdba6fdf7804c050197db70d5840ae0f96cfe4be
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Feb 4 12:51:58 2014 +0000

    tp_connection_manager_param_dup_variant_type: add
    
    In order for this to work, TpProtocol now ignores parameters whose
    D-Bus signatures are not a syntactically valid single complete type.
    
    This is helpful for Mission Control to be able to migrate parameters
    from untyped to typed storage - it stores parameters in terms of
    GVariant.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71093
    Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
    [added (transfer full) as requested in review -smcv]
---
 docs/reference/telepathy-glib-sections.txt |  1 +
 telepathy-glib/connection-manager.c        | 22 ++++++++++++++++++++++
 telepathy-glib/connection-manager.h        |  3 +++
 telepathy-glib/protocol.c                  |  9 +++++++++
 4 files changed, 35 insertions(+)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 2e9d5eb..3940cba 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4849,6 +4849,7 @@ tp_connection_manager_protocol_get_param
 TpConnectionManagerParam
 tp_connection_manager_param_get_name
 tp_connection_manager_param_get_dbus_signature
+tp_connection_manager_param_dup_variant_type
 tp_connection_manager_param_is_required
 tp_connection_manager_param_is_required_for_registration
 tp_connection_manager_param_is_secret
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 4064671..c93d43a 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -2601,6 +2601,28 @@ tp_connection_manager_param_get_dbus_signature (
 }
 
 /**
+ * tp_connection_manager_param_dup_variant_type:
+ * @param: a parameter supported by a #TpConnectionManager
+ *
+ * <!-- -->
+ *
+ * Returns: (transfer full): the #GVariantType of the parameter
+ * Since: 0.UNRELEASED
+ */
+GVariantType *
+tp_connection_manager_param_dup_variant_type (
+    const TpConnectionManagerParam *param)
+{
+  g_return_val_if_fail (param != NULL, NULL);
+
+  /* this should have been checked when we created it */
+  g_return_val_if_fail (g_variant_type_string_is_valid (param->dbus_signature),
+      NULL);
+
+  return g_variant_type_new (param->dbus_signature);
+}
+
+/**
  * tp_connection_manager_param_is_required:
  * @param: a parameter supported by a #TpConnectionManager
  *
diff --git a/telepathy-glib/connection-manager.h b/telepathy-glib/connection-manager.h
index ac89341..6dd467e 100644
--- a/telepathy-glib/connection-manager.h
+++ b/telepathy-glib/connection-manager.h
@@ -204,6 +204,9 @@ gboolean tp_connection_manager_param_get_default (
 _TP_AVAILABLE_IN_0_20
 GVariant *tp_connection_manager_param_dup_default_variant (
     const TpConnectionManagerParam *param);
+_TP_AVAILABLE_IN_UNRELEASED
+GVariantType *tp_connection_manager_param_dup_variant_type (
+    const TpConnectionManagerParam *param);
 
 void tp_connection_manager_init_known_interfaces (void);
 
diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c
index 867db25..ee9b7e2 100644
--- a/telepathy-glib/protocol.c
+++ b/telepathy-glib/protocol.c
@@ -215,6 +215,15 @@ tp_protocol_params_from_param_specs (const GPtrArray *parameters,
           continue;
         }
 
+      if (!g_variant_type_string_is_valid (param->dbus_signature))
+        {
+          DEBUG ("Parameter #%d for %s has type '%s' which is not a "
+              "single complete type, ignoring", i, protocol,
+              param->dbus_signature);
+          g_array_set_size (output, output->len - 1);
+          continue;
+        }
+
       g_value_init (&param->default_value,
           G_VALUE_TYPE (tmp));
       g_value_copy (tmp, &param->default_value);

-- 
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