LmSimpleIO now implements the LmXmppWriter interface.
authorMikael Hallendal <micke@imendio.com>
Sun, 22 Jun 2008 23:42:12 +0200
changeset 426 ab47db6da589
parent 425 6045fa14c44f
child 427 812fadb163f3
LmSimpleIO now implements the LmXmppWriter interface. Also fixed copyright years and removed signal definition from LmSimpleIO as it will never define any own signals.
loudmouth/lm-dummy.c
loudmouth/lm-dummy.h
loudmouth/lm-simple-io.c
loudmouth/lm-simple-io.h
loudmouth/lm-xmpp-writer.c
loudmouth/lm-xmpp-writer.h
--- a/loudmouth/lm-dummy.c	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-dummy.c	Sun Jun 22 23:42:12 2008 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2008 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
--- a/loudmouth/lm-dummy.h	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-dummy.h	Sun Jun 22 23:42:12 2008 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2008 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
--- a/loudmouth/lm-simple-io.c	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-simple-io.c	Sun Jun 22 23:42:12 2008 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2008 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
@@ -21,6 +21,7 @@
 #include <config.h>
 
 #include "lm-marshal.h"
+#include "lm-xmpp-writer.h"
 #include "lm-simple-io.h"
 
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmSimpleIOPriv))
@@ -31,29 +32,30 @@
 };
 
 static void     simple_io_finalize            (GObject           *object);
+static void     simple_io_writer_iface_init   (LmXmppWriterIface *iface);
 static void     simple_io_get_property        (GObject           *object,
-					   guint              param_id,
-					   GValue            *value,
-					   GParamSpec        *pspec);
+                                               guint              param_id,
+                                               GValue            *value,
+                                               GParamSpec        *pspec);
 static void     simple_io_set_property        (GObject           *object,
-					   guint              param_id,
-					   const GValue      *value,
-					   GParamSpec        *pspec);
+                                               guint              param_id,
+                                               const GValue      *value,
+                                               GParamSpec        *pspec);
+static void     simple_io_send_message        (LmXmppWriter      *writer,
+                                               LmMessage         *message);
+static void     simple_io_send_text           (LmXmppWriter      *writer,
+                                               const gchar       *buf,
+                                               gsize              len);
 
-G_DEFINE_TYPE (LmSimpleIO, lm_simple_io, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (LmSimpleIO, lm_simple_io, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (LM_TYPE_XMPP_WRITER,
+                                                simple_io_writer_iface_init))
 
 enum {
 	PROP_0,
 	PROP_MY_PROP
 };
 
-enum {
-	SIGNAL_NAME,
-	LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
 static void
 lm_simple_io_class_init (LmSimpleIOClass *class)
 {
@@ -71,16 +73,6 @@
 							      NULL,
 							      G_PARAM_READWRITE));
 	
-	signals[SIGNAL_NAME] = 
-		g_signal_new ("signal-name",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_LAST,
-			      0,
-			      NULL, NULL,
-			      lm_marshal_VOID__INT,
-			      G_TYPE_NONE, 
-			      1, G_TYPE_INT);
-	
 	g_type_class_add_private (object_class, sizeof (LmSimpleIOPriv));
 }
 
@@ -90,7 +82,6 @@
 	LmSimpleIOPriv *priv;
 
 	priv = GET_PRIV (simple_io);
-
 }
 
 static void
@@ -104,10 +95,17 @@
 }
 
 static void
+simple_io_writer_iface_init (LmXmppWriterIface *iface)
+{
+        iface->send_message = simple_io_send_message;
+        iface->send_text    = simple_io_send_text;
+}
+
+static void
 simple_io_get_property (GObject    *object,
-		   guint       param_id,
-		   GValue     *value,
-		   GParamSpec *pspec)
+                        guint       param_id,
+                        GValue     *value,
+                        GParamSpec *pspec)
 {
 	LmSimpleIOPriv *priv;
 
@@ -125,9 +123,9 @@
 
 static void
 simple_io_set_property (GObject      *object,
-		   guint         param_id,
-		   const GValue *value,
-		   GParamSpec   *pspec)
+                        guint         param_id,
+                        const GValue *value,
+                        GParamSpec   *pspec)
 {
 	LmSimpleIOPriv *priv;
 
@@ -143,3 +141,16 @@
 	};
 }
 
+static void
+simple_io_send_message (LmXmppWriter *writer, LmMessage *message)
+{
+}
+
+static void
+simple_io_send_text (LmXmppWriter *writer,
+                     const gchar  *buf,
+                     gsize         len)
+{
+}
+
+
--- a/loudmouth/lm-simple-io.h	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-simple-io.h	Sun Jun 22 23:42:12 2008 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2008 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
--- a/loudmouth/lm-xmpp-writer.c	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-xmpp-writer.c	Sun Jun 22 23:42:12 2008 +0200
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2008 Imendio AB
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License as
@@ -59,14 +59,13 @@
 }
 
 void
-lm_xmpp_writer_send (LmXmppWriter *writer,
-                     LmMessage    *message)
+lm_xmpp_writer_send_message (LmXmppWriter *writer, LmMessage *message)
 {
-        if (!LM_XMPP_WRITER_GET_IFACE(writer)->send) {
+        if (!LM_XMPP_WRITER_GET_IFACE(writer)->send_message) {
                 g_assert_not_reached ();
 	}
 
-	LM_XMPP_WRITER_GET_IFACE(writer)->send (writer, message);
+        LM_XMPP_WRITER_GET_IFACE(writer)->send_message (writer, message);
 }
 
 void
--- a/loudmouth/lm-xmpp-writer.h	Sun Jun 22 23:21:26 2008 +0200
+++ b/loudmouth/lm-xmpp-writer.h	Sun Jun 22 23:42:12 2008 +0200
@@ -38,7 +38,7 @@
 	GTypeInterface parent;
 
 	/* <vtable> */
-        void (*send)         (LmXmppWriter *writer,
+        void (*send_message) (LmXmppWriter *writer,
                               LmMessage    *message);
         void (*send_text)    (LmXmppWriter *writer,
                               const gchar  *buf,
@@ -48,14 +48,14 @@
         void (*flush)        (LmXmppWriter   *writer);
 };
 
-GType   lm_xmpp_writer_get_type  (void);
+GType   lm_xmpp_writer_get_type      (void);
 
-void    lm_xmpp_writer_send      (LmXmppWriter   *writer,
-                                  LmMessage      *message);
-void    lm_xmpp_writer_send_text (LmXmppWriter   *writer,
-                                  const gchar    *buf,
-                                  gsize           len);
-void    lm_xmpp_writer_flush     (LmXmppWriter   *writer);
+void    lm_xmpp_writer_send_message  (LmXmppWriter   *writer,
+                                      LmMessage      *message);
+void    lm_xmpp_writer_send_text     (LmXmppWriter   *writer,
+                                      const gchar    *buf,
+                                      gsize           len);
+void    lm_xmpp_writer_flush         (LmXmppWriter   *writer);
 
 G_END_DECLS