Commit 1948feb6 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: implement GObject::dispose() instead of GtkWidget::destroy()

parent 38999b7d
......@@ -48,7 +48,7 @@
**/
static void gimp_progress_bar_destroy (GtkObject *object);
static void gimp_progress_bar_dispose (GObject *object);
static void gimp_progress_bar_start (const gchar *message,
gboolean cancelable,
......@@ -70,9 +70,9 @@ G_DEFINE_TYPE (GimpProgressBar, gimp_progress_bar, GTK_TYPE_PROGRESS_BAR)
static void
gimp_progress_bar_class_init (GimpProgressBarClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->destroy = gimp_progress_bar_destroy;
object_class->dispose = gimp_progress_bar_dispose;
}
static void
......@@ -94,7 +94,7 @@ gimp_progress_bar_init (GimpProgressBar *bar)
}
static void
gimp_progress_bar_destroy (GtkObject *object)
gimp_progress_bar_dispose (GObject *object)
{
GimpProgressBar *bar = GIMP_PROGRESS_BAR (object);
......@@ -104,7 +104,7 @@ gimp_progress_bar_destroy (GtkObject *object)
bar->progress_callback = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
......
......@@ -41,7 +41,7 @@
/* local function prototypes */
static void gimp_select_button_destroy (GtkObject *object);
static void gimp_select_button_dispose (GObject *object);
G_DEFINE_TYPE (GimpSelectButton, gimp_select_button, GTK_TYPE_HBOX)
......@@ -49,9 +49,9 @@ G_DEFINE_TYPE (GimpSelectButton, gimp_select_button, GTK_TYPE_HBOX)
static void
gimp_select_button_class_init (GimpSelectButtonClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->destroy = gimp_select_button_destroy;
object_class->dispose = gimp_select_button_dispose;
}
static void
......@@ -60,6 +60,14 @@ gimp_select_button_init (GimpSelectButton *select_button)
select_button->temp_callback = NULL;
}
static void
gimp_select_button_dispose (GObject *object)
{
gimp_select_button_close_popup (GIMP_SELECT_BUTTON (object));
G_OBJECT_CLASS (gimp_select_button_parent_class)->dispose (object);
}
/**
* gimp_select_button_close_popup:
* @button: A #GimpSelectButton
......@@ -82,14 +90,3 @@ gimp_select_button_close_popup (GimpSelectButton *button)
button->temp_callback = NULL;
}
}
/* private functions */
static void
gimp_select_button_destroy (GtkObject *object)
{
gimp_select_button_close_popup (GIMP_SELECT_BUTTON (object));
GTK_OBJECT_CLASS (gimp_select_button_parent_class)->destroy (object);
}
......@@ -69,7 +69,8 @@ typedef struct
static GObject * gimp_zoom_preview_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_zoom_preview_finalize (GObject *object);
static void gimp_zoom_preview_dispose (GObject *object);
static void gimp_zoom_preview_get_property (GObject *object,
guint property_id,
GValue *value,
......@@ -78,8 +79,6 @@ static void gimp_zoom_preview_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_zoom_preview_finalize (GObject *object);
static void gimp_zoom_preview_destroy (GtkObject *object);
static void gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
gdouble old_factor,
......@@ -134,17 +133,15 @@ static gint gimp_zoom_preview_counter = 0;
static void
gimp_zoom_preview_class_init (GimpZoomPreviewClass *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_zoom_preview_constructor;
object_class->finalize = gimp_zoom_preview_finalize;
object_class->dispose = gimp_zoom_preview_dispose;
object_class->get_property = gimp_zoom_preview_get_property;
object_class->set_property = gimp_zoom_preview_set_property;
object_class->finalize = gimp_zoom_preview_finalize;
gtk_object_class->destroy = gimp_zoom_preview_destroy;
widget_class->style_set = gimp_zoom_preview_style_set;
......@@ -247,6 +244,39 @@ gimp_zoom_preview_constructor (GType type,
return object;
}
static void
gimp_zoom_preview_finalize (GObject *object)
{
GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
if (priv->model)
{
g_object_unref (priv->model);
priv->model = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_zoom_preview_dispose (GObject *object)
{
const gchar *data_name = g_object_get_data (G_OBJECT (object),
"gimp-zoom-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_zoom_preview_get_property (GObject *object,
guint property_id,
......@@ -295,39 +325,6 @@ gimp_zoom_preview_set_property (GObject *object,
}
}
static void
gimp_zoom_preview_finalize (GObject *object)
{
GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
if (priv->model)
{
g_object_unref (priv->model);
priv->model = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_zoom_preview_destroy (GtkObject *object)
{
const gchar *data_name = g_object_get_data (G_OBJECT (object),
"gimp-zoom-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_zoom_preview_set_adjustments (GimpZoomPreview *preview,
gdouble old_factor,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment