From 43925167135c08a6d7962e1007d15ed6ce5c4a64 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 3 Apr 2010 12:48:19 -0400 Subject: [PATCH] Create GTypes for Shell namespace https://bugzilla.gnome.org/show_bug.cgi?id=614755 --- src/Makefile.am | 114 +++++++++++++++++++++++--------------- src/shell-enum-types.c.in | 30 ++++++++++ src/shell-enum-types.h.in | 25 +++++++++ 3 files changed, 125 insertions(+), 44 deletions(-) create mode 100644 src/shell-enum-types.c.in create mode 100644 src/shell-enum-types.h.in diff --git a/src/Makefile.am b/src/Makefile.am index a02768c5d..99a1d8919 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,7 +42,9 @@ plugin_LTLIBRARIES = libgnome-shell.la shell_built_sources = \ shell-marshal.h \ - shell-marshal.c + shell-marshal.c \ + shell-enum-types.h \ + shell-enum-types.c BUILT_SOURCES += $(shell_built_sources) EXTRA_DIST += shell-marshal.list @@ -50,53 +52,57 @@ EXTRA_DIST += shell-marshal.list SHELL_STAMP_FILES = stamp-shell-marshal.h CLEANFILES += $(SHELL_STAMP_FILES) -libgnome_shell_la_SOURCES = \ - $(shell_built_sources) \ - gnome-shell-plugin.c \ - shell-app.c \ - shell-app.h \ - shell-app-private.h \ - shell-app-system.c \ - shell-app-system.h \ - shell-app-usage.c \ - shell-app-usage.h \ - shell-arrow.c \ +shell_public_headers_h = \ + shell-app.h \ + shell-app-system.h \ + shell-app-usage.h \ shell-arrow.h \ - shell-doc-system.c \ - shell-doc-system.h \ - shell-drawing.c \ - shell-drawing.h \ - shell-embedded-window.c \ - shell-embedded-window.h \ - shell-embedded-window-private.h \ - shell-gconf.c \ - shell-gconf.h \ - shell-generic-container.c \ - shell-generic-container.h \ - shell-gtk-embed.c \ - shell-gtk-embed.h \ - shell-menu.c \ - shell-menu.h \ - shell-overflow-list.c \ + shell-doc-system.h \ + shell-drawing.h \ + shell-embedded-window.h \ + shell-gconf.h \ + shell-generic-container.h \ + shell-gtk-embed.h \ + shell-menu.h \ shell-overflow-list.h \ - shell-process.c \ - shell-process.h \ - shell-global.c \ - shell-global.h \ - shell-global-private.h \ - shell-slicer.c \ - shell-slicer.h \ - shell-stack.c \ - shell-stack.h \ - shell-tray-manager.c \ - shell-tray-manager.h \ - shell-uri-util.c \ - shell-uri-util.h \ - shell-window-tracker.c \ - shell-window-tracker.h \ - shell-wm.c \ + shell-process.h \ + shell-global.h \ + shell-slicer.h \ + shell-stack.h \ + shell-tray-manager.h \ + shell-uri-util.h \ + shell-window-tracker.h \ shell-wm.h +libgnome_shell_la_SOURCES = \ + $(shell_built_sources) \ + $(shell_public_headers_h) \ + gnome-shell-plugin.c \ + shell-app.c \ + shell-app-private.h \ + shell-app-system.c \ + shell-app-usage.c \ + shell-arrow.c \ + shell-doc-system.c \ + shell-drawing.c \ + shell-embedded-window.c \ + shell-embedded-window-private.h \ + shell-gconf.c \ + shell-generic-container.c \ + shell-gtk-embed.c \ + shell-menu.c \ + shell-overflow-list.c \ + shell-process.c \ + shell-global.c \ + shell-global-private.h \ + shell-slicer.c \ + shell-stack.c \ + shell-tray-manager.c \ + shell-uri-util.c \ + shell-window-tracker.c \ + shell-wm.c + + non_gir_sources = \ shell-embedded-window-private.h \ shell-global-private.h @@ -149,6 +155,26 @@ shell-marshal.c: Makefile shell-marshal.list cp -f xgen-smc shell-marshal.c && \ rm -f xgen-smc + +shell-enum-types.h: stamp-shell-enum-types.h Makefile + @true +stamp-shell-enum-types.h: $(srcdir)/shell-enum-types.h.in $(shell_public_headers_h) + $(AM_V_GEN) ( cd $(srcdir) && \ + $(GLIB_MKENUMS) \ + --template $< \ + $(shell_public_headers_h) ) > $@.tmp && \ + (cmp -s $@.tmp shell-enum-types.h || mv $@.tmp shell-enum-types.h) && \ + rm -f $@.tmp && \ + echo timestamp > $(@F) + +shell-enum-types.c: shell-enum-types.c.in stamp-shell-enum-types.h + $(AM_V_GEN) ( cd $(srcdir) && \ + $(GLIB_MKENUMS) \ + --template $< \ + $(shell_public_headers_h) ) > $@.tmp && \ + mv $@.tmp $@ && \ + rm -f $@.tmp + libgnome_shell_la_LDFLAGS = -avoid-version -module libgnome_shell_la_LIBADD =-lm \ $(MUTTER_PLUGIN_LIBS) \ diff --git a/src/shell-enum-types.c.in b/src/shell-enum-types.c.in new file mode 100644 index 000000000..b350d0016 --- /dev/null +++ b/src/shell-enum-types.c.in @@ -0,0 +1,30 @@ +/*** BEGIN file-header ***/ +#include "shell-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +#include "@filename@" +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type(void) { + static GType enum_type_id = 0; + if (G_UNLIKELY (!enum_type_id)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + enum_type_id = g_@type@_register_static("@EnumName@", values); + } + return enum_type_id; +} +/*** END value-tail ***/ diff --git a/src/shell-enum-types.h.in b/src/shell-enum-types.h.in new file mode 100644 index 000000000..a6aea7d17 --- /dev/null +++ b/src/shell-enum-types.h.in @@ -0,0 +1,25 @@ +/*** BEGIN file-header ***/ +#ifndef __SHELL_ENUM_TYPES_H__ +#define __SHELL_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* !__SHELL_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/