diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-11-21 04:12:13 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-11-21 04:12:13 +0000 |
commit | ae85b9619a3d92aa5bba21075b74829d48f45a94 (patch) | |
tree | 914b6f203ff98553e8382a7b7888190dafa638f5 /gdk-pixbuf | |
parent | bc4aaf9fc103aaa8e6d712898015e65e61241938 (diff) | |
download | gtk+-ae85b9619a3d92aa5bba21075b74829d48f45a94.tar.gz |
Use G_DEFINE_TYPE (#469341, Björn Lindqvist)
2007-11-20 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-animation.c: Use G_DEFINE_TYPE (#469341,
Björn Lindqvist)
svn path=/trunk/; revision=19016
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r-- | gdk-pixbuf/ChangeLog | 5 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-animation.c | 165 |
2 files changed, 39 insertions, 131 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 2ed7700092..02e60f8153 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +2007-11-20 Matthias Clasen <mclasen@redhat.com> + + * gdk-pixbuf-animation.c: Use G_DEFINE_TYPE (#469341, + Björn Lindqvist) + 2007-11-20 Bastien Nocera <hadess@hadess.net> * io-icns.c: (load_resources): Add support for 512x512 Leopard diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c index e45bcfcd2b..321df803ab 100644 --- a/gdk-pixbuf/gdk-pixbuf-animation.c +++ b/gdk-pixbuf/gdk-pixbuf-animation.c @@ -55,9 +55,6 @@ struct _GdkPixbufNonAnimClass { }; -static GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST; - - typedef struct _GdkPixbufNonAnimIter GdkPixbufNonAnimIter; typedef struct _GdkPixbufNonAnimIterClass GdkPixbufNonAnimIterClass; @@ -84,35 +81,17 @@ struct _GdkPixbufNonAnimIterClass { static GType gdk_pixbuf_non_anim_iter_get_type (void) G_GNUC_CONST; - - -GType -gdk_pixbuf_animation_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) { - static const GTypeInfo object_info = { - sizeof (GdkPixbufAnimationClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixbufAnimation), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - g_intern_static_string ("GdkPixbufAnimation"), - &object_info, 0); - } - - return object_type; +G_DEFINE_TYPE (GdkPixbufAnimation, gdk_pixbuf_animation, G_TYPE_OBJECT); + +static void +gdk_pixbuf_animation_class_init (GdkPixbufAnimationClass *klass) +{ } - +static void +gdk_pixbuf_animation_init (GdkPixbufAnimation *animation) +{ +} /** * gdk_pixbuf_animation_new_from_file: @@ -453,32 +432,16 @@ gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation, return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_iter (animation, &val); } - +G_DEFINE_TYPE (GdkPixbufAnimationIter, gdk_pixbuf_animation_iter, G_TYPE_OBJECT); -GType -gdk_pixbuf_animation_iter_get_type (void) +static void +gdk_pixbuf_animation_iter_class_init (GdkPixbufAnimationIterClass *klass) { - static GType object_type = 0; +} - if (!object_type) { - static const GTypeInfo object_info = { - sizeof (GdkPixbufAnimationIterClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixbufAnimationIter), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "GdkPixbufAnimationIter", - &object_info, 0); - } - - return object_type; +static void +gdk_pixbuf_animation_iter_init (GdkPixbufAnimationIter *iter) +{ } /** @@ -590,11 +553,7 @@ gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val); } - - -static void gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass); -static void gdk_pixbuf_non_anim_finalize (GObject *object); - +static void gdk_pixbuf_non_anim_finalize (GObject *object); static gboolean gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation); static GdkPixbuf* gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation); static void gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim, @@ -603,37 +562,7 @@ static void gdk_pixbuf_non_anim_get_size (GdkPixbufAn static GdkPixbufAnimationIter* gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim, const GTimeVal *start_time); - - - - -static gpointer non_parent_class; - -static GType -gdk_pixbuf_non_anim_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) { - static const GTypeInfo object_info = { - sizeof (GdkPixbufNonAnimClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_pixbuf_non_anim_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixbufNonAnim), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION, - "GdkPixbufNonAnim", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (GdkPixbufNonAnim, gdk_pixbuf_non_anim, GDK_TYPE_PIXBUF_ANIMATION); static void gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass) @@ -641,8 +570,6 @@ gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass); - non_parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gdk_pixbuf_non_anim_finalize; anim_class->is_static_image = gdk_pixbuf_non_anim_is_static_image; @@ -652,6 +579,11 @@ gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass) } static void +gdk_pixbuf_non_anim_init (GdkPixbufNonAnim *non_anim) +{ +} + +static void gdk_pixbuf_non_anim_finalize (GObject *object) { GdkPixbufNonAnim *non_anim = GDK_PIXBUF_NON_ANIM (object); @@ -659,7 +591,7 @@ gdk_pixbuf_non_anim_finalize (GObject *object) if (non_anim->pixbuf) g_object_unref (non_anim->pixbuf); - G_OBJECT_CLASS (non_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_pixbuf_non_anim_parent_class)->finalize (object); } GdkPixbufAnimation* @@ -710,7 +642,6 @@ gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim, *height = gdk_pixbuf_get_height (non_anim->pixbuf); } - static GdkPixbufAnimationIter* gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim, const GTimeVal *start_time) @@ -726,47 +657,16 @@ gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim, return GDK_PIXBUF_ANIMATION_ITER (iter); } - - -static void gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass); -static void gdk_pixbuf_non_anim_iter_finalize (GObject *object); +static void gdk_pixbuf_non_anim_iter_finalize (GObject *object); static int gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter); static GdkPixbuf* gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter); static gboolean gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter); static gboolean gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter, const GTimeVal *current_time); - - - - -static gpointer non_iter_parent_class; - -GType -gdk_pixbuf_non_anim_iter_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) { - static const GTypeInfo object_info = { - sizeof (GdkPixbufNonAnimIterClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_pixbuf_non_anim_iter_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixbufNonAnimIter), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER, - "GdkPixbufNonAnimIter", - &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (GdkPixbufNonAnimIter, + gdk_pixbuf_non_anim_iter, + GDK_TYPE_PIXBUF_ANIMATION_ITER); static void gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass) @@ -775,8 +675,6 @@ gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass) GdkPixbufAnimationIterClass *anim_iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass); - non_iter_parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gdk_pixbuf_non_anim_iter_finalize; anim_iter_class->get_delay_time = gdk_pixbuf_non_anim_iter_get_delay_time; @@ -786,13 +684,18 @@ gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass) } static void +gdk_pixbuf_non_anim_iter_init (GdkPixbufNonAnimIter *non_iter) +{ +} + +static void gdk_pixbuf_non_anim_iter_finalize (GObject *object) { GdkPixbufNonAnimIter *iter = GDK_PIXBUF_NON_ANIM_ITER (object); g_object_unref (iter->non_anim); - G_OBJECT_CLASS (non_iter_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_pixbuf_non_anim_iter_parent_class)->finalize (object); } static int |