[Telepathy-commits] [telepathy-glib/master] no-protocols example CM: rename manager.[ch] with connection- prefix

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


Also rename the class to ExampleNoProtocolsConnectionManager.
---
 examples/cm/no-protocols/Makefile.am          |    6 +-
 examples/cm/no-protocols/connection-manager.c |   60 ++++++++++++++++++++++++
 examples/cm/no-protocols/connection-manager.h |   61 +++++++++++++++++++++++++
 examples/cm/no-protocols/main.c               |    5 +-
 examples/cm/no-protocols/manager.c            |   58 -----------------------
 examples/cm/no-protocols/manager.h            |   54 ----------------------
 6 files changed, 127 insertions(+), 117 deletions(-)
 create mode 100644 examples/cm/no-protocols/connection-manager.c
 create mode 100644 examples/cm/no-protocols/connection-manager.h
 delete mode 100644 examples/cm/no-protocols/manager.c
 delete mode 100644 examples/cm/no-protocols/manager.h

diff --git a/examples/cm/no-protocols/Makefile.am b/examples/cm/no-protocols/Makefile.am
index 839098d..d05305b 100644
--- a/examples/cm/no-protocols/Makefile.am
+++ b/examples/cm/no-protocols/Makefile.am
@@ -1,9 +1,9 @@
 noinst_PROGRAMS = telepathy-example-no-protocols
 
 telepathy_example_no_protocols_SOURCES = \
-    main.c \
-    manager.c \
-    manager.h
+    connection-manager.c \
+    connection-manager.h \
+    main.c
 
 # 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/no-protocols/connection-manager.c b/examples/cm/no-protocols/connection-manager.c
new file mode 100644
index 0000000..0c1dda3
--- /dev/null
+++ b/examples/cm/no-protocols/connection-manager.c
@@ -0,0 +1,60 @@
+/*
+ * A trivial connection manager which supports no protocols
+ *
+ * Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2007 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 <dbus/dbus-glib.h>
+
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/errors.h>
+
+G_DEFINE_TYPE (ExampleNoProtocolsConnectionManager,
+    example_no_protocols_connection_manager,
+    TP_TYPE_BASE_CONNECTION_MANAGER)
+
+/* type definition stuff */
+
+static void
+example_no_protocols_connection_manager_init (
+    ExampleNoProtocolsConnectionManager *self)
+{
+}
+
+/* private data */
+
+/* We don't actually support any protocols */
+const TpCMProtocolSpec stub_protocols[] = {
+  { NULL, NULL }
+};
+
+static TpBaseConnection *
+new_connection (TpBaseConnectionManager *self,
+                const gchar *proto,
+                TpIntSet *params_present,
+                void *parsed_params,
+                GError **error)
+{
+  g_assert_not_reached ();
+
+  return NULL;
+}
+
+static void
+example_no_protocols_connection_manager_class_init (
+    ExampleNoProtocolsConnectionManagerClass *klass)
+{
+  TpBaseConnectionManagerClass *base_class =
+      (TpBaseConnectionManagerClass *) klass;
+
+  base_class->new_connection = new_connection;
+  base_class->cm_dbus_name = "example_no_protocols";
+  base_class->protocol_params = stub_protocols;
+}
diff --git a/examples/cm/no-protocols/connection-manager.h b/examples/cm/no-protocols/connection-manager.h
new file mode 100644
index 0000000..57a6a9f
--- /dev/null
+++ b/examples/cm/no-protocols/connection-manager.h
@@ -0,0 +1,61 @@
+/*
+ * manager.h - header for an example connection manager
+ *
+ * Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2007 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_NO_PROTOCOLS_CONNECTION_MANAGER_H__
+#define __EXAMPLE_NO_PROTOCOLS_CONNECTION_MANAGER_H__
+
+#include <glib-object.h>
+#include <telepathy-glib/base-connection-manager.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ExampleNoProtocolsConnectionManager
+    ExampleNoProtocolsConnectionManager;
+typedef struct _ExampleNoProtocolsConnectionManagerClass
+    ExampleNoProtocolsConnectionManagerClass;
+
+struct _ExampleNoProtocolsConnectionManagerClass {
+    TpBaseConnectionManagerClass parent_class;
+};
+
+struct _ExampleNoProtocolsConnectionManager {
+    TpBaseConnectionManager parent;
+
+    gpointer priv;
+};
+
+GType example_no_protocols_connection_manager_get_type (void);
+
+/* TYPE MACROS */
+#define EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER \
+  (example_no_protocols_connection_manager_get_type ())
+#define EXAMPLE_NO_PROTOCOLS_CONNECTION_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+                              EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER, \
+                              ExampleNoProtocolsConnectionManager))
+#define EXAMPLE_NO_PROTOCOLS_CONNECTION_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), \
+                           EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER, \
+                           ExampleNoProtocolsConnectionManagerClass))
+#define EXAMPLE_IS_NO_PROTOCOLS_CONNECTION_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+                              EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER))
+#define EXAMPLE_IS_NO_PROTOCOLS_CONNECTION_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), \
+                           EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER))
+#define EXAMPLE_NO_PROTOCOLS_CONNECTION_MANAGER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                              EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER, \
+                              ExampleNoProtocolsConnectionManagerClass))
+
+G_END_DECLS
+
+#endif
diff --git a/examples/cm/no-protocols/main.c b/examples/cm/no-protocols/main.c
index 4d19010..3cf974c 100644
--- a/examples/cm/no-protocols/main.c
+++ b/examples/cm/no-protocols/main.c
@@ -13,13 +13,14 @@
 
 #include <telepathy-glib/debug.h>
 #include <telepathy-glib/run.h>
