[Telepathy-commits] [telepathy-gabble/master] Add GObject boilerplate for a GabbleChannelManager interface

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 20 06:06:14 PDT 2008


20080725100536-53eee-81026e4cfe4b6d0b8704a342c140b8fdf395e590.gz
---
 src/Makefile.am       |    2 +
 src/channel-manager.c |   62 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/channel-manager.h |   55 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 119 insertions(+), 0 deletions(-)
 create mode 100644 src/channel-manager.c
 create mode 100644 src/channel-manager.h

diff --git a/src/Makefile.am b/src/Makefile.am
index ee7cf40..5585f7c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,8 @@ libgabble_convenience_la_our_sources = \
     capabilities.c \
     caps-hash.h \
     caps-hash.c \
+    channel-manager.h \
+    channel-manager.c \
     conn-aliasing.h \
     conn-aliasing.c \
     conn-avatars.h \
diff --git a/src/channel-manager.c b/src/channel-manager.c
new file mode 100644
index 0000000..fdf73cf
--- /dev/null
+++ b/src/channel-manager.c
@@ -0,0 +1,62 @@
+/*
+ * channel-manager.c - factory and manager for channels relating to a
+ *  particular protocol feature
+ *
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "channel-manager.h"
+
+
+static void
+channel_manager_base_init (gpointer klass)
+{
+  static gboolean initialized = FALSE;
+
+  if (!initialized)
+    {
+      initialized = TRUE;
+    }
+}
+
+GType
+gabble_channel_manager_get_type (void)
+{
+  static GType type = 0;
+
+  if (G_UNLIKELY (type == 0))
+    {
+      static const GTypeInfo info = {
+        sizeof (GabbleChannelManagerIface),
+        channel_manager_base_init,   /* base_init */
+        NULL,   /* base_finalize */
+        NULL,   /* class_init */
+        NULL,   /* class_finalize */
+        NULL,   /* class_data */
+        0,
+        0,      /* n_preallocs */
+        NULL    /* instance_init */
+      };
+
+      type = g_type_register_static (G_TYPE_INTERFACE,
+          "GabbleChannelManager", &info, 0);
+    }
+
+  return type;
+}
diff --git a/src/channel-manager.h b/src/channel-manager.h
new file mode 100644
index 0000000..da35899
--- /dev/null
+++ b/src/channel-manager.h
@@ -0,0 +1,55 @@
+/*
+ * channel-manager.h - factory and manager for channels relating to a
+ *  particular protocol feature
+ *
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef GABBLE_CHANNEL_MANAGER_H
+#define GABBLE_CHANNEL_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GABBLE_TYPE_CHANNEL_MANAGER (gabble_channel_manager_get_type ())
+
+#define GABBLE_CHANNEL_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  GABBLE_TYPE_CHANNEL_MANAGER, GabbleChannelManager))
+
+#define GABBLE_IS_CHANNEL_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  GABBLE_TYPE_CHANNEL_MANAGER))
+
+#define GABBLE_CHANNEL_MANAGER_GET_INTERFACE(obj) \
+  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
+  GABBLE_TYPE_CHANNEL_MANAGER, GabbleChannelManagerIface))
+
+typedef struct _GabbleChannelManager GabbleChannelManager;
+typedef struct _GabbleChannelManagerIface GabbleChannelManagerIface;
+
+struct _GabbleChannelManagerIface {
+    GTypeInterface parent;
+};
+
+GType gabble_channel_manager_get_type (void);
+
+G_END_DECLS
+
+#endif
-- 
1.5.6.3




More information about the Telepathy-commits mailing list