[Telepathy-commits] [telepathy-glib/master] channelspecific example: rename RoomFactory to RoomManager

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Jan 7 07:31:28 PST 2009


---
 examples/cm/channelspecific/conn.c         |    2 +-
 examples/cm/channelspecific/room-factory.c |   74 ++++++++++++++--------------
 examples/cm/channelspecific/room-factory.h |   54 ++++++++++----------
 3 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/examples/cm/channelspecific/conn.c b/examples/cm/channelspecific/conn.c
index a2cdc49..96f08fb 100644
--- a/examples/cm/channelspecific/conn.c
+++ b/examples/cm/channelspecific/conn.c
@@ -202,7 +202,7 @@ create_channel_managers (TpBaseConnection *conn)
 {
   GPtrArray *ret = g_ptr_array_sized_new (1);
 
-  g_ptr_array_add (ret, g_object_new (EXAMPLE_TYPE_CSH_ROOM_FACTORY,
+  g_ptr_array_add (ret, g_object_new (EXAMPLE_TYPE_CSH_ROOM_MANAGER,
         "connection", conn,
         NULL));
 
diff --git a/examples/cm/channelspecific/room-factory.c b/examples/cm/channelspecific/room-factory.c
index e585d66..c716fda 100644
--- a/examples/cm/channelspecific/room-factory.c
+++ b/examples/cm/channelspecific/room-factory.c
@@ -22,8 +22,8 @@
 
 static void channel_manager_iface_init (gpointer, gpointer);
 
-G_DEFINE_TYPE_WITH_CODE (ExampleCSHRoomFactory,
-    example_csh_room_factory,
+G_DEFINE_TYPE_WITH_CODE (ExampleCSHRoomManager,
+    example_csh_room_manager,
     G_TYPE_OBJECT,
     G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_MANAGER,
       channel_manager_iface_init))
@@ -36,7 +36,7 @@ enum
   N_PROPS
 };
 
-struct _ExampleCSHRoomFactoryPrivate
+struct _ExampleCSHRoomManagerPrivate
 {
   TpBaseConnection *conn;
 
@@ -46,26 +46,26 @@ struct _ExampleCSHRoomFactoryPrivate
 };
 
 static void
-example_csh_room_factory_init (ExampleCSHRoomFactory *self)
+example_csh_room_manager_init (ExampleCSHRoomManager *self)
 {
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EXAMPLE_TYPE_CSH_ROOM_FACTORY, ExampleCSHRoomFactoryPrivate);
+      EXAMPLE_TYPE_CSH_ROOM_MANAGER, ExampleCSHRoomManagerPrivate);
 
   self->priv->channels = g_hash_table_new_full (g_direct_hash, g_direct_equal,
       NULL, g_object_unref);
 }
 
-static void example_csh_room_factory_close_all (ExampleCSHRoomFactory *self);
+static void example_csh_room_manager_close_all (ExampleCSHRoomManager *self);
 
 static void
 dispose (GObject *object)
 {
-  ExampleCSHRoomFactory *self = EXAMPLE_CSH_ROOM_FACTORY (object);
+  ExampleCSHRoomManager *self = EXAMPLE_CSH_ROOM_MANAGER (object);
 
-  example_csh_room_factory_close_all (self);
+  example_csh_room_manager_close_all (self);
   g_assert (self->priv->channels == NULL);
 
-  ((GObjectClass *) example_csh_room_factory_parent_class)->dispose (object);
+  ((GObjectClass *) example_csh_room_manager_parent_class)->dispose (object);
 }
 
 static void
