Commit e6f53759 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Automatically generate enum types.

parent d1f777a5
......@@ -44,6 +44,7 @@ LT_INIT([dlopen win32-dll disable-static])
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
AC_PATH_PROG(DLLTOOL, dlltool)
# If the source code has changed at all, increment GLADE_REVISION
......
......@@ -48,7 +48,10 @@ BUILT_SOURCES = \
glade-marshallers.c \
glade-marshallers.h \
gladeui-resources.c \
gladeui-resources.h
gladeui-resources.h \
gladeui-enum-types.c \
gladeui-enum-types.h
UI_FILES = \
glade-editor.ui \
......@@ -66,7 +69,10 @@ EXTRA_DIST = \
gladeui.rc.in \
icon-naming-spec.c \
glade-previewer.rc.in \
gladeui-resources.gresource.xml
gladeui-resources.gresource.xml \
gladeui-enum-types.c.template \
gladeui-enum-types.h.template
# The glade core library
libgladeui_2_la_SOURCES = \
......@@ -208,6 +214,17 @@ glade-marshallers.c: glade-marshallers.list $(GLIB_GENMARSHAL)
&& mv glade-marshallers-c.tmp glade-marshallers.c \
|| ( rm -f glade-marshallers-c.tmp && exit 1 )
#
# Enum type generation
#
gladeui-enum-types.h: gladeui-enum-types.h.template $(libgladeuiinclude_HEADERS) $(GLIB_MKENUMS)
$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $@.template \
$(libgladeuiinclude_HEADERS)) > $@
gladeui-enum-types.c: gladeui-enum-types.c.template $(libgladeuiinclude_HEADERS) $(GLIB_MKENUMS)
$(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $@.template \
$(libgladeuiinclude_HEADERS)) > $@
CLEANFILES = $(BUILT_SOURCES)
#
......
......@@ -564,25 +564,3 @@ glade_standard_boolean_spec (void)
return g_param_spec_boolean ("boolean", "Boolean",
"A boolean value", FALSE, G_PARAM_READWRITE);
}
GType
glade_item_appearance_get_type (void)
{
static GType etype = 0;
if (etype == 0)
{
static const GEnumValue values[] = {
{GLADE_ITEM_ICON_AND_LABEL, "GLADE_ITEM_ICON_AND_LABEL",
"icon-and-label"},
{GLADE_ITEM_ICON_ONLY, "GLADE_ITEM_ICON_ONLY", "icon-only"},
{GLADE_ITEM_LABEL_ONLY, "GLADE_ITEM_LABEL_ONLY", "label-only"},
{0, NULL, NULL}
};
etype = g_enum_register_static ("GladeItemAppearance", values);
}
return etype;
}
......@@ -13,7 +13,6 @@ typedef struct _GladeParamSpecObjects GladeParamSpecObjects;
#define GLADE_TYPE_STOCK_IMAGE (glade_standard_stock_image_get_type())
#define GLADE_TYPE_GLIST (glade_glist_get_type())
#define GLADE_TYPE_PARAM_OBJECTS (glade_param_objects_get_type())
#define GLADE_TYPE_ITEM_APPEARANCE (glade_item_appearance_get_type())
#define GLADE_IS_STOCK(pspec) \
(G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GLADE_TYPE_STOCK))
......@@ -32,7 +31,6 @@ GType glade_standard_stock_get_type (void) G_GNUC_CONST;
GType glade_standard_stock_image_get_type (void) G_GNUC_CONST;
GType glade_glist_get_type (void) G_GNUC_CONST;
GType glade_param_objects_get_type (void) G_GNUC_CONST;
GType glade_item_appearance_get_type (void) G_GNUC_CONST;
GParamSpec *glade_param_spec_objects (const gchar *name,
const gchar *nick,
......
......@@ -38,6 +38,7 @@
*/
#include "glade.h"
#include "gladeui-enum-types.h"
#include "glade-app.h"
#include "glade-palette.h"
#include "glade-catalog.h"
......
......@@ -39,6 +39,7 @@
#include <glib/gstdio.h>
#include "glade.h"
#include "gladeui-enum-types.h"
#include "glade-widget.h"
#include "glade-id-allocator.h"
#include "glade-app.h"
......@@ -179,26 +180,6 @@ typedef struct
gint position;
} CatalogInfo;
GType
glade_pointer_mode_get_type (void)
{
static GType etype = 0;
if (etype == 0)
{
static const GEnumValue values[] = {
{GLADE_POINTER_SELECT, "select", "Select-widgets"},
{GLADE_POINTER_ADD_WIDGET, "add", "Add-widgets"},
{GLADE_POINTER_DRAG_RESIZE, "drag-resize", "Drag-and-resize-widgets"},
{GLADE_POINTER_MARGIN_EDIT, "margin-edit", "Edit-widget-margins"},
{GLADE_POINTER_ALIGN_EDIT, "align-edit", "Edit-widget-alignment"},
{0, NULL, NULL}
};
etype = g_enum_register_static ("GladePointerMode", values);
}
return etype;
}
static void glade_project_target_version_for_adaptor (GladeProject *project,
GladeWidgetAdaptor *adaptor,
gint *major,
......
......@@ -13,7 +13,6 @@ G_BEGIN_DECLS
#define GLADE_IS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROJECT))
#define GLADE_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROJECT))
#define GLADE_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PROJECT, GladeProjectClass))
#define GLADE_TYPE_POINTER_MODE (glade_pointer_mode_get_type())
typedef struct _GladeProjectPrivate GladeProjectPrivate;
typedef struct _GladeProjectClass GladeProjectClass;
......@@ -128,7 +127,6 @@ struct _GladeProjectClass
};
GType glade_pointer_mode_get_type (void) G_GNUC_CONST;
GType glade_project_get_type (void) G_GNUC_CONST;
GladeProject *glade_project_new (void);
......
......@@ -1485,28 +1485,6 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
g_type_class_add_private (adaptor_class, sizeof (GladeWidgetAdaptorPrivate));
}
GType
glade_create_reason_get_type (void)
{
static GType etype = 0;
if (etype == 0)
{
static const GEnumValue values[] = {
{GLADE_CREATE_USER, "GLADE_CREATE_USER", "create-user"},
{GLADE_CREATE_COPY, "GLADE_CREATE_COPY", "create-copy"},
{GLADE_CREATE_LOAD, "GLADE_CREATE_LOAD", "create-load"},
{GLADE_CREATE_REBUILD, "GLADE_CREATE_REBUILD", "create-rebuild"},
{0, NULL, NULL}
};
etype = g_enum_register_static ("GladeCreateReason", values);
}
return etype;
}
/*******************************************************************************
Synthetic Object Derivation
*******************************************************************************/
......
......@@ -170,8 +170,6 @@ typedef enum
GLADE_CREATE_REASONS
} GladeCreateReason;
#define GLADE_TYPE_CREATE_REASON (glade_create_reason_get_type())
/**
* GladeSetPropertyFunc:
* @adaptor: A #GladeWidgetAdaptor
......@@ -697,7 +695,6 @@ struct _GladeWidgetAdaptorClass
GType glade_widget_adaptor_get_type (void) G_GNUC_CONST;
GType glade_create_reason_get_type (void) G_GNUC_CONST;
GType glade_widget_adaptor_get_object_type (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor);
......
......@@ -27,6 +27,7 @@
#include <gladeui/glade-property-class.h>
#include <gladeui/glade-property.h>
#include <gladeui/glade-signal-class.h>
#include <gladeui/glade-signal-model.h>
#include <gladeui/glade-signal.h>
#include <gladeui/glade-project.h>
#include <gladeui/glade-app.h>
......
/*** BEGIN file-header ***/
#include <gladeui/glade.h>
#include <gladeui/gladeui-enum-types.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 (G_UNLIKELY(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 (g_intern_static_string ("@EnumName@"), values);
}
return etype;
}
/*** END value-tail ***/
/*** BEGIN file-tail ***/
/*** END file-tail ***/
/*** BEGIN file-header ***/
#ifndef __GLADEUI_ENUM_TYPES_H__
#define __GLADEUI_ENUM_TYPES_H__
#include <glib-object.h>
#include <gladeui/glade.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
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 /* __GLADEUI_ENUM_TYPES_H__ */
/*** END file-tail ***/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment