From f34397e432451371785161b7445dd27d04aceff5 Mon Sep 17 00:00:00 2001 From: Bradley Smith Date: Sun, 9 Mar 2008 18:59:08 +0000 Subject: Change x11plugin GType style. Signed-off-by: Bradley Smith --- lib/x11plugin.c | 62 ++++++++++----------------------------------------------- 1 file changed, 10 insertions(+), 52 deletions(-) (limited to 'lib/x11plugin.c') diff --git a/lib/x11plugin.c b/lib/x11plugin.c index a051ffa..0d9436b 100644 --- a/lib/x11plugin.c +++ b/lib/x11plugin.c @@ -29,19 +29,19 @@ #include #include +static GType _parent_type = 0; +static void x11_plugin_interface_init(gpointer g_iface, + gpointer iface_data); + +G_DEFINE_TYPE_WITH_CODE(X11Plugin, x11_plugin, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(_parent_type, x11_plugin_interface_init)) + enum { ARG_0, ARG_MAP }; -GType _x11_plugin_type = 0; -static GType _parent_type = 0; - -static void x11_plugin_class_init (X11PluginClass * klass); -static void x11_plugin_init (GObject * object); -static void x11_plugin_interface_init (gpointer g_iface, gpointer iface_data); - static GObject * x11_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties); @@ -59,51 +59,11 @@ static void put_tile (X11Plugin *x11, XImage *image, gint x, gint y); static void put_winbuf (X11Plugin *x11); static void setup_winbuf (X11Plugin *x11); void create_image (X11Plugin *x11, gchar **data, XImage ** image); -inline void x11_plugin_update_status (X11Plugin *x11, - const gchar *s, - glong energy, - glong score, - glong shields); +inline void x11_plugin_update_status (X11Plugin *x11, const gchar *s, + glong energy, glong score, glong shields); static GObjectClass *parent_class = NULL; -GType -x11_plugin_get_type (void) -{ - if (!_x11_plugin_type) { - static const GTypeInfo object_info = { - sizeof (X11PluginClass), - NULL, - NULL, - (GClassInitFunc) x11_plugin_class_init, - NULL, - NULL, - sizeof (X11Plugin), - 0, - (GInstanceInitFunc) x11_plugin_init, - NULL - }; - - static const GInterfaceInfo interface_info = { - (GInterfaceInitFunc) x11_plugin_interface_init, - NULL, - NULL - }; - - _x11_plugin_type = - g_type_register_static (G_TYPE_OBJECT, - "X11Plugin", - &object_info, - 0); - - g_type_add_interface_static (_x11_plugin_type, - _parent_type, - &interface_info); - } - - return _x11_plugin_type; -} - static void x11_plugin_class_init (X11PluginClass * klass) { @@ -123,10 +83,8 @@ x11_plugin_class_init (X11PluginClass * klass) } static void -x11_plugin_init (GObject * object) +x11_plugin_init (X11Plugin* x11) { - X11Plugin *x11 = X11_PLUGIN (object); - x11->map = NULL; x11->map_size = NULL; } -- cgit v1.1