pidgin.vv: c3065394: Add G_DEFINE_TYPE compatibility define f...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Wed Apr 1 20:15:46 EDT 2009
-----------------------------------------------------------------
Revision: c30653948a4e3fd12256ed0ff5bc0ea22258d0aa
Ancestor: f8df60a95e46e0a9ea4eb439a82b96b31a90ef82
Author: maiku at soc.pidgin.im
Date: 2009-04-01T23:43:38
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/c30653948a4e3fd12256ed0ff5bc0ea22258d0aa
Modified files:
libpurple/internal.h
ChangeLog:
Add G_DEFINE_TYPE compatibility define from gobjectification branch.
-------------- next part --------------
============================================================
--- libpurple/internal.h 2c9c20e632b46a6ed9e2654ecc8094b38cc530af
+++ libpurple/internal.h c8d0ce3d62f130b0ff77f864146bbd4fbeab87fc
@@ -222,6 +222,41 @@
# endif
#endif
+#include <glib.h>
+#include <glib-object.h>
+
+#ifndef G_DEFINE_TYPE
+#define G_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \
+\
+static void type_name##_init (TypeName *self); \
+static void type_name##_class_init (TypeName##Class *klass); \
+static gpointer type_name##_parent_class = NULL; \
+static void type_name##_class_intern_init (gpointer klass) \
+{ \
+ type_name##_parent_class = g_type_class_peek_parent (klass); \
+ type_name##_class_init ((TypeName##Class*) klass); \
+} \
+\
+GType \
+type_name##_get_type (void) \
+{ \
+ static GType g_define_type_id = 0; \
+ if (G_UNLIKELY (g_define_type_id == 0)) \
+ { \
+ g_define_type_id = \
+ g_type_register_static_simple (TYPE_PARENT, \
+ g_intern_static_string (#TypeName), \
+ sizeof (TypeName##Class), \
+ (GClassInitFunc)type_name##_class_intern_init, \
+ sizeof (TypeName), \
+ (GInstanceInitFunc)type_name##_init, \
+ (GTypeFlags) 0); \
+ } \
+ return g_define_type_id; \
+} /* closes type_name##_get_type() */
+
+#endif
+
/* Safer ways to work with static buffers. When using non-static
* buffers, either use g_strdup_* functions (preferred) or use
* g_strlcpy/g_strlcpy directly. */
More information about the Commits
mailing list