Commit b77ca997 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

make _gimp_enums_init public, so language bindings can do early enum

2005-06-03  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/enumcode.pl: make _gimp_enums_init public, so
        language bindings can do early enum registration if needed.

        * libgimp/gimpenums.h
        * libgimp/gimpenums.c.tail: regenerated

        * gimp.c: call gimp_enums_init instead of _gimp_enums_init.

        * gimp.def: add newly exported function.
parent 93490ae7
2005-06-03 Manish Singh <yosh@gimp.org>
* tools/pdbgen/enumcode.pl: make _gimp_enums_init public, so
language bindings can do early enum registration if needed.
* libgimp/gimpenums.h
* libgimp/gimpenums.c.tail: regenerated
* gimp.c: call gimp_enums_init instead of _gimp_enums_init.
* gimp.def: add newly exported function.
2005-06-03 Manish Singh <yosh@gimp.org> 2005-06-03 Manish Singh <yosh@gimp.org>
* configure.in: require python 2.2.1, so True and False are always * configure.in: require python 2.2.1, so True and False are always
......
...@@ -361,7 +361,7 @@ gimp_main (const GimpPlugInInfo *info, ...@@ -361,7 +361,7 @@ gimp_main (const GimpPlugInInfo *info,
wire_set_flusher (gimp_flush); wire_set_flusher (gimp_flush);
g_type_init (); g_type_init ();
_gimp_enums_init (); gimp_enums_init ();
/* initialize units */ /* initialize units */
{ {
......
...@@ -173,6 +173,7 @@ EXPORTS ...@@ -173,6 +173,7 @@ EXPORTS
gimp_edit_stroke gimp_edit_stroke
gimp_ellipse_select gimp_ellipse_select
gimp_enums_get_type_names gimp_enums_get_type_names
gimp_enums_init
gimp_equalize gimp_equalize
gimp_eraser gimp_eraser
gimp_eraser_default gimp_eraser_default
......
...@@ -91,18 +91,37 @@ static const gchar *type_names[] = ...@@ -91,18 +91,37 @@ static const gchar *type_names[] =
"GimpTransformDirection" "GimpTransformDirection"
}; };
static gboolean enums_initialized = FALSE;
/**
* gimp_enums_init
*
* This function makes sure all the enum types are registered
* with the GObject type system. This is intended for use by
* language bindings that need the symbols early, before gimp_main
* is run. It's not necessary for plug-ins to call this directly,
* as the normal plug-in initialization code will handle it
* implicitly.
*
* Since: GIMP 2.4
**/
void void
_gimp_enums_init (void) gimp_enums_init (void)
{ {
const GimpGetTypeFunc *funcs = get_type_funcs; const GimpGetTypeFunc *funcs = get_type_funcs;
gint i; gint i;
if (enums_initialized)
return;
for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++) for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++)
{ {
GType type = (*funcs) (); GType type = (*funcs) ();
g_type_class_ref (type); g_type_class_ref (type);
} }
enums_initialized = TRUE;
} }
/** /**
......
...@@ -259,7 +259,7 @@ typedef enum ...@@ -259,7 +259,7 @@ typedef enum
} GimpRunMode; } GimpRunMode;
void _gimp_enums_init (void); void gimp_enums_init (void);
const gchar ** gimp_enums_get_type_names (gint *n_type_names); const gchar ** gimp_enums_get_type_names (gint *n_type_names);
......
...@@ -97,7 +97,7 @@ foreach (sort keys %enums) { ...@@ -97,7 +97,7 @@ foreach (sort keys %enums) {
print ENUMFILE <<HEADER; print ENUMFILE <<HEADER;
void _gimp_enums_init (void); void gimp_enums_init (void);
const gchar ** gimp_enums_get_type_names (gint *n_type_names); const gchar ** gimp_enums_get_type_names (gint *n_type_names);
...@@ -161,18 +161,37 @@ print ENUMFILE "\n" unless $first; ...@@ -161,18 +161,37 @@ print ENUMFILE "\n" unless $first;
print ENUMFILE <<CODE; print ENUMFILE <<CODE;
}; };
static gboolean enums_initialized = FALSE;
/**
* gimp_enums_init
*
* This function makes sure all the enum types are registered
* with the GObject type system. This is intended for use by
* language bindings that need the symbols early, before gimp_main
* is run. It's not necessary for plug-ins to call this directly,
* as the normal plug-in initialization code will handle it
* implicitly.
*
* Since: GIMP 2.4
**/
void void
_gimp_enums_init (void) gimp_enums_init (void)
{ {
const GimpGetTypeFunc *funcs = get_type_funcs; const GimpGetTypeFunc *funcs = get_type_funcs;
gint i; gint i;
if (enums_initialized)
return;
for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++) for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++)
{ {
GType type = (*funcs) (); GType type = (*funcs) ();
g_type_class_ref (type); g_type_class_ref (type);
} }
enums_initialized = TRUE;
} }
/** /**
......
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