[Telepathy-commits] [telepathy-qt4/master] Add support for channel without properties on csh, so fallbacks on Telepathy::Client::Channel can be tested.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Fri Feb 13 06:42:05 PST 2009


---
 tests/lib/csh/conn.c         |   21 +++++++++++++++++++++
 tests/lib/csh/conn.h         |    3 +++
 tests/lib/csh/room-manager.c |   18 +++++++++++++++++-
 tests/lib/csh/room-manager.h |    3 +++
 tests/lib/csh/room.c         |   17 +++++++++++++++--
 tests/lib/csh/room.h         |   29 +++++++++++++++++++++++++++++
 6 files changed, 88 insertions(+), 3 deletions(-)

diff --git a/tests/lib/csh/conn.c b/tests/lib/csh/conn.c
index ff77f32..ef036c3 100644
--- a/tests/lib/csh/conn.c
+++ b/tests/lib/csh/conn.c
@@ -317,3 +317,24 @@ example_csh_connection_accept_invitations (ExampleCSHConnection *self)
         }
     }
 }
+
+void
+example_csh_connection_set_use_properties_room (ExampleCSHConnection *self,
+                                                gboolean use_properties_room)
+{
+  TpChannelManagerIter iter;
+  TpChannelManager *channel_manager;
+
+  g_return_if_fail (EXAMPLE_IS_CSH_CONNECTION (self));
+
+  tp_base_connection_channel_manager_iter_init (&iter, (TpBaseConnection *) self);
+
+  while (tp_base_connection_channel_manager_iter_next (&iter, &channel_manager))
+    {
+      if (EXAMPLE_IS_CSH_ROOM_MANAGER (channel_manager))
+        {
+          example_csh_room_manager_set_use_properties_room (
+            (ExampleCSHRoomManager *) channel_manager, use_properties_room);
+        }
+    }
+}
diff --git a/tests/lib/csh/conn.h b/tests/lib/csh/conn.h
index 7b8527a..7db265f 100644
--- a/tests/lib/csh/conn.h
+++ b/tests/lib/csh/conn.h
@@ -38,6 +38,9 @@ void example_csh_connection_set_enable_change_members_detailed (ExampleCSHConnec
                                                                 gboolean enable);
 void example_csh_connection_accept_invitations (ExampleCSHConnection *self);
 
+void example_csh_connection_set_use_properties_room (ExampleCSHConnection *self,
+                                                     gboolean use_properties_room);
+
 /* TYPE MACROS */
 #define EXAMPLE_TYPE_CSH_CONNECTION \
   (example_csh_connection_get_type ())
diff --git a/tests/lib/csh/room-manager.c b/tests/lib/csh/room-manager.c
index 0adfa81..1b580e2 100644
--- a/tests/lib/csh/room-manager.c
+++ b/tests/lib/csh/room-manager.c
@@ -45,6 +45,7 @@ struct _ExampleCSHRoomManagerPrivate
   gulong status_changed_id;
 
   unsigned enable_change_members_detailed:1;
+  unsigned use_properties_room:1;
 };
 
 static void
@@ -134,6 +135,7 @@ constructed (GObject *object)
   self->priv->status_changed_id = g_signal_connect (self->priv->conn,
       "status-changed", (GCallback) status_changed_cb, self);
   self->priv->enable_change_members_detailed = FALSE;
+  self->priv->use_properties_room = TRUE;
 }
 
 static void