@@ -74,7 +74,7 @@ get_property (GObject *object,
               GValue *value,
               GParamSpec *pspec)
 {
-  ExampleCSHRoomFactory *self = EXAMPLE_CSH_ROOM_FACTORY (object);
+  ExampleCSHRoomManager *self = EXAMPLE_CSH_ROOM_MANAGER (object);
 
   switch (property_id)
     {
@@ -92,13 +92,13 @@ set_property (GObject *object,
               const GValue *value,
               GParamSpec *pspec)
 {
-  ExampleCSHRoomFactory *self = EXAMPLE_CSH_ROOM_FACTORY (object);
+  ExampleCSHRoomManager *self = EXAMPLE_CSH_ROOM_MANAGER (object);
 
   switch (property_id)
     {
     case PROP_CONNECTION:
       /* We don't ref the connection, because it owns a reference to the
-       * factory, and it guarantees that the factory's lifetime is
+       * manager, and it guarantees that the manager's lifetime is
        * less than its lifetime */
       self->priv->conn = g_value_get_object (value);
       break;
@@ -111,18 +111,18 @@ static void
 status_changed_cb (TpBaseConnection *conn,
                    guint status,
                    guint reason,
-                   ExampleCSHRoomFactory *self)
+                   ExampleCSHRoomManager *self)
 {
   if (status == TP_CONNECTION_STATUS_DISCONNECTED)
-    example_csh_room_factory_close_all (self);
+    example_csh_room_manager_close_all (self);
 }
 
 static void
 constructed (GObject *object)
 {
-  ExampleCSHRoomFactory *self = EXAMPLE_CSH_ROOM_FACTORY (object);
+  ExampleCSHRoomManager *self = EXAMPLE_CSH_ROOM_MANAGER (object);
   void (*chain_up) (GObject *) =
-      ((GObjectClass *) example_csh_room_factory_parent_class)->constructed;
+      ((GObjectClass *) example_csh_room_manager_parent_class)->constructed;
 
   if (chain_up != NULL)
     {
@@ -134,7 +134,7 @@ constructed (GObject *object)
 }
 
 static void
-example_csh_room_factory_class_init (ExampleCSHRoomFactoryClass *klass)
+example_csh_room_manager_class_init (ExampleCSHRoomManagerClass *klass)
 {
   GParamSpec *param_spec;
   GObjectClass *object_class = (GObjectClass *) klass;
@@ -145,17 +145,17 @@ example_csh_room_factory_class_init (ExampleCSHRoomFactoryClass *klass)
   object_class->set_property = set_property;
 
   param_spec = g_param_spec_object ("connection", "Connection object",
-      "The connection that owns this channel factory",
+      "The connection that owns this channel manager",
       TP_TYPE_BASE_CONNECTION,
       G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
       G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
 
-  g_type_class_add_private (klass, sizeof (ExampleCSHRoomFactoryPrivate));
+  g_type_class_add_private (klass, sizeof (ExampleCSHRoomManagerPrivate));
 }
 
 static void
-example_csh_room_factory_close_all (ExampleCSHRoomFactory *self)
+example_csh_room_manager_close_all (ExampleCSHRoomManager *self)
 {
   if (self->priv->channels != NULL)
     {
@@ -174,11 +174,11 @@ example_csh_room_factory_close_all (ExampleCSHRoomFactory *self)
 }
 
 static void
-example_csh_room_factory_foreach_channel (TpChannelManager *manager,
+example_csh_room_manager_foreach_channel (TpChannelManager *manager,
                                           TpExportableChannelFunc callback,
                                           gpointer user_data)
 {
-  ExampleCSHRoomFactory *self = EXAMPLE_CSH_ROOM_FACTORY (manager);
+  ExampleCSHRoomManager *self = EXAMPLE_CSH_ROOM_MANAGER (manager);
   GHashTableIter iter;
   gpointer handle, channel;
 
@@ -192,7 +192,7 @@ example_csh_room_factory_foreach_channel (TpChannelManager *manager,
 
 static void
 channel_closed_cb (ExampleCSHRoomChannel *chan,
-                   ExampleCSHRoomFactory *self)
+                   ExampleCSHRoomManager *self)
 {
   tp_channel_manager_emit_channel_closed_for_object (self,
       TP_EXPORTABLE_CHANNEL (chan));
@@ -210,7 +210,7 @@ channel_closed_cb (ExampleCSHRoomChannel *chan,
 }
 
 static ExampleCSHRoomChannel *
-new_channel (ExampleCSHRoomFactory *self,
+new_channel (ExampleCSHRoomManager *self,
              TpHandle handle,
              TpHandle initiator,
              gpointer request_token)
@@ -258,7 +258,7 @@ static const gchar * const allowed_properties[] = {
 };
 
 static void
-example_csh_room_factory_foreach_channel_class (TpChannelManager *manager,
+example_csh_room_manager_foreach_channel_class (TpChannelManager *manager,
     TpChannelManagerChannelClassFunc func,
     gpointer user_data)
 {
@@ -280,7 +280,7 @@ example_csh_room_factory_foreach_channel_class (TpChannelManager *manager,
 }
 
 static gboolean
-example_csh_room_factory_request (ExampleCSHRoomFactory *self,
+example_csh_room_manager_request (ExampleCSHRoomManager *self,
                                   gpointer request_token,
                                   GHashTable *request_properties,
                                   gboolean require_new)
@@ -341,22 +341,22 @@ error:
 }
 
 static gboolean
-example_csh_room_factory_create_channel (TpChannelManager *manager,
+example_csh_room_manager_create_channel (TpChannelManager *manager,
                                          gpointer request_token,
                                          GHashTable *request_properties)
 {
-    return example_csh_room_factory_request (
-        EXAMPLE_CSH_ROOM_FACTORY (manager), request_token,
+    return example_csh_room_manager_request (
+        EXAMPLE_CSH_ROOM_MANAGER (manager), request_token,
         request_properties, TRUE);
 }
 
 static gboolean
-example_csh_room_factory_ensure_channel (TpChannelManager *manager,
+example_csh_room_manager_ensure_channel (TpChannelManager *manager,
                                          gpointer request_token,
                                          GHashTable *request_properties)
 {
-    return example_csh_room_factory_request (
-        EXAMPLE_CSH_ROOM_FACTORY (manager), request_token,
+    return example_csh_room_manager_request (
+        EXAMPLE_CSH_ROOM_MANAGER (manager), request_token,
         request_properties, FALSE);
 }
 
@@ -366,11 +366,11 @@ channel_manager_iface_init (gpointer g_iface,
 {
   TpChannelManagerIface *iface = g_iface;
 
-  iface->foreach_channel = example_csh_room_factory_foreach_channel;
+  iface->foreach_channel = example_csh_room_manager_foreach_channel;
   iface->foreach_channel_class =
-      example_csh_room_factory_foreach_channel_class;
-  iface->create_channel = example_csh_room_factory_create_channel;
-  iface->ensure_channel = example_csh_room_factory_ensure_channel;
+      example_csh_room_manager_foreach_channel_class;
+  iface->create_channel = example_csh_room_manager_create_channel;
+  iface->ensure_channel = example_csh_room_manager_ensure_channel;
   /* In this channel manager, Request has the same semantics as Ensure */
-  iface->request_channel = example_csh_room_factory_ensure_channel;
+  iface->request_channel = example_csh_room_manager_ensure_channel;
 }
diff --git a/examples/cm/channelspecific/room-factory.h b/examples/cm/channelspecific/room-factory.h
index 5a6649c..6e9eb27 100644
--- a/examples/cm/channelspecific/room-factory.h
+++ b/examples/cm/channelspecific/room-factory.h
@@ -1,5 +1,5 @@
 /*
- * factory.h - header for an example channel factory
+ * manager.h - header for an example channel manager
  *
  * Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
  * Copyright (C) 2007 Nokia Corporation
@@ -9,47 +9,47 @@
  * notice and this notice are preserved.
  */
 
-#ifndef __EXAMPLE_FACTORY_H__
-#define __EXAMPLE_FACTORY_H__
+#ifndef __EXAMPLE_CSH_ROOM_MANAGER_H__
+#define __EXAMPLE_CSH_ROOM_MANAGER_H__
 
 #include <glib-object.h>
-#include <telepathy-glib/channel-factory-iface.h>
+#include <telepathy-glib/channel-manager.h>
 
 G_BEGIN_DECLS
 
-typedef struct _ExampleCSHRoomFactory ExampleCSHRoomFactory;
-typedef struct _ExampleCSHRoomFactoryClass ExampleCSHRoomFactoryClass;
-typedef struct _ExampleCSHRoomFactoryPrivate ExampleCSHRoomFactoryPrivate;
+typedef struct _ExampleCSHRoomManager ExampleCSHRoomManager;
+typedef struct _ExampleCSHRoomManagerClass ExampleCSHRoomManagerClass;
+typedef struct _ExampleCSHRoomManagerPrivate ExampleCSHRoomManagerPrivate;
 
-struct _ExampleCSHRoomFactoryClass {
+struct _ExampleCSHRoomManagerClass {
     GObjectClass parent_class;
 };
 
-struct _ExampleCSHRoomFactory {
+struct _ExampleCSHRoomManager {
     GObject parent;
 
-    ExampleCSHRoomFactoryPrivate *priv;
+    ExampleCSHRoomManagerPrivate *priv;
 };
 
-GType example_csh_room_factory_get_type (void);
+GType example_csh_room_manager_get_type (void);
 
 /* TYPE MACROS */
-#define EXAMPLE_TYPE_CSH_ROOM_FACTORY \
-  (example_csh_room_factory_get_type ())
-#define EXAMPLE_CSH_ROOM_FACTORY(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_CSH_ROOM_FACTORY, \
-                              ExampleCSHRoomFactory))
-#define EXAMPLE_CSH_ROOM_FACTORY_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_CSH_ROOM_FACTORY, \
-                           ExampleCSHRoomFactoryClass))
-#define EXAMPLE_IS_CSH_ROOM_FACTORY(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_CSH_ROOM_FACTORY))
-#define EXAMPLE_IS_CSH_ROOM_FACTORY_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_CSH_ROOM_FACTORY))
-#define EXAMPLE_CSH_ROOM_FACTORY_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CSH_ROOM_FACTORY, \
-                              ExampleCSHRoomFactoryClass))
+#define EXAMPLE_TYPE_CSH_ROOM_MANAGER \
+  (example_csh_room_manager_get_type ())
+#define EXAMPLE_CSH_ROOM_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_CSH_ROOM_MANAGER, \
+                              ExampleCSHRoomManager))
+#define EXAMPLE_CSH_ROOM_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_CSH_ROOM_MANAGER, \
+                           ExampleCSHRoomManagerClass))
+#define EXAMPLE_IS_CSH_ROOM_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_CSH_ROOM_MANAGER))
+#define EXAMPLE_IS_CSH_ROOM_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_CSH_ROOM_MANAGER))
+#define EXAMPLE_CSH_ROOM_MANAGER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CSH_ROOM_MANAGER, \
+                              ExampleCSHRoomManagerClass))
 
 G_END_DECLS
 
-#endif /* #ifndef __EXAMPLE_FACTORY_H__ */
+#endif
-- 
1.5.6.5




More information about the Telepathy-commits mailing list