[next] telepathy-glib: TpTestsEchoChannel, TpTestsTextChannelGroup: Use constructed instead of constructor

Xavier Claessens xclaesse at kemper.freedesktop.org
Thu Jun 28 08:12:56 PDT 2012


Module: telepathy-glib
Branch: next
Commit: aec08630448a29734afed2a8354ac591ece94227
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=aec08630448a29734afed2a8354ac591ece94227

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Tue Jun 26 15:52:50 2012 +0200

TpTestsEchoChannel, TpTestsTextChannelGroup: Use constructed instead of constructor

This ensure that TpBaseChannel::constructed is called before tp_base_channel_register(),
otherwise it won't have set the default object path yet.

---

 tests/lib/echo-chan.c      |   15 +++++----------
 tests/lib/textchan-group.c |   16 ++++++----------
 2 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/tests/lib/echo-chan.c b/tests/lib/echo-chan.c
index 236ffff..0f7327a 100644
--- a/tests/lib/echo-chan.c
+++ b/tests/lib/echo-chan.c
@@ -53,14 +53,9 @@ tp_tests_echo_channel_init (TpTestsEchoChannel *self)
 static void text_send (GObject *object, TpMessage *message,
     TpMessageSendingFlags flags);
 
-static GObject *
-constructor (GType type,
-             guint n_props,
-             GObjectConstructParam *props)
+static void
+constructed (GObject *object)
 {
-  GObject *object =
-      G_OBJECT_CLASS (tp_tests_echo_channel_parent_class)->constructor (type,
-          n_props, props);
   TpTestsEchoChannel *self = TP_TESTS_ECHO_CHANNEL (object);
   TpBaseConnection *conn = tp_base_channel_get_connection (TP_BASE_CHANNEL (self));
   const TpChannelTextMessageType types[] = {
@@ -74,6 +69,8 @@ constructor (GType type,
   };
   g_assert (conn != NULL);
 
+  G_OBJECT_CLASS (tp_tests_echo_channel_parent_class)->constructed (object);
+
   tp_base_channel_register (TP_BASE_CHANNEL (self));
 
   tp_message_mixin_init (object,
@@ -82,8 +79,6 @@ constructor (GType type,
   tp_message_mixin_implement_sending (object,
       text_send, G_N_ELEMENTS (types), types, 0, 0,
       supported_content_types);
-
-  return object;
 }
 
 static void
@@ -135,7 +130,7 @@ tp_tests_echo_channel_class_init (TpTestsEchoChannelClass *klass)
   GObjectClass *object_class = (GObjectClass *) klass;
   TpBaseChannelClass *base_class = TP_BASE_CHANNEL_CLASS (klass);
 
-  object_class->constructor = constructor;
+  object_class->constructed = constructed;
   object_class->finalize = finalize;
 
   base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT;
diff --git a/tests/lib/textchan-group.c b/tests/lib/textchan-group.c
index 88931cf..60e4ada 100644
--- a/tests/lib/textchan-group.c
+++ b/tests/lib/textchan-group.c
@@ -128,14 +128,9 @@ text_send (GObject *object,
   tp_message_mixin_sent (object, message, 0, "", NULL);
 }
 
-static GObject *
-constructor (GType type,
-             guint n_props,
-             GObjectConstructParam *props)
+static void
+constructed (GObject *object)
 {
-  GObject *object =
-      G_OBJECT_CLASS (tp_tests_text_channel_group_parent_class)->constructor (type,
-          n_props, props);
   TpTestsTextChannelGroup *self = TP_TESTS_TEXT_CHANNEL_GROUP (object);
   TpHandleRepoIface *contact_repo;
   TpChannelGroupFlags flags = 0;
@@ -150,6 +145,9 @@ constructor (GType type,
       NULL
   };
 
+  G_OBJECT_CLASS (tp_tests_text_channel_group_parent_class)->constructed (
+      object);
+
   self->conn = tp_base_channel_get_connection (base);
 
   contact_repo = tp_base_connection_get_handles (self->conn,
@@ -172,8 +170,6 @@ constructor (GType type,
       tp_base_connection_get_self_handle (self->conn));
 
   tp_group_mixin_change_flags (object, flags, 0);
-
-  return object;
 }
 
 static void
@@ -227,7 +223,7 @@ tp_tests_text_channel_group_class_init (TpTestsTextChannelGroupClass *klass)
 
   g_type_class_add_private (klass, sizeof (TpTestsTextChannelGroupPrivate));
 
-  object_class->constructor = constructor;
+  object_class->constructed = constructed;
   object_class->dispose = dispose;
   object_class->finalize = finalize;
 



More information about the telepathy-commits mailing list