ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00803
[Merge] lp:~ted/libindicate/enum-generation into lp:libindicate
Ted Gould has proposed merging lp:~ted/libindicate/enum-generation into lp:libindicate.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Switching everything enum/marshal based to be *much* cleaner.
--
https://code.launchpad.net/~ted/libindicate/enum-generation/+merge/18564
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== added file 'Makefile.am.enum'
--- Makefile.am.enum 1970-01-01 00:00:00 +0000
+++ Makefile.am.enum 2010-02-03 21:25:21 +0000
@@ -0,0 +1,45 @@
+# Rules for generating enumeration types using glib-mkenums
+#
+# Define:
+# glib_enum_h = header template file
+# glib_enum_c = source template file
+# glib_enum_headers = list of headers to parse
+#
+# before including Makefile.am.enums. You will also need to have
+# the following targets already defined:
+#
+# CLEANFILES
+# DISTCLEANFILES
+# BUILT_SOURCES
+# EXTRA_DIST
+#
+# Author: Emmanuele Bassi <ebassi@xxxxxxxxxxxxxxx>
+
+enum_tmpl_h=$(glib_enum_h:.h=.h.in)
+enum_tmpl_c=$(glib_enum_c:.c=.c.in)
+
+CLEANFILES += stamp-enum-types
+DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c)
+BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c)
+EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c)
+
+stamp-enum-types: $(glib_enum_headers)
+ $(QUIET_GEN)mkdir -p `dirname $(builddir)/$(glib_enum_h)`
+ $(QUIET_GEN)$(GLIB_MKENUMS) \
+ --template $(srcdir)/$(enum_tmpl_h) \
+ $(glib_enum_headers) > xgen-eh \
+ && (cmp -s xgen-eh $(builddir)/$(glib_enum_h) || cp -f xgen-eh $(builddir)/$(glib_enum_h)) \
+ && rm -f xgen-eh \
+ && echo timestamp > $(@F)
+
+$(glib_enum_h): stamp-enum-types
+ @true
+
+$(glib_enum_c): $(glib_enum_h)
+ $(QUIET_GEN)mkdir -p `dirname $(builddir)/$(glib_enum_c)`
+ $(QUIET_GEN)$(GLIB_MKENUMS) \
+ --template $(srcdir)/$(enum_tmpl_c) \
+ $(glib_enum_headers) > xgen-ec \
+ && cp -f xgen-ec $(builddir)/$(glib_enum_c) \
+ && rm -f xgen-ec
+
=== added file 'Makefile.am.marshal'
--- Makefile.am.marshal 1970-01-01 00:00:00 +0000
+++ Makefile.am.marshal 2010-02-03 21:25:21 +0000
@@ -0,0 +1,45 @@
+# Rules for generating marshal files using glib-genmarshal
+#
+# Define:
+# glib_marshal_list = marshal list file
+# glib_marshal_prefix = prefix for marshal functions
+#
+# before including Makefile.am.marshal. You will also need to have
+# the following targets already defined:
+#
+# CLEANFILES
+# DISTCLEANFILES
+# BUILT_SOURCES
+# EXTRA_DIST
+#
+# Author: Emmanuele Bassi <ebassi@xxxxxxxxxxxxxxx>
+
+marshal_h = $(glib_marshal_list:.list=.h)
+marshal_c = $(glib_marshal_list:.list=.c)
+
+CLEANFILES += stamp-marshal
+DISTCLEANFILES += $(marshal_h) $(marshal_c)
+BUILT_SOURCES += $(marshal_h) $(marshal_c)
+EXTRA_DIST += $(glib_marshal_list)
+
+stamp-marshal: $(glib_marshal_list)
+ $(QUIET_GEN)$(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --header \
+ $(srcdir)/$(glib_marshal_list) > xgen-mh \
+ && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
+ && rm -f xgen-mh \
+ && echo timestamp > $(@F)
+
+$(marshal_h): stamp-marshal
+ @true
+
+$(marshal_c): $(marshal_h)
+ $(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \
+ $(GLIB_GENMARSHAL) \
+ --prefix=$(glib_marshal_prefix) \
+ --body \
+ $(srcdir)/$(glib_marshal_list)) > xgen-mc \
+ && cp xgen-mc $(marshal_c) \
+ && rm -f xgen-mc
+
=== modified file 'configure.ac'
--- configure.ac 2010-02-02 08:15:17 +0000
+++ configure.ac 2010-02-03 21:25:21 +0000
@@ -20,6 +20,9 @@
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
+AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
+
###########################
# Libindicate versioning
###########################
=== modified file 'libindicate/Makefile.am'
--- libindicate/Makefile.am 2009-10-11 16:04:14 +0000
+++ libindicate/Makefile.am 2010-02-03 21:25:21 +0000
@@ -1,28 +1,44 @@
-MARSHAL_PREFIX = indicate_marshal
-MARSHAL_FILE = indicate-marshal
-ENUM_FILE = indicate-enum-types
+#
+# Defined variables to add to later
+#
+
+CLEANFILES =
+DISTCLEANFILES =
+BUILT_SOURCES =
+EXTRA_DIST =
+
+#
+# Marshalling
+#
+
+include ../Makefile.am.marshal
+glib_marshal_prefix = _indicate_marshal
+glib_marshal_list = indicate-marshal.list
+
+#
+# Enums
+#
+
+include ../Makefile.am.enum
+
+glib_enum_h = indicate-enum-types.h
+glib_enum_c = indicate-enum-types.c
+glib_enum_headers = $(indicate_headers)
+
INCLUDES= \
-DG_LOG_DOMAIN=\"libindicate\"
-EXTRA_DIST = \
+EXTRA_DIST += \
indicate-interface.xml \
indicate-listener.xml \
- listener-marshal.list \
- server-marshal.list \
indicate.pc.in
-BUILT_SOURCES = \
+BUILT_SOURCES += \
dbus-indicate-server.h \
dbus-indicate-client.h \
dbus-listener-server.h \
- dbus-listener-client.h \
- listener-marshal.c \
- listener-marshal.h \
- server-marshal.c \
- server-marshal.h \
- $(ENUM_FILE).h \
- $(ENUM_FILE).c
+ dbus-listener-client.h
lib_LTLIBRARIES = \
libindicate.la
@@ -34,8 +50,7 @@
indicator-messages.h \
listener.h \
server.h \
- interests.h \
- $(ENUM_FILE).h
+ interests.h
libindicateinclude_HEADERS = \
$(indicate_headers)
@@ -48,14 +63,11 @@
dbus-listener-client.h \
indicate-enum-types.c \
server.c \
- server-marshal.c \
- server-marshal.h \
listener.c \
- listener-marshal.c \
- listener-marshal.h \
listener-private.h \
indicator.c \
- interests-priv.h
+ interests-priv.h \
+ indicate-marshal.c
libindicate_la_LDFLAGS = \
-version-info $(LIBINDICATE_CURRENT):$(LIBINDICATE_REVISION):$(LIBINDICATE_AGE) \
@@ -97,60 +109,11 @@
--output=dbus-listener-client.h \
$(srcdir)/indicate-listener.xml
-listener-marshal.h: $(srcdir)/listener-marshal.list
- glib-genmarshal --header \
- --prefix=_indicate_listener_marshal $(srcdir)/listener-marshal.list \
- > listener-marshal.h
-
-listener-marshal.c: $(srcdir)/listener-marshal.list
- glib-genmarshal --body \
- --prefix=_indicate_listener_marshal $(srcdir)/listener-marshal.list \
- > listener-marshal.c
-
-server-marshal.h: $(srcdir)/server-marshal.list
- glib-genmarshal --header \
- --prefix=_indicate_server_marshal $(srcdir)/server-marshal.list \
- > server-marshal.h
-
-server-marshal.c: $(srcdir)/server-marshal.list
- glib-genmarshal --body \
- --prefix=_indicate_server_marshal $(srcdir)/server-marshal.list \
- > server-marshal.c
-
pkgconfig_DATA = indicate.pc
pkgconfigdir = $(libdir)/pkgconfig
-$(ENUM_FILE).h: s-enum-types-h
- @true
-s-enum-types-h: $(indicate_headers) Makefile
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#ifndef _INDICATE_ENUM_TYPES_H_\n#define _INDICATE_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type(void);\n#define INDICATE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* _INDICATE_ENUM_TYPES_H_ */" \
- interests.h ) > tmp-$(ENUM_FILE).h \
- && (cmp -s tmp-$(ENUM_FILE).h $(ENUM_FILE).h || cp tmp-$(ENUM_FILE).h $(ENUM_FILE).h ) \
- && rm -f tmp-$(ENUM_FILE).h \
- && echo timestamp > $(@F)
-
-$(ENUM_FILE).c: s-enum-types-c
- @true
-s-enum-types-c: $(indicate_headers) Makefile
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#include \"interests.h\"\n#include <glib-object.h>" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
- interests.h ) > tmp-$(ENUM_FILE).c \
- && (cmp -s tmp-$(ENUM_FILE).c $(ENUM_FILE).c || cp tmp-$(ENUM_FILE).c $(ENUM_FILE).c ) \
- && rm -f tmp-$(ENUM_FILE).c \
- && echo timestamp > $(@F)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- s-enum-types-c \
- s-enum-types-h
+CLEANFILES += \
+ $(BUILT_SOURCES)
if HAVE_INTROSPECTION
=== added file 'libindicate/indicate-enum-types.c.in'
--- libindicate/indicate-enum-types.c.in 1970-01-01 00:00:00 +0000
+++ libindicate/indicate-enum-types.c.in 2010-02-03 21:25:21 +0000
@@ -0,0 +1,30 @@
+/*** BEGIN file-header ***/
+#include "interests.h"
+#include <glib-object.h>
+
+/*** END file-header ***/
+/*** BEGIN file-production ***/
+
+/* enumerations from \"@filename@\" */
+
+/*** END file-production ***/
+/*** BEGIN value-header ***/
+
+GType
+@enum_name@_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ etype = g_@type@_register_static ("@EnumName@", values);
+ }
+ return etype;
+}
+/*** END value-tail ***/
=== added file 'libindicate/indicate-enum-types.h.in'
--- libindicate/indicate-enum-types.h.in 1970-01-01 00:00:00 +0000
+++ libindicate/indicate-enum-types.h.in 2010-02-03 21:25:21 +0000
@@ -0,0 +1,26 @@
+/*** BEGIN file-header ***/
+#ifndef _INDICATE_ENUM_TYPES_H_
+#define _INDICATE_ENUM_TYPES_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+#endif /* _INDICATE_ENUM_TYPES_H_ */"
+/*** END file-tail ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from \"@filename@\" */
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void);
+#define INDICATE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+
+/*** END value-header ***/
=== added file 'libindicate/indicate-marshal.list'
--- libindicate/indicate-marshal.list 1970-01-01 00:00:00 +0000
+++ libindicate/indicate-marshal.list 2010-02-03 21:25:21 +0000
@@ -0,0 +1,39 @@
+# A library to allow applictions to provide simple indications of
+# information to be displayed to users of the application through the
+# interface shell.
+#
+# Copyright 2009 Canonical Ltd.
+#
+# Authors:
+# Ted Gould <ted@xxxxxxxxxxxxx>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of either or both of the following licenses:
+#
+# 1) the GNU Lesser General Public License version 3, as published by the
+# Free Software Foundation; and/or
+# 2) the GNU Lesser General Public License version 2.1, as published by
+# the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the applicable version of the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of both the GNU Lesser General Public
+# License version 3 and version 2.1 along with this program. If not, see
+# <http://www.gnu.org/licenses/>
+#
+# IndicatorAdded, IndicatorRemoved, IndicatorModified
+VOID:UINT,STRING
+# Local indicator_added, indicator_removed
+VOID:POINTER,POINTER
+# Local indicator_modified
+VOID:POINTER,POINTER,STRING
+# Local server_added and server_removed
+VOID:POINTER,STRING
+# Local server_count_changed
+VOID:POINTER,UINT
+# Not sure
+VOID:UINT
=== removed file 'libindicate/listener-marshal.list'
--- libindicate/listener-marshal.list 2009-09-05 04:24:47 +0000
+++ libindicate/listener-marshal.list 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-# A library to allow applictions to provide simple indications of
-# information to be displayed to users of the application through the
-# interface shell.
-#
-# Copyright 2009 Canonical Ltd.
-#
-# Authors:
-# Ted Gould <ted@xxxxxxxxxxxxx>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of either or both of the following licenses:
-#
-# 1) the GNU Lesser General Public License version 3, as published by the
-# Free Software Foundation; and/or
-# 2) the GNU Lesser General Public License version 2.1, as published by
-# the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the applicable version of the GNU Lesser General Public
-# License for more details.
-#
-# You should have received a copy of both the GNU Lesser General Public
-# License version 3 and version 2.1 along with this program. If not, see
-# <http://www.gnu.org/licenses/>
-#
-# IndicatorAdded, IndicatorRemoved, IndicatorModified
-VOID:UINT,STRING
-# Local indicator_added, indicator_removed
-VOID:POINTER,POINTER
-# Local indicator_modified
-VOID:POINTER,POINTER,STRING
-# Local server_added and server_removed
-VOID:POINTER,STRING
-# Local server_count_changed
-VOID:POINTER,UINT
=== modified file 'libindicate/listener.c'
--- libindicate/listener.c 2010-02-01 06:13:31 +0000
+++ libindicate/listener.c 2010-02-03 21:25:21 +0000
@@ -31,7 +31,7 @@
#include <libxml/tree.h>
#include "listener.h"
-#include "listener-marshal.h"
+#include "indicate-marshal.h"
#include <dbus/dbus-glib-bindings.h>
#include "dbus-indicate-client.h"
#include "dbus-listener-client.h"
@@ -132,45 +132,45 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, indicator_added),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_POINTER,
+ _indicate_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR);
signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_POINTER,
+ _indicate_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR);
signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
+ _indicate_marshal_VOID__POINTER_POINTER_STRING,
G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, server_added),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_STRING,
+ _indicate_marshal_VOID__POINTER_STRING,
G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
signals[SERVER_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_REMOVED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, server_removed),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_STRING,
+ _indicate_marshal_VOID__POINTER_STRING,
G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
signals[SERVER_COUNT_CHANGED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_COUNT_CHANGED,
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateListenerClass, server_count_changed),
NULL, NULL,
- _indicate_listener_marshal_VOID__POINTER_UINT,
+ _indicate_marshal_VOID__POINTER_UINT,
G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_UINT);
- dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING,
+ dbus_g_object_register_marshaller(_indicate_marshal_VOID__UINT_STRING,
G_TYPE_NONE,
G_TYPE_UINT,
G_TYPE_STRING,
=== removed file 'libindicate/server-marshal.list'
--- libindicate/server-marshal.list 2009-08-28 19:55:12 +0000
+++ libindicate/server-marshal.list 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
-# A library to allow applictions to provide simple indications of
-# information to be displayed to users of the application through the
-# interface shell.
-#
-# Copyright 2009 Canonical Ltd.
-#
-# Authors:
-# Ted Gould <ted@xxxxxxxxxxxxx>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of either or both of the following licenses:
-#
-# 1) the GNU Lesser General Public License version 3, as published by the
-# Free Software Foundation; and/or
-# 2) the GNU Lesser General Public License version 2.1, as published by
-# the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the applicable version of the GNU Lesser General Public
-# License for more details.
-#
-# You should have received a copy of both the GNU Lesser General Public
-# License version 3 and version 2.1 along with this program. If not, see
-# <http://www.gnu.org/licenses/>
-#
-# IndicatorAdded
-VOID:UINT
-VOID:UINT,STRING
=== modified file 'libindicate/server.c'
--- libindicate/server.c 2010-02-01 05:59:25 +0000
+++ libindicate/server.c 2010-02-03 21:25:21 +0000
@@ -29,7 +29,7 @@
#include "server.h"
#include "interests-priv.h"
-#include "server-marshal.h"
+#include "indicate-marshal.h"
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <libdbusmenu-glib/server.h>
@@ -202,7 +202,7 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_added),
NULL, NULL,
- _indicate_server_marshal_VOID__UINT,
+ _indicate_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
/**
IndicateServer::indicator-removed:
@@ -217,7 +217,7 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_removed),
NULL, NULL,
- _indicate_server_marshal_VOID__UINT,
+ _indicate_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
/**
IndicateServer::indicator-modified:
@@ -233,7 +233,7 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicateServerClass, indicator_modified),
NULL, NULL,
- _indicate_server_marshal_VOID__UINT_STRING,
+ _indicate_marshal_VOID__UINT_STRING,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
/**
IndicateServer::server-show:
Follow ups