From adfc29968a92bd90e1fe7c8103a92972c46555ff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 3 Oct 2022 22:08:49 -0400 Subject: [PATCH] Revert "gtk: Use gnome.mkenums_simple" This reverts commit 11829fe7d01b7ceff26d1b31cc03908585107e34. The mkenums_simple function can't properly handle headers in subdirectories currently, so go back to the template version. --- gtk/gtktypebuiltins.c.template | 42 ++++++++++++++++++++++++++++++++++ gtk/gtktypebuiltins.h.template | 29 +++++++++++++++++++++++ gtk/meson.build | 7 +++--- 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 gtk/gtktypebuiltins.c.template create mode 100644 gtk/gtktypebuiltins.h.template diff --git a/gtk/gtktypebuiltins.c.template b/gtk/gtktypebuiltins.c.template new file mode 100644 index 0000000000..844e546b3d --- /dev/null +++ b/gtk/gtktypebuiltins.c.template @@ -0,0 +1,42 @@ +/*** BEGIN file-header ***/ +#include "config.h" +#include "gtk.h" +#include "gtkprivate.h" + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@basename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ + +/*** END file-tail ***/ diff --git a/gtk/gtktypebuiltins.h.template b/gtk/gtktypebuiltins.h.template new file mode 100644 index 0000000000..3dc9f834bf --- /dev/null +++ b/gtk/gtktypebuiltins.h.template @@ -0,0 +1,29 @@ +/*** BEGIN file-header ***/ +#ifndef __GTK_TYPE_BUILTINS_H__ +#define __GTK_TYPE_BUILTINS_H__ + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@basename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GDK_AVAILABLE_IN_ALL GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __GTK_TYPE_BUILTINS_H__ */ +/*** END file-tail ***/ diff --git a/gtk/meson.build b/gtk/meson.build index bfb03d7575..9982cc1678 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -1031,11 +1031,10 @@ gtkmarshalers = gnome.genmarshal('gtkmarshalers', gtkmarshal_h = gtkmarshalers[1] -gtktypebuiltins = gnome.mkenums_simple('gtktypebuiltins', +gtktypebuiltins = gnome.mkenums('gtktypebuiltins', sources: gtk_public_headers + gtk_deprecated_headers, - decorator: 'GDK_AVAILABLE_IN_ALL', - body_prefix: '#include "config.h"', - header_prefix: '#include ', + c_template: 'gtktypebuiltins.c.template', + h_template: 'gtktypebuiltins.h.template', install_dir: gtk_includedir / 'gtk-4.0/gtk', install_header: true, )