[Pkg-telepathy-commits] [telepathy-mission-control-6] 82/90: McpRequest: use GVariant for the requested properties

Simon McVittie smcv at debian.org
Wed May 14 12:09:09 UTC 2014


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

smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.

commit 65b1605476da6f98175233e11d8f4231b39750af
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Apr 7 16:48:30 2014 +0100

    McpRequest: use GVariant for the requested properties
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77139
---
 mission-control-plugins/implementation.h |  2 +-
 mission-control-plugins/request.c        | 12 ++++++------
 mission-control-plugins/request.h        |  4 ++--
 src/plugin-request.c                     |  8 ++------
 tests/twisted/mcp-plugin.c               |  6 +++---
 5 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/mission-control-plugins/implementation.h b/mission-control-plugins/implementation.h
index aa6e4fe..b1ad5bf 100644
--- a/mission-control-plugins/implementation.h
+++ b/mission-control-plugins/implementation.h
@@ -35,7 +35,7 @@ struct _McpRequestIface {
 
     gint64 (*get_user_action_time) (McpRequest *self);
     guint (*get_n_requests) (McpRequest *self);
-    GHashTable * (*ref_nth_request) (McpRequest *self, guint n);
+    GVariant * (*ref_nth_request) (McpRequest *self, guint n);
 
     void (*deny) (McpRequest *self, GQuark domain, gint code,
         const gchar *message);
diff --git a/mission-control-plugins/request.c b/mission-control-plugins/request.c
index 36dac1d..cf549bb 100644
--- a/mission-control-plugins/request.c
+++ b/mission-control-plugins/request.c
@@ -115,7 +115,7 @@ mcp_request_get_n_requests (McpRequest *self)
   return iface->get_n_requests (self);
 }
 
-GHashTable *
+GVariant *
 mcp_request_ref_nth_request (McpRequest *self,
     guint n)
 {
@@ -147,20 +147,20 @@ mcp_request_find_request_by_type (McpRequest *self,
     guint start_from,
     GQuark channel_type,
     guint *ret_index,
-    GHashTable **ret_ref_requested_properties)
+    GVariant **ret_ref_requested_properties)
 {
   guint i = start_from;
 
   while (1)
     {
-      GHashTable *req = mcp_request_ref_nth_request (self, i);
+      GVariant *req = mcp_request_ref_nth_request (self, i);
 
       if (req == NULL)
         return FALSE;
 
       if (channel_type == 0 ||
           channel_type == g_quark_try_string (
-            tp_asv_get_string (req, TP_IFACE_CHANNEL ".ChannelType")))
+            tp_vardict_get_string (req, TP_IFACE_CHANNEL ".ChannelType")))
         {
           if (ret_index != NULL)
             *ret_index = i;
@@ -168,12 +168,12 @@ mcp_request_find_request_by_type (McpRequest *self,
           if (ret_ref_requested_properties != NULL)
             *ret_ref_requested_properties = req;
           else
-            g_hash_table_unref (req);
+            g_variant_unref (req);
 
           return TRUE;
         }
 
-      g_hash_table_unref (req);
+      g_variant_unref (req);
       i++;
     }
 }
diff --git a/mission-control-plugins/request.h b/mission-control-plugins/request.h
index d98f20d..11aa939 100644
--- a/mission-control-plugins/request.h
+++ b/mission-control-plugins/request.h
@@ -52,7 +52,7 @@ GType mcp_request_get_type (void) G_GNUC_CONST;
 
 gboolean mcp_request_find_request_by_type (McpRequest *self,
     guint start_from, GQuark channel_type,
-    guint *ret_index, GHashTable **ret_ref_requested_properties);
+    guint *ret_index, GVariant **ret_ref_requested_properties);
 
 /* virtual methods */
 
@@ -62,7 +62,7 @@ const gchar *mcp_request_get_cm_name (McpRequest *self);
 
 gint64 mcp_request_get_user_action_time (McpRequest *self);
 guint mcp_request_get_n_requests (McpRequest *self);
-GHashTable *mcp_request_ref_nth_request (McpRequest *self, guint n);
+GVariant *mcp_request_ref_nth_request (McpRequest *self, guint n);
 
 void mcp_request_deny (McpRequest *self, GQuark domain, gint code,
     const gchar *message);
diff --git a/src/plugin-request.c b/src/plugin-request.c
index a4c3f03..0025313 100644
--- a/src/plugin-request.c
+++ b/src/plugin-request.c
@@ -190,12 +190,11 @@ plugin_req_get_n_requests (McpRequest *obj)
   return 1;
 }
 
-static GHashTable *
+static GVariant *
 plugin_req_ref_nth_request (McpRequest *obj,
     guint n)
 {
   McdPluginRequest *self = MCD_PLUGIN_REQUEST (obj);
-  GHashTable *requested_properties;
 
   g_return_val_if_fail (self != NULL, NULL);
 
@@ -205,10 +204,7 @@ plugin_req_ref_nth_request (McpRequest *obj,
       return NULL;
     }
 
-  requested_properties = _mcd_request_get_properties (
-      self->real_request);
-  g_return_val_if_fail (requested_properties != NULL, NULL);
-  return g_hash_table_ref (requested_properties);
+  return mcd_request_dup_properties (self->real_request);
 }
 
 static void
diff --git a/tests/twisted/mcp-plugin.c b/tests/twisted/mcp-plugin.c
index 0d04329..7cb9084 100644
--- a/tests/twisted/mcp-plugin.c
+++ b/tests/twisted/mcp-plugin.c
@@ -399,12 +399,12 @@ static void
 test_rejection_plugin_check_request (McpRequestPolicy *policy,
     McpRequest *request)
 {
-  GHashTable *properties = mcp_request_ref_nth_request (request, 0);
+  GVariant *properties = mcp_request_ref_nth_request (request, 0);
 
   DEBUG ("%s", G_STRFUNC);
 
   if (!tp_strdiff (
-        tp_asv_get_string (properties, TP_IFACE_CHANNEL ".ChannelType"),
+        tp_vardict_get_string (properties, TP_IFACE_CHANNEL ".ChannelType"),
         "com.example.ForbiddenChannel"))
     {
       DEBUG ("Forbidden channel detected, denying request");
@@ -421,7 +421,7 @@ test_rejection_plugin_check_request (McpRequestPolicy *policy,
           "No, you don't");
     }
 
-  g_hash_table_unref (properties);
+  g_variant_unref (properties);
 }
 
 static void

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



More information about the Pkg-telepathy-commits mailing list