[telepathy-glib/master] Use TP_STRUCT_TYPE_DEBUG_MESSAGE instead of using dbus_g_type_get_struct.

Jonny Lamb jonny.lamb at collabora.co.uk
Fri Aug 28 04:26:54 PDT 2009


Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
 telepathy-glib/debug-sender.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/telepathy-glib/debug-sender.c b/telepathy-glib/debug-sender.c
index 1231b18..1735503 100644
--- a/telepathy-glib/debug-sender.c
+++ b/telepathy-glib/debug-sender.c
@@ -21,6 +21,7 @@
 #include "config.h"
 
 #include <telepathy-glib/dbus.h>
+#include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
 
@@ -280,17 +281,9 @@ get_messages (TpSvcDebug *self,
 {
   TpDebugSender *dbg = TP_DEBUG_SENDER (self);
   GPtrArray *messages;
-  static GType struct_type = 0;
   GList *i;
   guint j;
 
-  if (G_UNLIKELY (struct_type == 0))
-    {
-      struct_type = dbus_g_type_get_struct (
-          "GValueArray", G_TYPE_DOUBLE, G_TYPE_STRING, G_TYPE_UINT,
-          G_TYPE_STRING, G_TYPE_INVALID);
-    }
-
   messages = g_ptr_array_sized_new (g_queue_get_length (dbg->priv->messages));
 
   for (i = dbg->priv->messages->head; i; i = i->next)
@@ -298,9 +291,9 @@ get_messages (TpSvcDebug *self,
       GValue gvalue = { 0 };
       DebugMessage *message = (DebugMessage *) i->data;
 
-      g_value_init (&gvalue, struct_type);
+      g_value_init (&gvalue, TP_STRUCT_TYPE_DEBUG_MESSAGE);
       g_value_take_boxed (&gvalue,
-          dbus_g_type_specialized_construct (struct_type));
+          dbus_g_type_specialized_construct (TP_STRUCT_TYPE_DEBUG_MESSAGE));
       dbus_g_type_struct_set (&gvalue,
           0, message->timestamp,
           1, message->domain,
@@ -313,7 +306,7 @@ get_messages (TpSvcDebug *self,
   tp_svc_debug_return_from_get_messages (context, messages);
 
   for (j = 0; j < messages->len; j++)
-    g_boxed_free (struct_type, messages->pdata[j]);
+    g_boxed_free (TP_STRUCT_TYPE_DEBUG_MESSAGE, messages->pdata[j]);
 
   g_ptr_array_free (messages, TRUE);
 }
-- 
1.5.6.5




More information about the telepathy-commits mailing list