[Telepathy-commits] [telepathy-glib/master] echo example CM: rename to ExampleEchoFactory to ExampleEchoImManager
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Jan 7 08:01:30 PST 2009
---
examples/cm/echo/conn.c | 2 +-
examples/cm/echo/im-manager.c | 72 ++++++++++++++++++++--------------------
examples/cm/echo/im-manager.h | 53 +++++++++++++++---------------
3 files changed, 63 insertions(+), 64 deletions(-)
diff --git a/examples/cm/echo/conn.c b/examples/cm/echo/conn.c
index 1d7c186..9531c31 100644
--- a/examples/cm/echo/conn.c
+++ b/examples/cm/echo/conn.c
@@ -126,7 +126,7 @@ create_channel_managers (TpBaseConnection *conn)
{
GPtrArray *ret = g_ptr_array_sized_new (1);
- g_ptr_array_add (ret, g_object_new (EXAMPLE_TYPE_ECHO_FACTORY,
+ g_ptr_array_add (ret, g_object_new (EXAMPLE_TYPE_ECHO_IM_MANAGER,
"connection", conn,
NULL));
diff --git a/examples/cm/echo/im-manager.c b/examples/cm/echo/im-manager.c
index 540d12a..95b90b8 100644
--- a/examples/cm/echo/im-manager.c
+++ b/examples/cm/echo/im-manager.c
@@ -25,8 +25,8 @@
static void channel_manager_iface_init (gpointer, gpointer);
-G_DEFINE_TYPE_WITH_CODE (ExampleEchoFactory,
- example_echo_factory,
+G_DEFINE_TYPE_WITH_CODE (ExampleEchoImManager,
+ example_echo_im_manager,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_MANAGER,
channel_manager_iface_init))
@@ -39,7 +39,7 @@ enum
N_PROPS
};
-struct _ExampleEchoFactoryPrivate
+struct _ExampleEchoImManagerPrivate
{
TpBaseConnection *conn;
@@ -49,26 +49,26 @@ struct _ExampleEchoFactoryPrivate
};
static void
-example_echo_factory_init (ExampleEchoFactory *self)
+example_echo_im_manager_init (ExampleEchoImManager *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_TYPE_ECHO_FACTORY,
- ExampleEchoFactoryPrivate);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_TYPE_ECHO_IM_MANAGER,
+ ExampleEchoImManagerPrivate);
self->priv->channels = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, g_object_unref);
}
-static void example_echo_factory_close_all (ExampleEchoFactory *self);
+static void example_echo_im_manager_close_all (ExampleEchoImManager *self);
static void
dispose (GObject *object)
{
- ExampleEchoFactory *self = EXAMPLE_ECHO_FACTORY (object);
+ ExampleEchoImManager *self = EXAMPLE_ECHO_IM_MANAGER (object);
- example_echo_factory_close_all (self);
+ example_echo_im_manager_close_all (self);
g_assert (self->priv->channels == NULL);
- ((GObjectClass *) example_echo_factory_parent_class)->dispose (object);
+ ((GObjectClass *) example_echo_im_manager_parent_class)->dispose (object);
}
static void
@@ -77,7 +77,7 @@ get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ExampleEchoFactory *self = EXAMPLE_ECHO_FACTORY (object);
+ ExampleEchoImManager *self = EXAMPLE_ECHO_IM_MANAGER (object);
switch (property_id)
{
@@ -95,13 +95,13 @@ set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ExampleEchoFactory *self = EXAMPLE_ECHO_FACTORY (object);
+ ExampleEchoImManager *self = EXAMPLE_ECHO_IM_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
+ * channel manager, and it guarantees that the manager's lifetime is
* less than its lifetime */
self->priv->conn = g_value_get_object (value);
break;
@@ -114,18 +114,18 @@ static void
status_changed_cb (TpBaseConnection *conn,
guint status,
guint reason,
- ExampleEchoFactory *self)
+ ExampleEchoImManager *self)
{
if (status == TP_CONNECTION_STATUS_DISCONNECTED)
- example_echo_factory_close_all (self);
+ example_echo_im_manager_close_all (self);
}
static void
constructed (GObject *object)
{
- ExampleEchoFactory *self = EXAMPLE_ECHO_FACTORY (object);
+ ExampleEchoImManager *self = EXAMPLE_ECHO_IM_MANAGER (object);
void (*chain_up) (GObject *) =
- ((GObjectClass *) example_echo_factory_parent_class)->constructed;
+ ((GObjectClass *) example_echo_im_manager_parent_class)->constructed;
if (chain_up != NULL)
{
@@ -137,7 +137,7 @@ constructed (GObject *object)
}
static void
-example_echo_factory_class_init (ExampleEchoFactoryClass *klass)
+example_echo_im_manager_class_init (ExampleEchoImManagerClass *klass)
{
GParamSpec *param_spec;
GObjectClass *object_class = (GObjectClass *) klass;
@@ -148,17 +148,17 @@ example_echo_factory_class_init (ExampleEchoFactoryClass *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 (ExampleEchoFactoryPrivate));
+ g_type_class_add_private (klass, sizeof (ExampleEchoImManagerPrivate));
}
static void
-example_echo_factory_close_all (ExampleEchoFactory *self)
+example_echo_im_manager_close_all (ExampleEchoImManager *self)
{
if (self->priv->channels != NULL)
{
@@ -177,11 +177,11 @@ example_echo_factory_close_all (ExampleEchoFactory *self)
}
static void
-example_echo_factory_foreach_channel (TpChannelManager *iface,
+example_echo_im_manager_foreach_channel (TpChannelManager *iface,
TpExportableChannelFunc callback,
gpointer user_data)
{
- ExampleEchoFactory *self = EXAMPLE_ECHO_FACTORY (iface);
+ ExampleEchoImManager *self = EXAMPLE_ECHO_IM_MANAGER (iface);
GHashTableIter iter;
gpointer handle, channel;
@@ -195,7 +195,7 @@ example_echo_factory_foreach_channel (TpChannelManager *iface,
static void
channel_closed_cb (ExampleEchoChannel *chan,
- ExampleEchoFactory *self)
+ ExampleEchoImManager *self)
{
tp_channel_manager_emit_channel_closed_for_object (self,
TP_EXPORTABLE_CHANNEL (chan));
@@ -226,7 +226,7 @@ channel_closed_cb (ExampleEchoChannel *chan,
}
static ExampleEchoChannel *
-new_channel (ExampleEchoFactory *self,
+new_channel (ExampleEchoImManager *self,
TpHandle handle,
TpHandle initiator,
gpointer request_token)
@@ -274,7 +274,7 @@ static const gchar * const allowed_properties[] = {
};
static void
-example_echo_factory_foreach_channel_class (TpChannelManager *manager,
+example_echo_im_manager_foreach_channel_class (TpChannelManager *manager,
TpChannelManagerChannelClassFunc func,
gpointer user_data)
{
@@ -296,7 +296,7 @@ example_echo_factory_foreach_channel_class (TpChannelManager *manager,
}
static gboolean
-example_echo_factory_request (ExampleEchoFactory *self,
+example_echo_im_manager_request (ExampleEchoImManager *self,
gpointer request_token,
GHashTable *request_properties,
gboolean require_new)
@@ -357,20 +357,20 @@ error:
}
static gboolean
-example_echo_factory_create_channel (TpChannelManager *manager,
+example_echo_im_manager_create_channel (TpChannelManager *manager,
gpointer request_token,
GHashTable *request_properties)
{
- return example_echo_factory_request (EXAMPLE_ECHO_FACTORY (manager),
+ return example_echo_im_manager_request (EXAMPLE_ECHO_IM_MANAGER (manager),
request_token, request_properties, TRUE);
}
static gboolean
-example_echo_factory_ensure_channel (TpChannelManager *manager,
+example_echo_im_manager_ensure_channel (TpChannelManager *manager,
gpointer request_token,
GHashTable *request_properties)
{
- return example_echo_factory_request (EXAMPLE_ECHO_FACTORY (manager),
+ return example_echo_im_manager_request (EXAMPLE_ECHO_IM_MANAGER (manager),
request_token, request_properties, FALSE);
}
@@ -380,10 +380,10 @@ channel_manager_iface_init (gpointer g_iface,
{
TpChannelManagerIface *iface = g_iface;
- iface->foreach_channel = example_echo_factory_foreach_channel;
- iface->foreach_channel_class = example_echo_factory_foreach_channel_class;
- iface->create_channel = example_echo_factory_create_channel;
- iface->ensure_channel = example_echo_factory_ensure_channel;
+ iface->foreach_channel = example_echo_im_manager_foreach_channel;
+ iface->foreach_channel_class = example_echo_im_manager_foreach_channel_class;
+ iface->create_channel = example_echo_im_manager_create_channel;
+ iface->ensure_channel = example_echo_im_manager_ensure_channel;
/* In this channel manager, Request has the same semantics as Ensure */
- iface->request_channel = example_echo_factory_ensure_channel;
+ iface->request_channel = example_echo_im_manager_ensure_channel;
}
diff --git a/examples/cm/echo/im-manager.h b/examples/cm/echo/im-manager.h
index 4b74cb2..9022ba9 100644
--- a/examples/cm/echo/im-manager.h
+++ b/examples/cm/echo/im-manager.h
@@ -1,5 +1,5 @@
/*
- * factory.h - header for an example channel factory
+ * im-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,46 @@
* notice and this notice are preserved.
*/
-#ifndef __EXAMPLE_FACTORY_H__
-#define __EXAMPLE_FACTORY_H__
+#ifndef __EXAMPLE_ECHO_IM_MANAGER_H__
+#define __EXAMPLE_ECHO_IM_MANAGER_H__
#include <glib-object.h>
-#include <telepathy-glib/channel-factory-iface.h>
G_BEGIN_DECLS
-typedef struct _ExampleEchoFactory ExampleEchoFactory;
-typedef struct _ExampleEchoFactoryClass ExampleEchoFactoryClass;
-typedef struct _ExampleEchoFactoryPrivate ExampleEchoFactoryPrivate;
+typedef struct _ExampleEchoImManager ExampleEchoImManager;
+typedef struct _ExampleEchoImManagerClass ExampleEchoImManagerClass;
+typedef struct _ExampleEchoImManagerPrivate ExampleEchoImManagerPrivate;
-struct _ExampleEchoFactoryClass {
+struct _ExampleEchoImManagerClass {
GObjectClass parent_class;
};
-struct _ExampleEchoFactory {
+struct _ExampleEchoImManager {
GObject parent;
- ExampleEchoFactoryPrivate *priv;
+ ExampleEchoImManagerPrivate *priv;
};
-GType example_echo_factory_get_type (void);
+GType example_echo_im_manager_get_type (void);
/* TYPE MACROS */
-#define EXAMPLE_TYPE_ECHO_FACTORY \
- (example_echo_factory_get_type ())
-#define EXAMPLE_ECHO_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_ECHO_FACTORY, \
- ExampleEchoFactory))
-#define EXAMPLE_ECHO_FACTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_ECHO_FACTORY, \
- ExampleEchoFactoryClass))
-#define EXAMPLE_IS_ECHO_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_ECHO_FACTORY))
-#define EXAMPLE_IS_ECHO_FACTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_ECHO_FACTORY))
-#define EXAMPLE_ECHO_FACTORY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_ECHO_FACTORY, \
- ExampleEchoFactoryClass))
+#define EXAMPLE_TYPE_ECHO_IM_MANAGER \
+ (example_echo_im_manager_get_type ())
+#define EXAMPLE_ECHO_IM_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_ECHO_IM_MANAGER, \
+ ExampleEchoImManager))
+#define EXAMPLE_ECHO_IM_MANAGER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_ECHO_IM_MANAGER, \
+ ExampleEchoImManagerClass))
+#define EXAMPLE_IS_ECHO_IM_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_ECHO_IM_MANAGER))
+#define EXAMPLE_IS_ECHO_IM_MANAGER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_ECHO_IM_MANAGER))
+#define EXAMPLE_ECHO_IM_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_ECHO_IM_MANAGER, \
+ ExampleEchoImManagerClass))
G_END_DECLS
-#endif /* #ifndef __EXAMPLE_FACTORY_H__ */
+#endif
--
1.5.6.5
More information about the Telepathy-commits
mailing list