[Telepathy-commits] [telepathy-glib/master] channelspecific example: rename manager.[ch] to connection-manager.[ch]
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Jan 7 07:27:56 PST 2009
---
examples/cm/channelspecific/Makefile.am | 6 +-
examples/cm/channelspecific/connection-manager.c | 137 ++++++++++++++++++++++
examples/cm/channelspecific/connection-manager.h | 55 +++++++++
examples/cm/channelspecific/main.c | 2 +-
examples/cm/channelspecific/manager.c | 137 ----------------------
examples/cm/channelspecific/manager.h | 55 ---------
6 files changed, 196 insertions(+), 196 deletions(-)
create mode 100644 examples/cm/channelspecific/connection-manager.c
create mode 100644 examples/cm/channelspecific/connection-manager.h
delete mode 100644 examples/cm/channelspecific/manager.c
delete mode 100644 examples/cm/channelspecific/manager.h
diff --git a/examples/cm/channelspecific/Makefile.am b/examples/cm/channelspecific/Makefile.am
index 855050d..48bb8d8 100644
--- a/examples/cm/channelspecific/Makefile.am
+++ b/examples/cm/channelspecific/Makefile.am
@@ -7,12 +7,12 @@ noinst_LTLIBRARIES = libexample-cm-csh.la
libexample_cm_csh_la_SOURCES = \
conn.c \
conn.h \
+ connection-manager.c \
+ connection-manager.h \
room.c \
room.h \
room-factory.c \
- room-factory.h \
- manager.c \
- manager.h
+ room-factory.h
# In an external project you'd use $(TP_GLIB_LIBS) (obtained from
# pkg-config via autoconf) instead of the .la path
diff --git a/examples/cm/channelspecific/connection-manager.c b/examples/cm/channelspecific/connection-manager.c
new file mode 100644
index 0000000..8c2cd18
--- /dev/null
+++ b/examples/cm/channelspecific/connection-manager.c
@@ -0,0 +1,137 @@
+/*
+ * manager.c - an example connection manager
+ *
+ * Copyright (C) 2007-2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2007-2008 Nokia Corporation
+ *
+ * Copying and distribution of this file, with or without modification,
+ * are permitted in any medium without royalty provided the copyright
+ * notice and this notice are preserved.
+ */
+
+#include "connection-manager.h"
+
+#include <string.h>
+
+#include <dbus/dbus-protocol.h>
+#include <dbus/dbus-glib.h>
+
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/errors.h>
+
+#include "conn.h"
+
+G_DEFINE_TYPE (ExampleCSHConnectionManager,
+ example_csh_connection_manager,
+ TP_TYPE_BASE_CONNECTION_MANAGER)
+
+/* type definition stuff */
+
+static void
+example_csh_connection_manager_init (ExampleCSHConnectionManager *self)
+{
+}
+
+/* private data */
+
+typedef struct {
+ gchar *account;
+} ExampleParams;
+
+
+/* See example_csh_normalize_contact in conn.c. */
+static gboolean
+account_param_filter (const TpCMParamSpec *paramspec,
+ GValue *value,
+ GError **error)
+{
+ const gchar *id = g_value_get_string (value);
+ const gchar *at;
+
+ if (id[0] == '\0')
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "account must not be empty");
+ return FALSE;
+ }
+
+ at = strchr (id, '@');
+
+ if (at == NULL || at == id || at[1] == '\0')
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "account must look like aaa at bbb");
+ return FALSE;
+ }
+
+ if (strchr (at, '#') != NULL)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "realm cannot contain '#' except at the beginning");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static const TpCMParamSpec example_params[] = {
+ { "account", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING,
+ TP_CONN_MGR_PARAM_FLAG_REQUIRED | TP_CONN_MGR_PARAM_FLAG_REGISTER, NULL,
+ G_STRUCT_OFFSET (ExampleParams, account),
+ account_param_filter, NULL },
+
+ { NULL }
+};
+
+static gpointer
+alloc_params (void)
+{
+ return g_slice_new0 (ExampleParams);
+}
+
+static void
+free_params (gpointer p)
+{
+ ExampleParams *params = p;
+
+ g_free (params->account);
+
+ g_slice_free (ExampleParams, params);
+}
+
+static const TpCMProtocolSpec example_protocols[] = {
+ { "example", example_params, alloc_params, free_params },
+ { NULL, NULL }
+};
+
+static TpBaseConnection *
+new_connection (TpBaseConnectionManager *self,
+ const gchar *proto,
+ TpIntSet *params_present,
+ gpointer parsed_params,
+ GError **error)
+{
+ ExampleParams *params = parsed_params;
+ ExampleCSHConnection *conn;
+
+ conn = EXAMPLE_CSH_CONNECTION
+ (g_object_new (EXAMPLE_TYPE_CSH_CONNECTION,
+ "account", params->account,
+ "protocol", proto,
+ NULL));
+
+ return (TpBaseConnection *) conn;
+}
+
+static void
+example_csh_connection_manager_class_init (
+ ExampleCSHConnectionManagerClass *klass)
+{
+ TpBaseConnectionManagerClass *base_class =
+ (TpBaseConnectionManagerClass *) klass;
+
+ base_class->new_connection = new_connection;
+ base_class->cm_dbus_name = "example_csh";
+ base_class->protocol_params = example_protocols;
+}
diff --git a/examples/cm/channelspecific/connection-manager.h b/examples/cm/channelspecific/connection-manager.h
new file mode 100644
index 0000000..eaf2a2c
--- /dev/null
+++ b/examples/cm/channelspecific/connection-manager.h
@@ -0,0 +1,55 @@
+/*
+ * manager.h - header for an example connection manager
+ *
+ * Copyright (C) 2007-2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2007-2008 Nokia Corporation
+ *
+ * Copying and distribution of this file, with or without modification,
+ * are permitted in any medium without royalty provided the copyright
+ * notice and this notice are preserved.
+ */
+
+#ifndef __EXAMPLE_CSH_CONNECTION_MANAGER_H__
+#define __EXAMPLE_CSH_CONNECTION_MANAGER_H__
+
+#include <glib-object.h>
+#include <telepathy-glib/base-connection-manager.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ExampleCSHConnectionManager ExampleCSHConnectionManager;
+typedef struct _ExampleCSHConnectionManagerClass
+ ExampleCSHConnectionManagerClass;
+
+struct _ExampleCSHConnectionManagerClass {
+ TpBaseConnectionManagerClass parent_class;
+};
+
+struct _ExampleCSHConnectionManager {
+ TpBaseConnectionManager parent;
+
+ gpointer priv;
+};
+
+GType example_csh_connection_manager_get_type (void);
+
+/* TYPE MACROS */
+#define EXAMPLE_TYPE_CSH_CONNECTION_MANAGER \
+ (example_csh_connection_manager_get_type ())
+#define EXAMPLE_CSH_CONNECTION_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
+ ExampleCSHConnectionManager))
+#define EXAMPLE_CSH_CONNECTION_MANAGER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
+ ExampleCSHConnectionManagerClass))
+#define EXAMPLE_IS_CSH_CONNECTION_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER))
+#define EXAMPLE_IS_CSH_CONNECTION_MANAGER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER))
+#define EXAMPLE_CSH_CONNECTION_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
+ ExampleCSHConnectionManagerClass))
+
+G_END_DECLS
+
+#endif
diff --git a/examples/cm/channelspecific/main.c b/examples/cm/channelspecific/main.c
index 1b2d7a2..843d5a7 100644
--- a/examples/cm/channelspecific/main.c
+++ b/examples/cm/channelspecific/main.c
@@ -14,7 +14,7 @@
#include <telepathy-glib/debug.h>
#include <telepathy-glib/run.h>
-#include "manager.h"
+#include "examples/cm/channelspecific/connection-manager.h"
static TpBaseConnectionManager *
construct_cm (void)
diff --git a/examples/cm/channelspecific/manager.c b/examples/cm/channelspecific/manager.c
deleted file mode 100644
index bb27488..0000000
--- a/examples/cm/channelspecific/manager.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * manager.c - an example connection manager
- *
- * Copyright (C) 2007-2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2007-2008 Nokia Corporation
- *
- * Copying and distribution of this file, with or without modification,
- * are permitted in any medium without royalty provided the copyright
- * notice and this notice are preserved.
- */
-
-#include "manager.h"
-
-#include <string.h>
-
-#include <dbus/dbus-protocol.h>
-#include <dbus/dbus-glib.h>
-
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/errors.h>
-
-#include "conn.h"
-
-G_DEFINE_TYPE (ExampleCSHConnectionManager,
- example_csh_connection_manager,
- TP_TYPE_BASE_CONNECTION_MANAGER)
-
-/* type definition stuff */
-
-static void
-example_csh_connection_manager_init (ExampleCSHConnectionManager *self)
-{
-}
-
-/* private data */
-
-typedef struct {
- gchar *account;
-} ExampleParams;
-
-
-/* See example_csh_normalize_contact in conn.c. */
-static gboolean
-account_param_filter (const TpCMParamSpec *paramspec,
- GValue *value,
- GError **error)
-{
- const gchar *id = g_value_get_string (value);
- const gchar *at;
-
- if (id[0] == '\0')
- {
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
- "account must not be empty");
- return FALSE;
- }
-
- at = strchr (id, '@');
-
- if (at == NULL || at == id || at[1] == '\0')
- {
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
- "account must look like aaa at bbb");
- return FALSE;
- }
-
- if (strchr (at, '#') != NULL)
- {
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
- "realm cannot contain '#' except at the beginning");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static const TpCMParamSpec example_params[] = {
- { "account", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING,
- TP_CONN_MGR_PARAM_FLAG_REQUIRED | TP_CONN_MGR_PARAM_FLAG_REGISTER, NULL,
- G_STRUCT_OFFSET (ExampleParams, account),
- account_param_filter, NULL },
-
- { NULL }
-};
-
-static gpointer
-alloc_params (void)
-{
- return g_slice_new0 (ExampleParams);
-}
-
-static void
-free_params (gpointer p)
-{
- ExampleParams *params = p;
-
- g_free (params->account);
-
- g_slice_free (ExampleParams, params);
-}
-
-static const TpCMProtocolSpec example_protocols[] = {
- { "example", example_params, alloc_params, free_params },
- { NULL, NULL }
-};
-
-static TpBaseConnection *
-new_connection (TpBaseConnectionManager *self,
- const gchar *proto,
- TpIntSet *params_present,
- gpointer parsed_params,
- GError **error)
-{
- ExampleParams *params = parsed_params;
- ExampleCSHConnection *conn;
-
- conn = EXAMPLE_CSH_CONNECTION
- (g_object_new (EXAMPLE_TYPE_CSH_CONNECTION,
- "account", params->account,
- "protocol", proto,
- NULL));
-
- return (TpBaseConnection *) conn;
-}
-
-static void
-example_csh_connection_manager_class_init (
- ExampleCSHConnectionManagerClass *klass)
-{
- TpBaseConnectionManagerClass *base_class =
- (TpBaseConnectionManagerClass *) klass;
-
- base_class->new_connection = new_connection;
- base_class->cm_dbus_name = "example_csh";
- base_class->protocol_params = example_protocols;
-}
diff --git a/examples/cm/channelspecific/manager.h b/examples/cm/channelspecific/manager.h
deleted file mode 100644
index eaf2a2c..0000000
--- a/examples/cm/channelspecific/manager.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * manager.h - header for an example connection manager
- *
- * Copyright (C) 2007-2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2007-2008 Nokia Corporation
- *
- * Copying and distribution of this file, with or without modification,
- * are permitted in any medium without royalty provided the copyright
- * notice and this notice are preserved.
- */
-
-#ifndef __EXAMPLE_CSH_CONNECTION_MANAGER_H__
-#define __EXAMPLE_CSH_CONNECTION_MANAGER_H__
-
-#include <glib-object.h>
-#include <telepathy-glib/base-connection-manager.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ExampleCSHConnectionManager ExampleCSHConnectionManager;
-typedef struct _ExampleCSHConnectionManagerClass
- ExampleCSHConnectionManagerClass;
-
-struct _ExampleCSHConnectionManagerClass {
- TpBaseConnectionManagerClass parent_class;
-};
-
-struct _ExampleCSHConnectionManager {
- TpBaseConnectionManager parent;
-
- gpointer priv;
-};
-
-GType example_csh_connection_manager_get_type (void);
-
-/* TYPE MACROS */
-#define EXAMPLE_TYPE_CSH_CONNECTION_MANAGER \
- (example_csh_connection_manager_get_type ())
-#define EXAMPLE_CSH_CONNECTION_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
- ExampleCSHConnectionManager))
-#define EXAMPLE_CSH_CONNECTION_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
- ExampleCSHConnectionManagerClass))
-#define EXAMPLE_IS_CSH_CONNECTION_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER))
-#define EXAMPLE_IS_CSH_CONNECTION_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER))
-#define EXAMPLE_CSH_CONNECTION_MANAGER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CSH_CONNECTION_MANAGER, \
- ExampleCSHConnectionManagerClass))
-
-G_END_DECLS
-
-#endif
--
1.5.6.5
More information about the Telepathy-commits
mailing list