summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2007-05-18 16:27:17 +0000
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2007-05-18 16:27:17 +0000
commit8141928d8039c4b9688f3c1c88c3b6580382f153 (patch)
treefbf98423b23280bf5c340bd73dee73f4ac72bf6f
parent0402ce5be876696b38c7c716fb963e79b3d192a3 (diff)
downloadtelepathy-gabble-8141928d8039c4b9688f3c1c88c3b6580382f153.tar.gz
tube-iface.[ch]
20070518162717-7fe3f-056132f975f44a546bca183ba5164daa61ff9d9f.gz
-rw-r--r--src/tube-iface.c74
-rw-r--r--src/tube-iface.h62
2 files changed, 136 insertions, 0 deletions
diff --git a/src/tube-iface.c b/src/tube-iface.c
new file mode 100644
index 000000000..7f5e5bf11
--- /dev/null
+++ b/src/tube-iface.c
@@ -0,0 +1,74 @@
+/*
+ * tube-iface.c - Source for GabbleTube interface
+ * Copyright (C) 2007 Ltd.
+ *
+ * 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 "tube-iface.h"
+
+#include <glib.h>
+
+void
+gabble_tube_iface_accept (GabbleTubeIface *self)
+{
+ void (*virtual_method)(GabbleTubeIface *) =
+ GABBLE_TUBE_IFACE_GET_CLASS (self)->accept;
+ g_assert (virtual_method != NULL);
+ virtual_method (self);
+}
+
+gchar *
+gabble_tube_iface_get_stream_id (GabbleTubeIface *self)
+{
+ gchar * (*virtual_method)(GabbleTubeIface *) =
+ GABBLE_TUBE_IFACE_GET_CLASS (self)->get_stream_id;
+ g_assert (virtual_method != NULL);
+ return virtual_method (self);
+}
+
+void
+gabble_tube_iface_close (GabbleTubeIface *self)
+{
+ void (*virtual_method)(GabbleTubeIface *) =
+ GABBLE_TUBE_IFACE_GET_CLASS (self)->close;
+ g_assert (virtual_method != NULL);
+ virtual_method (self);
+}
+
+GType
+gabble_tube_iface_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (GabbleTubeIfaceClass),
+ NULL, /* 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, "GabbleTubeIface",
+ &info, 0);
+ }
+
+ return type;
+}
diff --git a/src/tube-iface.h b/src/tube-iface.h
new file mode 100644
index 000000000..cb4d4e7cf
--- /dev/null
+++ b/src/tube-iface.h
@@ -0,0 +1,62 @@
+/*
+ * tube-iface.h - Header for GabbleTube interface
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * 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_TUBE_IFACE_H__
+#define __GABBLE_TUBE_IFACE_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GabbleTubeIface GabbleTubeIface;
+typedef struct _GabbleTubeIfaceClass GabbleTubeIfaceClass;
+
+struct _GabbleTubeIfaceClass {
+ GTypeInterface parent;
+
+ gchar * (*get_stream_id) (GabbleTubeIface *tube);
+ void (*accept) (GabbleTubeIface *tube);
+ void (*close) (GabbleTubeIface *close);
+};
+
+GType gabble_tube_iface_get_type (void);
+
+/* TYPE MACROS */
+#define GABBLE_TYPE_TUBE_IFACE \
+ (gabble_tube_iface_get_type ())
+#define GABBLE_TUBE_IFACE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_TUBE_IFACE, GabbleTubeIface))
+#define GABBLE_IS_TUBE_IFACE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_TUBE_IFACE))
+#define GABBLE_TUBE_IFACE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_TUBE_IFACE,\
+ GabbleTubeIfaceClass))
+
+gchar *
+gabble_tube_iface_get_stream_id (GabbleTubeIface *tube);
+
+void
+gabble_tube_iface_accept (GabbleTubeIface *tube);
+
+void
+gabble_tube_iface_close (GabbleTubeIface *tube);
+
+G_END_DECLS
+
+#endif /* #ifndef __GABBLE_TUBE_IFACE_H__ */