Added lm-marshal.list and lm-marshal-main.c
authorMikael Hallendal <micke@imendio.com>
Sun, 22 Jun 2008 23:11:53 +0200
changeset 424 0603668c7ddc
parent 423 9987db86f2ef
child 425 6045fa14c44f
Added lm-marshal.list and lm-marshal-main.c Also added lm-dummy.[ch] for a copy/paste GObject.
loudmouth/.gitignore
loudmouth/Makefile.am
loudmouth/lm-dummy.c
loudmouth/lm-dummy.h
loudmouth/lm-marshal-main.c
loudmouth/lm-marshal.list
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/.gitignore	Sun Jun 22 23:11:53 2008 +0200
@@ -0,0 +1,1 @@
+lm-marshal.[ch]
--- a/loudmouth/Makefile.am	Sun Jun 22 22:53:07 2008 +0200
+++ b/loudmouth/Makefile.am	Sun Jun 22 23:11:53 2008 +0200
@@ -29,7 +29,10 @@
 	lm-connection.c	 		\
 	lm-debug.c                      \
 	lm-debug.h                      \
+	lm-dummy.c                      \
+	lm-dummy.h                      \
 	lm-error.c			\
+	lm-marshal-main.c               \
 	lm-message.c	 		\
 	lm-message-handler.c		\
 	lm-message-node.c		\
@@ -85,11 +88,32 @@
 	-export-symbols $(srcdir)/loudmouth.sym
 libloudmouthincludedir = $(includedir)/loudmouth-1.0/loudmouth
 
-# an explicit dependency here so alm generated files get built
-$(OBJECTS): $(built_sources)
+lm-marshal.h: lm-marshal.list
+	(cd $(srcdir) && \
+	$(GLIB_GENMARSHAL) --prefix=lm_marshal lm-marshal.list --header) > xgen-gmh \
+	&& (cmp -s xgen-gmh lm-marshal.h || cp xgen-gmh lm-marshal.h) \
+	&& rm -f xgen-gmh xgen-gmh~
+
+lm-marshal.c: lm-marshal.list
+	(cd $(srcdir) && \
+	$(GLIB_GENMARSHAL) --prefix=lm_marshal lm-marshal.list --body) > xgen-gmc \
+	&& cp xgen-gmc lm-marshal.c \
+	&& rm -f xgen-gmc xgen-gmc~
+
+lm-marshal-main.c: lm-marshal.c lm-marshal.h
+
+BUILT_SOURCES =				\
+	lm-marshal.h			\
+	lm-marshal.c
+
+# an explicit dependency here so all generated files get built
+$(OBJECTS): $(BUILT_SOURCES)
+
+CLEANFILES = $(BUILT_SOURCES)
 
 EXTRA_DIST += \
 	lm-ssl-gnutls.c \
 	lm-ssl-openssl.c \
-	loudmouth.sym
+	loudmouth.sym \
+	lm-marshal.list
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-dummy.c	Sun Jun 22 23:11:53 2008 +0200
@@ -0,0 +1,145 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "lm-marshal.h"
+#include "lm-dummy.h"
+
+#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_DUMMY, LmDummyPriv))
+
+typedef struct LmDummyPriv LmDummyPriv;
+struct LmDummyPriv {
+	gint my_prop;
+};
+
+static void     dummy_finalize            (GObject           *object);
+static void     dummy_get_property        (GObject           *object,
+					   guint              param_id,
+					   GValue            *value,
+					   GParamSpec        *pspec);
+static void     dummy_set_property        (GObject           *object,
+					   guint              param_id,
+					   const GValue      *value,
+					   GParamSpec        *pspec);
+
+G_DEFINE_TYPE (LmDummy, lm_dummy, G_TYPE_OBJECT)
+
+enum {
+	PROP_0,
+	PROP_MY_PROP
+};
+
+enum {
+	SIGNAL_NAME,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void
+lm_dummy_class_init (LmDummyClass *class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+	object_class->finalize     = dummy_finalize;
+	object_class->get_property = dummy_get_property;
+	object_class->set_property = dummy_set_property;
+
+	g_object_class_install_property (object_class,
+					 PROP_MY_PROP,
+					 g_param_spec_string ("my-prop",
+							      "My Prop",
+							      "My Property",
+							      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 (LmDummyPriv));
+}
+
+static void
+lm_dummy_init (LmDummy *dummy)
+{
+	LmDummyPriv *priv;
+
+	priv = GET_PRIV (dummy);
+
+}
+
+static void
+dummy_finalize (GObject *object)
+{
+	LmDummyPriv *priv;
+
+	priv = GET_PRIV (object);
+
+	(G_OBJECT_CLASS (lm_dummy_parent_class)->finalize) (object);
+}
+
+static void
+dummy_get_property (GObject    *object,
+		   guint       param_id,
+		   GValue     *value,
+		   GParamSpec *pspec)
+{
+	LmDummyPriv *priv;
+
+	priv = GET_PRIV (object);
+
+	switch (param_id) {
+	case PROP_MY_PROP:
+		g_value_set_int (value, priv->my_prop);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	};
+}
+
+static void
+dummy_set_property (GObject      *object,
+		   guint         param_id,
+		   const GValue *value,
+		   GParamSpec   *pspec)
+{
+	LmDummyPriv *priv;
+
+	priv = GET_PRIV (object);
+
+	switch (param_id) {
+	case PROP_MY_PROP:
+		priv->my_prop = g_value_get_int (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	};
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-dummy.h	Sun Jun 22 23:11:53 2008 +0200
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LM_DUMMY_H__
+#define __LM_DUMMY_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define LM_TYPE_DUMMY            (lm_dummy_get_type ())
+#define LM_DUMMY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), LM_TYPE_DUMMY, LmDummy))
+#define LM_DUMMY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), LM_TYPE_DUMMY, LmDummyClass))
+#define LM_IS_DUMMY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LM_TYPE_DUMMY))
+#define LM_IS_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LM_TYPE_DUMMY))
+#define LM_DUMMY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), LM_TYPE_DUMMY, LmDummyClass))
+
+typedef struct LmDummy      LmDummy;
+typedef struct LmDummyClass LmDummyClass;
+
+struct LmDummy {
+	GObject parent;
+};
+
+struct LmDummyClass {
+	GObjectClass parent_class;
+	
+	/* <vtable> */
+	void  (*initialize)    (LmDummy     *dummy,
+				const char *username,
+				const char *server,
+				const char *password);
+	void  (*begin)         (LmDummy     *dummy);
+	void  (*cancel)        (LmDummy     *dummy);
+};
+
+GType   lm_dummy_get_type  (void);
+
+G_END_DECLS
+
+#endif /* __LM_DUMMY_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-marshal-main.c	Sun Jun 22 23:11:53 2008 +0200
@@ -0,0 +1,2 @@
+#include "lm-marshal.h"
+#include "lm-marshal.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loudmouth/lm-marshal.list	Sun Jun 22 23:11:53 2008 +0200
@@ -0,0 +1,8 @@
+VOID:INT
+VOID:POINTER
+VOID:VOID
+VOID:STRING
+VOID:BOOLEAN
+BOOLEAN:VOID
+VOID:OBJECT
+VOID:BOOLEAN,OBJECT