From 38999b7dd44887d7d3446052761c42064447c660 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 15 Oct 2010 12:04:36 +0200 Subject: [PATCH] libgimp: implement GObject::dispose() instead of GtkObject::destroy() --- libgimp/gimpaspectpreview.c | 53 ++++++++++++++++----------------- libgimp/gimpdrawablepreview.c | 55 +++++++++++++++++------------------ 2 files changed, 51 insertions(+), 57 deletions(-) diff --git a/libgimp/gimpaspectpreview.c b/libgimp/gimpaspectpreview.c index 2adf888eb2..d16167a8ac 100644 --- a/libgimp/gimpaspectpreview.c +++ b/libgimp/gimpaspectpreview.c @@ -57,8 +57,7 @@ typedef struct static GObject * gimp_aspect_preview_constructor (GType type, guint n_params, GObjectConstructParam *params); - - +static void gimp_aspect_preview_dispose (GObject *object); static void gimp_aspect_preview_get_property (GObject *object, guint property_id, GValue *value, @@ -67,7 +66,7 @@ static void gimp_aspect_preview_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void gimp_aspect_preview_destroy (GtkObject *object); + static void gimp_aspect_preview_style_set (GtkWidget *widget, GtkStyle *prev_style); static void gimp_aspect_preview_draw (GimpPreview *preview); @@ -99,17 +98,15 @@ static gint gimp_aspect_preview_counter = 0; static void gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass); object_class->constructor = gimp_aspect_preview_constructor; + object_class->dispose = gimp_aspect_preview_dispose; object_class->get_property = gimp_aspect_preview_get_property; object_class->set_property = gimp_aspect_preview_set_property; - gtk_object_class->destroy = gimp_aspect_preview_destroy; - widget_class->style_set = gimp_aspect_preview_style_set; preview_class->draw = gimp_aspect_preview_draw; @@ -163,6 +160,25 @@ gimp_aspect_preview_constructor (GType type, return object; } +static void +gimp_aspect_preview_dispose (GObject *object) +{ + const gchar *data_name = g_object_get_data (G_OBJECT (object), + "gimp-aspect-preview-data-name"); + + if (data_name) + { + GimpPreview *preview = GIMP_PREVIEW (object); + PreviewSettings settings; + + settings.update = gimp_preview_get_update (preview); + + gimp_set_data (data_name, &settings, sizeof (PreviewSettings)); + } + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + static void gimp_aspect_preview_get_property (GObject *object, guint property_id, @@ -204,25 +220,6 @@ gimp_aspect_preview_set_property (GObject *object, } } -static void -gimp_aspect_preview_destroy (GtkObject *object) -{ - const gchar *data_name = g_object_get_data (G_OBJECT (object), - "gimp-aspect-preview-data-name"); - - if (data_name) - { - GimpPreview *preview = GIMP_PREVIEW (object); - PreviewSettings settings; - - settings.update = gimp_preview_get_update (preview); - - gimp_set_data (data_name, &settings, sizeof (PreviewSettings)); - } - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - static void gimp_aspect_preview_style_set (GtkWidget *widget, GtkStyle *prev_style) diff --git a/libgimp/gimpdrawablepreview.c b/libgimp/gimpdrawablepreview.c index f69c0d2052..a472653544 100644 --- a/libgimp/gimpdrawablepreview.c +++ b/libgimp/gimpdrawablepreview.c @@ -59,7 +59,7 @@ typedef struct static GObject * gimp_drawable_preview_constructor (GType type, guint n_params, GObjectConstructParam *params); - +static void gimp_drawable_preview_dispose (GObject *object); static void gimp_drawable_preview_get_property (GObject *object, guint property_id, GValue *value, @@ -68,7 +68,6 @@ static void gimp_drawable_preview_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void gimp_drawable_preview_destroy (GtkObject *object); static void gimp_drawable_preview_style_set (GtkWidget *widget, GtkStyle *prev_style); @@ -97,17 +96,15 @@ static gint gimp_drawable_preview_counter = 0; static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass); object_class->constructor = gimp_drawable_preview_constructor; + object_class->dispose = gimp_drawable_preview_dispose; object_class->get_property = gimp_drawable_preview_get_property; object_class->set_property = gimp_drawable_preview_set_property; - gtk_object_class->destroy = gimp_drawable_preview_destroy; - widget_class->style_set = gimp_drawable_preview_style_set; preview_class->draw = gimp_drawable_preview_draw_original; @@ -162,6 +159,27 @@ gimp_drawable_preview_constructor (GType type, return object; } +static void +gimp_drawable_preview_dispose (GObject *object) +{ + const gchar *data_name = g_object_get_data (G_OBJECT (object), + "gimp-drawable-preview-data-name"); + + if (data_name) + { + GimpPreview *preview = GIMP_PREVIEW (object); + PreviewSettings settings; + + settings.x = preview->xoff + preview->xmin; + settings.y = preview->yoff + preview->ymin; + settings.update = gimp_preview_get_update (preview); + + gimp_set_data (data_name, &settings, sizeof (PreviewSettings)); + } + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + static void gimp_drawable_preview_get_property (GObject *object, guint property_id, @@ -204,27 +222,6 @@ gimp_drawable_preview_set_property (GObject *object, } } -static void -gimp_drawable_preview_destroy (GtkObject *object) -{ - const gchar *data_name = g_object_get_data (G_OBJECT (object), - "gimp-drawable-preview-data-name"); - - if (data_name) - { - GimpPreview *preview = GIMP_PREVIEW (object); - PreviewSettings settings; - - settings.x = preview->xoff + preview->xmin; - settings.y = preview->yoff + preview->ymin; - settings.update = gimp_preview_get_update (preview); - - gimp_set_data (data_name, &settings, sizeof (PreviewSettings)); - } - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - static void gimp_drawable_preview_style_set (GtkWidget *widget, GtkStyle *prev_style)