@@ -221,11 +223,16 @@ new_channel (ExampleCSHRoomManager *self,
   ExampleCSHRoomChannel *chan;
   gchar *object_path;
   GSList *requests = NULL;
+  GType room_type;
 
   object_path = g_strdup_printf ("%s/CSHRoomChannel%u",
       self->priv->conn->object_path, handle);
 
-  chan = g_object_new (EXAMPLE_TYPE_CSH_ROOM_CHANNEL,
+  if (self->priv->use_properties_room)
+    room_type = EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL;
+  else
+    room_type = EXAMPLE_TYPE_CSH_ROOM_CHANNEL;
+  chan = g_object_new (room_type,
       "connection", self->priv->conn,
       "object-path", object_path,
       "handle", handle,
@@ -413,3 +420,12 @@ example_csh_room_manager_accept_invitations (ExampleCSHRoomManager *self)
   while (g_hash_table_iter_next (&iter, &handle, &channel))
     example_csh_room_accept_invitations (EXAMPLE_CSH_ROOM_CHANNEL (channel));
 }
+
+void
+example_csh_room_manager_set_use_properties_room (ExampleCSHRoomManager *self,
+                                                  gboolean use_properties_room)
+{
+  g_return_if_fail (EXAMPLE_IS_CSH_ROOM_MANAGER (self));
+
+  self->priv->use_properties_room = use_properties_room;
+}
diff --git a/tests/lib/csh/room-manager.h b/tests/lib/csh/room-manager.h
index e6123a8..6ce2f81 100644
--- a/tests/lib/csh/room-manager.h
+++ b/tests/lib/csh/room-manager.h
@@ -37,6 +37,9 @@ void example_csh_room_manager_set_enable_change_members_detailed (ExampleCSHRoom
                                                                   gboolean enable);
 void example_csh_room_manager_accept_invitations (ExampleCSHRoomManager *manager);
 
+void example_csh_room_manager_set_use_properties_room (ExampleCSHRoomManager *manager,
+                                                       gboolean use_properties_room);
+
 /* TYPE MACROS */
 #define EXAMPLE_TYPE_CSH_ROOM_MANAGER \
   (example_csh_room_manager_get_type ())
diff --git a/tests/lib/csh/room.c b/tests/lib/csh/room.c
index 167df34..6651ad9 100644
--- a/tests/lib/csh/room.c
+++ b/tests/lib/csh/room.c
@@ -28,11 +28,15 @@ G_DEFINE_TYPE_WITH_CODE (ExampleCSHRoomChannel,
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, text_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
       tp_group_mixin_iface_init);
-    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
-      tp_dbus_properties_mixin_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_EXPORTABLE_CHANNEL, NULL);
     G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_IFACE, NULL))
 
+G_DEFINE_TYPE_WITH_CODE (ExampleCSHRoomPropertiesChannel,
+    example_csh_room_properties_channel,
+    EXAMPLE_TYPE_CSH_ROOM_CHANNEL,
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
+      tp_dbus_properties_mixin_iface_init))
+
 /* type definition stuff */
 
 enum
@@ -80,6 +84,11 @@ example_csh_room_channel_init (ExampleCSHRoomChannel *self)
       ExampleCSHRoomChannelPrivate);
 }
 
+static void
+example_csh_room_properties_channel_init (ExampleCSHRoomPropertiesChannel *self)
+{
+}
+
 static TpHandle
 suggest_room_identity (ExampleCSHRoomChannel *self)
 {
@@ -685,6 +694,10 @@ example_csh_room_channel_class_init (ExampleCSHRoomChannelClass *klass)
   tp_group_mixin_init_dbus_properties (object_class);
 }
 
+static void
+example_csh_room_properties_channel_class_init (ExampleCSHRoomPropertiesChannelClass *klass)
+{
+}
 
 static void
 channel_close (TpSvcChannel *iface,
diff --git a/tests/lib/csh/room.h b/tests/lib/csh/room.h
index b3b92a7..117af4e 100644
--- a/tests/lib/csh/room.h
+++ b/tests/lib/csh/room.h
@@ -63,6 +63,35 @@ struct _ExampleCSHRoomChannel {
     ExampleCSHRoomChannelPrivate *priv;
 };
 
+typedef struct _ExampleCSHRoomPropertiesChannel ExampleCSHRoomPropertiesChannel;
+typedef struct _ExampleCSHRoomPropertiesChannelClass ExampleCSHRoomPropertiesChannelClass;
+
+GType example_csh_room_properties_channel_get_type (void);
+
+#define EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL \
+  (example_csh_room_properties_channel_get_type ())
+#define EXAMPLE_CSH_ROOM_PROPERTIES_CHANNEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL, \
+                               ExampleCSHRoomPropertiesChannel))
+#define EXAMPLE_CSH_ROOM_PROPERTIES_CHANNEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL, \
+                            ExampleCSHRoomPropertiesChannelClass))
+#define EXAMPLE_IS_CSH_ROOM_PROPERTIES_CHANNEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL))
+#define EXAMPLE_IS_CSH_ROOM_PROPERTIES_CHANNEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL))
+#define EXAMPLE_CSH_ROOM_PROPERTIES_CHANNEL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CSH_ROOM_PROPERTIES_CHANNEL, \
+                              ExampleCSHRoomPropertiesChannelClass))
+
+struct _ExampleCSHRoomPropertiesChannelClass {
+    ExampleCSHRoomChannelClass parent_class;
+};
+
+struct _ExampleCSHRoomPropertiesChannel {
+    ExampleCSHRoomChannel parent;
+};
+
 G_END_DECLS
 
 #endif
-- 
1.5.6.5




More information about the telepathy-commits mailing list