diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index d36fd42f0..3171b777d 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 6 00:54:38 2004 Matthias Clasen + + * gobject/gobject-sections.txt: + * gobject/tmpl/gtypemodule.sgml: Add g_type_module_register_enum() + and g_type_module_register_flags(). + Mon Jul 5 18:49:56 2004 Matthias Clasen * glib/tmpl/messages.sgml: diff --git a/docs/reference/gobject/gobject-sections.txt b/docs/reference/gobject/gobject-sections.txt index 690841539..c8de644d9 100644 --- a/docs/reference/gobject/gobject-sections.txt +++ b/docs/reference/gobject/gobject-sections.txt @@ -185,6 +185,8 @@ g_type_module_unuse g_type_module_set_name g_type_module_register_type g_type_module_add_interface +g_type_module_register_enum +g_type_module_register_flags G_TYPE_MODULE G_IS_TYPE_MODULE diff --git a/docs/reference/gobject/tmpl/gtypemodule.sgml b/docs/reference/gobject/tmpl/gtypemodule.sgml index 9f4c0342c..ed3cc5878 100644 --- a/docs/reference/gobject/tmpl/gtypemodule.sgml +++ b/docs/reference/gobject/tmpl/gtypemodule.sgml @@ -145,3 +145,42 @@ not be unloaded. @interface_info: type information structure + + +Looks up or registers an enumeration that is implemented with a particular +type plugin. If a type with name @type_name was previously registered, +the #GType identifier for the type is returned, otherwise the type +is newly registered, and the resulting #GType identifier returned. + + +As long as any instances of the type exist, the type plugin will +not be unloaded. + + +@module: a #GTypeModule +@name: name for the type +@const_static_values: an array of #GEnumValue structs for the possible + enumeration values. The array is terminated by a struct with all + members being 0. +@Returns: the new or existing type ID +@Since: 2.6 + + + +Looks up or registers a flags type that is implemented with a particular +type plugin. If a type with name @type_name was previously registered, +the #GType identifier for the type is returned, otherwise the type +is newly registered, and the resulting #GType identifier returned. + + +As long as any instances of the type exist, the type plugin will +not be unloaded. + + +@module: a #GTypeModule +@name: name for the type +@const_static_values: an array of #GFlagsValue structs for the possible + flags values. The array is terminated by a struct with all + members being 0. +@Returns: the new or existing type ID +@Since: 2.6 diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 1d8aef2fe..5d912c4e2 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,7 +1,15 @@ +Tue Jul 6 00:46:43 2004 Matthias Clasen + + * gtypemodule.h: + * gtypemodule.c (g_type_module_register_flags): + * gtypemodule.c (g_type_module_register_enum): New + functions to register enum and flags types from a + GTypeModule. (#145396, Sven Neumann) + Wed Jun 23 12:55:34 2004 Matthias Clasen * gtype.h (G_DEFINE_TYPE_EXTENDED): Add an initializer for - the g_define_type_info.value_table. (#144678,Mariano + the g_define_type_info.value_table. (#144678, Mariano Suárez-Alvarez) Tue Jun 22 21:50:47 2004 Matthias Clasen diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c index dcffca1a5..bb3df5b0a 100644 --- a/gobject/gtypemodule.c +++ b/gobject/gtypemodule.c @@ -387,3 +387,39 @@ g_type_module_add_interface (GTypeModule *module, module_interface_info->loaded = TRUE; module_interface_info->info = *interface_info; } + +void +g_type_module_register_enum (GTypeModule *module, + const gchar *name, + const GEnumValue *const_static_values) +{ + GTypeInfo enum_type_info = { 0, }; + + g_return_val_if_fail (G_IS_TYPE_MODULE (module), 0); + g_return_val_if_fail (name != NULL, 0); + g_return_val_if_fail (const_static_values != NULL, 0); + + g_enum_complete_type_info (G_TYPE_ENUM, + &enum_type_info, const_static_values); + + return g_type_module_register_type (G_TYPE_MODULE (module), + G_TYPE_ENUM, name, &enum_type_info, 0); +} + +void +g_type_module_register_flags (GTypeModule *module, + const gchar *name, + const GFlagsValue *const_static_values) +{ + GTypeInfo flags_type_info = { 0, }; + + g_return_val_if_fail (G_IS_TYPE_MODULE (module), 0); + g_return_val_if_fail (name != NULL, 0); + g_return_val_if_fail (const_static_values != NULL, 0); + + g_flags_complete_type_info (G_TYPE_FLAGS, + &flags_type_info, const_static_values); + + return g_type_module_register_type (G_TYPE_MODULE (module), + G_TYPE_FLAGS, name, &flags_type_info, 0); +} diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h index e7746ec0a..863ea153f 100644 --- a/gobject/gtypemodule.h +++ b/gobject/gtypemodule.h @@ -65,20 +65,26 @@ struct _GTypeModuleClass void (*reserved4) (void); }; -GType g_type_module_get_type (void); -gboolean g_type_module_use (GTypeModule *module); -void g_type_module_unuse (GTypeModule *module); -void g_type_module_set_name (GTypeModule *module, - const gchar *name); -GType g_type_module_register_type (GTypeModule *module, - GType parent_type, - const gchar *type_name, - const GTypeInfo *type_info, - GTypeFlags flags); -void g_type_module_add_interface (GTypeModule *module, - GType instance_type, - GType interface_type, - const GInterfaceInfo *interface_info); +GType g_type_module_get_type (void); +gboolean g_type_module_use (GTypeModule *module); +void g_type_module_unuse (GTypeModule *module); +void g_type_module_set_name (GTypeModule *module, + const gchar *name); +GType g_type_module_register_type (GTypeModule *module, + GType parent_type, + const gchar *type_name, + const GTypeInfo *type_info, + GTypeFlags flags); +void g_type_module_add_interface (GTypeModule *module, + GType instance_type, + GType interface_type, + const GInterfaceInfo *interface_info); +void g_type_module_register_enum (GTypeModule *module, + const gchar *name, + const GEnumValue *const_static_values); +void g_type_module_register_flags (GTypeModule *module, + const gchar *name, + const GFlagsValue *const_static_values); G_END_DECLS