PATCH: G_DEFINE_INTERFACE_TYPE macro



I've implemented a macro that i find it to be missing to the
G_DEFINE_*_TYPE: G_DEFINE_INTERFACE_TYPE

As the name infers it's supposed to define the get_type function which
defines an interface.

347,366d346
< /*
<  * Convenience macro to ease the interface definition. Works like G_DEFINE_TYPE.
<  */
< #define G_DEFINE_INTERFACE_TYPE(TypeName, type_name, TYPE_PARENT) \
< \
< GType \
< type_name##_get_type (void) \
< { \
<   static GType g_define_type_id = 0; \
<   if (G_UNLIKELY (g_define_type_id == 0)) \
<     { \
<       static const GTypeInfo g_define_type_info = { \
<         sizeof (TypeName##Class), \
<         (GBaseInitFunc) NULL, \
<         (GBaseFinalizeFunc) NULL, \
<       }; \
<       g_define_type_id = g_type_register_static (TYPE_PARENT, #TypeName, &g_define_type_info, 0); \
<     } \
<   return g_define_type_id; \
< }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]