-#include "manager.h"
+
+#include "connection-manager.h"
 
 static TpBaseConnectionManager *
 construct_cm (void)
 {
   return (TpBaseConnectionManager *) g_object_new (
-      EXAMPLE_TYPE_CONNECTION_MANAGER,
+      EXAMPLE_TYPE_NO_PROTOCOLS_CONNECTION_MANAGER,
       NULL);
 }
 
diff --git a/examples/cm/no-protocols/manager.c b/examples/cm/no-protocols/manager.c
deleted file mode 100644
index 534954d..0000000
--- a/examples/cm/no-protocols/manager.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * manager.c - trivial connection manager which supports no protocols
- *
- * Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2007 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 <dbus/dbus-glib.h>
-
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/errors.h>
-
-G_DEFINE_TYPE (ExampleConnectionManager,
-    example_connection_manager,
-    TP_TYPE_BASE_CONNECTION_MANAGER)
-
-/* type definition stuff */
-
-static void
-example_connection_manager_init (ExampleConnectionManager *self)
-{
-}
-
-/* private data */
-
-/* We don't actually support any protocols */
-const TpCMProtocolSpec stub_protocols[] = {
-  { NULL, NULL }
-};
-
-static TpBaseConnection *
-new_connection (TpBaseConnectionManager *self,
-                const gchar *proto,
-                TpIntSet *params_present,
-                void *parsed_params,
-                GError **error)
-{
-  g_assert_not_reached ();
-
-  return NULL;
-}
-
-static void
-example_connection_manager_class_init (ExampleConnectionManagerClass *klass)
-{
-  TpBaseConnectionManagerClass *base_class =
-      (TpBaseConnectionManagerClass *) klass;
-
-  base_class->new_connection = new_connection;
-  base_class->cm_dbus_name = "example_no_protocols";
-  base_class->protocol_params = stub_protocols;
-}
diff --git a/examples/cm/no-protocols/manager.h b/examples/cm/no-protocols/manager.h
deleted file mode 100644
index 1322f40..0000000
--- a/examples/cm/no-protocols/manager.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * manager.h - header for an example connection manager
- *
- * Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2007 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_CONNECTION_MANAGER_H__
-#define __EXAMPLE_CONNECTION_MANAGER_H__
-
-#include <glib-object.h>
-#include <telepathy-glib/base-connection-manager.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ExampleConnectionManager ExampleConnectionManager;
-typedef struct _ExampleConnectionManagerClass ExampleConnectionManagerClass;
-
-struct _ExampleConnectionManagerClass {
-    TpBaseConnectionManagerClass parent_class;
-};
-
-struct _ExampleConnectionManager {
-    TpBaseConnectionManager parent;
-
-    gpointer priv;
-};
-
-GType example_connection_manager_get_type (void);
-
-/* TYPE MACROS */
-#define EXAMPLE_TYPE_CONNECTION_MANAGER \
-  (example_connection_manager_get_type ())
-#define EXAMPLE_CONNECTION_MANAGER(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj), EXAMPLE_TYPE_CONNECTION_MANAGER, \
-                              ExampleConnectionManager))
-#define EXAMPLE_CONNECTION_MANAGER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass), EXAMPLE_TYPE_CONNECTION_MANAGER, \
-                           ExampleConnectionManagerClass))
-#define EXAMPLE_IS_CONNECTION_MANAGER(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj), EXAMPLE_TYPE_CONNECTION_MANAGER))
-#define EXAMPLE_IS_CONNECTION_MANAGER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass), EXAMPLE_TYPE_CONNECTION_MANAGER))
-#define EXAMPLE_CONNECTION_MANAGER_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_TYPE_CONNECTION_MANAGER, \
-                              ExampleConnectionManagerClass))
-
-G_END_DECLS
-
-#endif /* #ifndef __EXAMPLE_CONNECTION_MANAGER_H__*/
-- 
1.5.6.5




More information about the Telepathy-commits mailing list