Commit ae7fa2a1 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: clean up the instance private code in all select buttons

parent b6033684
Pipeline #101468 passed with stages
in 15 minutes and 27 seconds
......@@ -81,8 +81,6 @@ struct _GimpBrushSelectButtonPrivate
GtkWidget *popup;
};
#define GET_PRIVATE(obj) (((GimpBrushSelectButton *) (obj))->priv)
/* local function prototypes */
......@@ -282,8 +280,7 @@ gimp_brush_select_button_init (GimpBrushSelectButton *button)
button->priv = gimp_brush_select_button_get_instance_private (button);
priv = GET_PRIVATE (button);
priv = button->priv;
priv->brush_name = gimp_context_get_brush ();
gimp_brush_get_pixels (priv->brush_name,
......@@ -369,22 +366,18 @@ gimp_brush_select_button_get_brush (GimpBrushSelectButton *button,
gint *spacing,
GimpLayerMode *paint_mode)
{
GimpBrushSelectButtonPrivate *priv;
g_return_val_if_fail (GIMP_IS_BRUSH_SELECT_BUTTON (button), NULL);
priv = GET_PRIVATE (button);
if (opacity)
*opacity = priv->opacity;
*opacity = button->priv->opacity;
if (spacing)
*spacing = priv->spacing;
*spacing = button->priv->spacing;
if (paint_mode)
*paint_mode = priv->paint_mode;
*paint_mode = button->priv->paint_mode;
return priv->brush_name;
return button->priv->brush_name;
}
/**
......@@ -475,11 +468,11 @@ gimp_brush_select_button_set_brush (GimpBrushSelectButton *button,
static void
gimp_brush_select_button_finalize (GObject *object)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (object);
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
g_clear_pointer (&priv->brush_name, g_free);
g_clear_pointer (&priv->mask_data, g_free);
g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&button->priv->brush_name, g_free);
g_clear_pointer (&button->priv->mask_data, g_free);
g_clear_pointer (&button->priv->title, g_free);
G_OBJECT_CLASS (gimp_brush_select_button_parent_class)->finalize (object);
}
......@@ -490,37 +483,41 @@ gimp_brush_select_button_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
gdouble opacity;
gint32 spacing;
gint32 paint_mode;
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
gdouble opacity;
gint32 spacing;
gint32 paint_mode;
switch (property_id)
{
case PROP_TITLE:
priv->title = g_value_dup_string (value);
button->priv->title = g_value_dup_string (value);
break;
case PROP_BRUSH_NAME:
gimp_brush_select_button_set_brush (button,
g_value_get_string (value),
-1.0, -1, -1);
break;
case PROP_BRUSH_OPACITY:
opacity = g_value_get_double (value);
if (opacity >= 0.0)
priv->opacity = opacity;
button->priv->opacity = opacity;
break;
case PROP_BRUSH_SPACING:
spacing = g_value_get_int (value);
if (spacing != -1)
priv->spacing = spacing;
button->priv->spacing = spacing;
break;
case PROP_BRUSH_PAINT_MODE:
paint_mode = g_value_get_int (value);
if (paint_mode != -1)
priv->paint_mode = paint_mode;
button->priv->paint_mode = paint_mode;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -533,26 +530,30 @@ gimp_brush_select_button_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
switch (property_id)
{
case PROP_TITLE:
g_value_set_string (value, priv->title);
g_value_set_string (value, button->priv->title);
break;
case PROP_BRUSH_NAME:
g_value_set_string (value, priv->brush_name);
g_value_set_string (value, button->priv->brush_name);
break;
case PROP_BRUSH_OPACITY:
g_value_set_double (value, priv->opacity);
g_value_set_double (value, button->priv->opacity);
break;
case PROP_BRUSH_SPACING:
g_value_set_int (value, priv->spacing);
g_value_set_int (value, button->priv->spacing);
break;
case PROP_BRUSH_PAINT_MODE:
g_value_set_int (value, priv->paint_mode);
g_value_set_int (value, button->priv->paint_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -570,22 +571,21 @@ gimp_brush_select_button_callback (const gchar *name,
gboolean dialog_closing,
gpointer data)
{
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (data);
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
g_free (priv->brush_name);
g_free (priv->mask_data);
priv->brush_name = g_strdup (name);
priv->width = width;
priv->height = height;
priv->mask_data = g_memdup (mask_data, width * height);
priv->opacity = opacity;
priv->spacing = spacing;
priv->paint_mode = paint_mode;
gimp_brush_select_preview_update (priv->preview,
GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (data);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
g_free (button->priv->brush_name);
g_free (button->priv->mask_data);
button->priv->brush_name = g_strdup (name);
button->priv->width = width;
button->priv->height = height;
button->priv->mask_data = g_memdup (mask_data, width * height);
button->priv->opacity = opacity;
button->priv->spacing = spacing;
button->priv->paint_mode = paint_mode;
gimp_brush_select_preview_update (button->priv->preview,
width, height, mask_data);
if (dialog_closing)
......@@ -600,23 +600,25 @@ gimp_brush_select_button_callback (const gchar *name,
static void
gimp_brush_select_button_clicked (GimpBrushSelectButton *button)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
if (select_button->temp_callback)
{
/* calling gimp_brushes_set_popup() raises the dialog */
gimp_brushes_set_popup (select_button->temp_callback,
priv->brush_name,
priv->opacity,
priv->spacing,
priv->paint_mode);
button->priv->brush_name,
button->priv->opacity,
button->priv->spacing,
button->priv->paint_mode);
}
else
{
select_button->temp_callback =
gimp_brush_select_new (priv->title, priv->brush_name,
priv->opacity, priv->spacing, priv->paint_mode,
gimp_brush_select_new (button->priv->title,
button->priv->brush_name,
button->priv->opacity,
button->priv->spacing,
button->priv->paint_mode,
gimp_brush_select_button_callback,
button, NULL);
}
......@@ -625,13 +627,12 @@ gimp_brush_select_button_clicked (GimpBrushSelectButton *button)
static void
gimp_brush_select_preview_resize (GimpBrushSelectButton *button)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
if (priv->width > 0 && priv->height > 0)
gimp_brush_select_preview_update (priv->preview,
priv->width,
priv->height,
priv->mask_data);
if (button->priv->width > 0 &&
button->priv->height > 0)
gimp_brush_select_preview_update (button->priv->preview,
button->priv->width,
button->priv->height,
button->priv->mask_data);
}
static gboolean
......@@ -639,10 +640,9 @@ gimp_brush_select_preview_events (GtkWidget *widget,
GdkEvent *event,
GimpBrushSelectButton *button)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
GdkEventButton *bevent;
GdkEventButton *bevent;
if (priv->mask_data)
if (button->priv->mask_data)
{
switch (event->type)
{
......@@ -749,7 +749,7 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
gint x,
gint y)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpBrushSelectButtonPrivate *priv = button->priv;
GtkWidget *frame;
GtkWidget *preview;
GdkMonitor *monitor;
......@@ -804,13 +804,7 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
static void
gimp_brush_select_button_close_popup (GimpBrushSelectButton *button)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (button);
if (priv->popup)
{
gtk_widget_destroy (priv->popup);
priv->popup = NULL;
}
g_clear_pointer (&button->priv->popup, gtk_widget_destroy);
}
static void
......@@ -855,7 +849,7 @@ gimp_brush_select_drag_data_received (GimpBrushSelectButton *button,
static GtkWidget *
gimp_brush_select_button_create_inside (GimpBrushSelectButton *brush_button)
{
GimpBrushSelectButtonPrivate *priv = GET_PRIVATE (brush_button);
GimpBrushSelectButtonPrivate *priv = brush_button->priv;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *button;
......
......@@ -77,13 +77,13 @@ struct _GimpBrushSelectButtonClass
};
GType gimp_brush_select_button_get_type (void) G_GNUC_CONST;
GType gimp_brush_select_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_brush_select_button_new (const gchar *title,
const gchar *brush_name,
gdouble opacity,
gint spacing,
GimpLayerMode paint_mode);
GtkWidget * gimp_brush_select_button_new (const gchar *title,
const gchar *brush_name,
gdouble opacity,
gint spacing,
GimpLayerMode paint_mode);
const gchar * gimp_brush_select_button_get_brush (GimpBrushSelectButton *button,
gdouble *opacity,
......
......@@ -68,8 +68,6 @@ struct _GimpFontSelectButtonPrivate
GtkWidget *label;
};
#define GET_PRIVATE(obj) (((GimpFontSelectButton *) (obj))->priv)
/* local function prototypes */
......@@ -178,16 +176,10 @@ gimp_font_select_button_class_init (GimpFontSelectButtonClass *klass)
static void
gimp_font_select_button_init (GimpFontSelectButton *button)
{
GimpFontSelectButtonPrivate *priv;
button->priv = gimp_font_select_button_get_instance_private (button);
priv = GET_PRIVATE (button);
priv->font_name = NULL;
priv->inside = gimp_font_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), priv->inside);
button->priv->inside = gimp_font_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), button->priv->inside);
}
/**
......@@ -237,7 +229,7 @@ gimp_font_select_button_get_font (GimpFontSelectButton *button)
{
g_return_val_if_fail (GIMP_IS_FONT_SELECT_BUTTON (button), NULL);
return GET_PRIVATE (button)->font_name;
return button->priv->font_name;
}
/**
......@@ -271,10 +263,10 @@ gimp_font_select_button_set_font (GimpFontSelectButton *button,
static void
gimp_font_select_button_finalize (GObject *object)
{
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (object);
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
g_clear_pointer (&priv->font_name, g_free);
g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&button->priv->font_name, g_free);
g_clear_pointer (&button->priv->title, g_free);
G_OBJECT_CLASS (gimp_font_select_button_parent_class)->finalize (object);
}
......@@ -285,14 +277,14 @@ gimp_font_select_button_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
switch (property_id)
{
case PROP_TITLE:
priv->title = g_value_dup_string (value);
button->priv->title = g_value_dup_string (value);
break;
case PROP_FONT_NAME:
gimp_font_select_button_set_font (button,
g_value_get_string (value));
......@@ -310,16 +302,16 @@ gimp_font_select_button_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
switch (property_id)
{
case PROP_TITLE:
g_value_set_string (value, priv->title);
g_value_set_string (value, button->priv->title);
break;
case PROP_FONT_NAME:
g_value_set_string (value, priv->font_name);
g_value_set_string (value, button->priv->font_name);
break;
default:
......@@ -334,7 +326,7 @@ gimp_font_select_button_callback (const gchar *font_name,
gpointer user_data)
{
GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (user_data);
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpFontSelectButtonPrivate *priv = button->priv;
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
g_free (priv->font_name);
......@@ -353,19 +345,19 @@ gimp_font_select_button_callback (const gchar *font_name,
static void
gimp_font_select_button_clicked (GimpFontSelectButton *button)
{
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
if (select_button->temp_callback)
{
/* calling gimp_fonts_set_popup() raises the dialog */
gimp_fonts_set_popup (select_button->temp_callback,
priv->font_name);
button->priv->font_name);
}
else
{
select_button->temp_callback =
gimp_font_select_new (priv->title, priv->font_name,
gimp_font_select_new (button->priv->title,
button->priv->font_name,
gimp_font_select_button_callback,
button, NULL);
}
......@@ -413,7 +405,7 @@ gimp_font_select_drag_data_received (GimpFontSelectButton *button,
static GtkWidget *
gimp_font_select_button_create_inside (GimpFontSelectButton *font_button)
{
GimpFontSelectButtonPrivate *priv = GET_PRIVATE (font_button);
GimpFontSelectButtonPrivate *priv = font_button->priv;
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *image;
......
......@@ -75,8 +75,6 @@ struct _GimpGradientSelectButtonPrivate
GtkWidget *preview;
};
#define GET_PRIVATE(obj) (((GimpGradientSelectButton *) (obj))->priv)
/* local function prototypes */
......@@ -200,18 +198,14 @@ gimp_gradient_select_button_class_init (GimpGradientSelectButtonClass *klass)
static void
gimp_gradient_select_button_init (GimpGradientSelectButton *button)
{
GimpGradientSelectButtonPrivate *priv;
button->priv = gimp_gradient_select_button_get_instance_private (button);
priv = GET_PRIVATE (button);
priv->gradient_name = gimp_context_get_gradient ();
priv->sample_size = CELL_WIDTH;
priv->reverse = FALSE;
button->priv->gradient_name = gimp_context_get_gradient ();
button->priv->sample_size = CELL_WIDTH;
button->priv->reverse = FALSE;
priv->inside = gimp_gradient_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), priv->inside);
button->priv->inside = gimp_gradient_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), button->priv->inside);
}
/**
......@@ -261,7 +255,7 @@ gimp_gradient_select_button_get_gradient (GimpGradientSelectButton *button)
{
g_return_val_if_fail (GIMP_IS_GRADIENT_SELECT_BUTTON (button), NULL);
return GET_PRIVATE (button)->gradient_name;
return button->priv->gradient_name;
}
/**
......@@ -277,12 +271,10 @@ void
gimp_gradient_select_button_set_gradient (GimpGradientSelectButton *button,
const gchar *gradient_name)
{
GimpGradientSelectButtonPrivate *priv;
GimpSelectButton *select_button;
GimpSelectButton *select_button;
g_return_if_fail (GIMP_IS_GRADIENT_SELECT_BUTTON (button));
priv = GET_PRIVATE (button);
select_button = GIMP_SELECT_BUTTON (button);
if (select_button->temp_callback)
......@@ -301,8 +293,8 @@ gimp_gradient_select_button_set_gradient (GimpGradientSelectButton *button,
name = gimp_context_get_gradient ();
if (gimp_gradient_get_uniform_samples (name,
priv->sample_size,
priv->reverse,
button->priv->sample_size,
button->priv->reverse,
&n_samples,
&samples))
{
......@@ -323,11 +315,11 @@ gimp_gradient_select_button_set_gradient (GimpGradientSelectButton *button,
static void
gimp_gradient_select_button_finalize (GObject *object)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (object);
GimpGradientSelectButton *button = GIMP_GRADIENT_SELECT_BUTTON (object);
g_clear_pointer (&priv->gradient_name, g_free);
g_clear_pointer (&priv->gradient_data, g_free);
g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&button->priv->gradient_name, g_free);
g_clear_pointer (&button->priv->gradient_data, g_free);
g_clear_pointer (&button->priv->title, g_free);
G_OBJECT_CLASS (gimp_gradient_select_button_parent_class)->finalize (object);
}
......@@ -338,14 +330,14 @@ gimp_gradient_select_button_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GimpGradientSelectButton *button = GIMP_GRADIENT_SELECT_BUTTON (object);
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (object);
GimpGradientSelectButton *button = GIMP_GRADIENT_SELECT_BUTTON (object);
switch (property_id)
{
case PROP_TITLE:
priv->title = g_value_dup_string (value);
button->priv->title = g_value_dup_string (value);
break;
case PROP_GRADIENT_NAME:
gimp_gradient_select_button_set_gradient (button,
g_value_get_string (value));
......@@ -363,15 +355,16 @@ gimp_gradient_select_button_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (object);
GimpGradientSelectButton *button = GIMP_GRADIENT_SELECT_BUTTON (object);
switch (property_id)
{
case PROP_TITLE:
g_value_set_string (value, priv->title);
g_value_set_string (value, button->priv->title);
break;
case PROP_GRADIENT_NAME:
g_value_set_string (value, priv->gradient_name);
g_value_set_string (value, button->priv->gradient_name);
break;
default:
......@@ -387,18 +380,18 @@ gimp_gradient_select_button_callback (const gchar *gradient_name,
gboolean dialog_closing,
gpointer user_data)
{
GimpGradientSelectButton *button = user_data;
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
GimpGradientSelectButton *button = user_data;
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
g_free (priv->gradient_name);
g_free (priv->gradient_data);
g_free (button->priv->gradient_name);
g_free (button->priv->gradient_data);
priv->gradient_name = g_strdup (gradient_name);
priv->n_samples = n_samples;
priv->gradient_data = g_memdup (gradient_data, n_samples * sizeof (gdouble));
button->priv->gradient_name = g_strdup (gradient_name);
button->priv->n_samples = n_samples;
button->priv->gradient_data = g_memdup (gradient_data,
n_samples * sizeof (gdouble));
gtk_widget_queue_draw (priv->preview);
gtk_widget_queue_draw (button->priv->preview);
if (dialog_closing)
select_button->temp_callback = NULL;
......@@ -411,20 +404,20 @@ gimp_gradient_select_button_callback (const gchar *gradient_name,
static void
gimp_gradient_select_button_clicked (GimpGradientSelectButton *button)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
if (select_button->temp_callback)
{
/* calling gimp_gradients_set_popup() raises the dialog */
gimp_gradients_set_popup (select_button->temp_callback,
priv->gradient_name);
button->priv->gradient_name);
}
else
{
select_button->temp_callback =
gimp_gradient_select_new (priv->title, priv->gradient_name,
priv->sample_size,
gimp_gradient_select_new (button->priv->title,
button->priv->gradient_name,
button->priv->sample_size,
gimp_gradient_select_button_callback,
button, NULL);
}
......@@ -435,21 +428,20 @@ gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpGradientSelectButton *button)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (button);
gdouble *samples;
gint n_samples;
gdouble *samples;
gint n_samples;
if (gimp_gradient_get_uniform_samples (priv->gradient_name,
if (gimp_gradient_get_uniform_samples (button->priv->gradient_name,
allocation->width,
priv->reverse,
button->priv->reverse,
&n_samples,
&samples))
{
g_free (priv->gradient_data);
g_free (button->priv->gradient_data);
priv->sample_size = allocation->width;
priv->n_samples = n_samples;
priv->gradient_data = samples;
button->priv->sample_size = allocation->width;
button->priv->n_samples = n_samples;
button->priv->gradient_data = samples;
}
}
......@@ -458,16 +450,15 @@ gimp_gradient_select_preview_draw (GtkWidget *widget,
cairo_t *cr,
GimpGradientSelectButton *button)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (button);
GtkAllocation allocation;
cairo_pattern_t *pattern;
cairo_surface_t *surface;
const gdouble *src;
guchar *dest;
gint width;
gint x;
src = priv->gradient_data;
GtkAllocation allocation;
cairo_pattern_t *pattern;
cairo_surface_t *surface;
const gdouble *src;
guchar *dest;
gint width;
gint x;
src = button->priv->gradient_data;
if (! src)
return FALSE;
......@@ -479,7 +470,7 @@ gimp_gradient_select_preview_draw (GtkWidget *widget,
cairo_paint (cr);
width = priv->n_samples / 4;
width = button->priv->n_samples / 4;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, 1);
......@@ -554,7 +545,7 @@ gimp_gradient_select_drag_data_received (GimpGradientSelectButton *button,
static GtkWidget *
gimp_gradient_select_button_create_inside (GimpGradientSelectButton *gradient_button)
{
GimpGradientSelectButtonPrivate *priv = GET_PRIVATE (gradient_button);
GimpGradientSelectButtonPrivate *priv = gradient_button->priv;
GtkWidget *button;
button = gtk_button_new ();
......
......@@ -44,10 +44,6 @@
**/
#define GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpPaletteSelectButtonPrivate *) gimp_palette_select_button_get_instance_private ((GimpPaletteSelectButton *) (obj)))
typedef struct _GimpPaletteSelectButtonPrivate GimpPaletteSelectButtonPrivate;
struct _GimpPaletteSelectButtonPrivate
{
gchar *title;
......@@ -179,14 +175,10 @@ gimp_palette_select_button_class_init (GimpPaletteSelectButtonClass *klass)
static void
gimp_palette_select_button_init (GimpPaletteSelectButton *button)
{
GimpPaletteSelectButtonPrivate *priv;
priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
button->priv = gimp_palette_select_button_get_instance_private (button);
priv->palette_name = NULL;
priv->inside = gimp_palette_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), priv->inside);
button->priv->inside = gimp_palette_select_button_create_inside (button);
gtk_container_add (GTK_CONTAINER (button), button->priv->inside);
}
/**
......@@ -234,12 +226,9 @@ gimp_palette_select_button_new (const gchar *title,
const gchar *
gimp_palette_select_button_get_palette (GimpPaletteSelectButton *button)
{
GimpPaletteSelectButtonPrivate *priv;
g_return_val_if_fail (GIMP_IS_PALETTE_SELECT_BUTTON (button), NULL);
priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
return priv->palette_name;
return button->priv->palette_name;
}
/**
......@@ -288,12 +277,10 @@ gimp_palette_select_button_set_palette (GimpPaletteSelectButton *button,
static void
gimp_palette_select_button_finalize (GObject *object)
{
GimpPaletteSelectButtonPrivate *priv;
GimpPaletteSelectButton *button = GIMP_PALETTE_SELECT_BUTTON (object);
priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (object);
g_clear_pointer (&priv->palette_name, g_free);
g_clear_pointer (&priv->title, g_free);