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



commit ae7fa2a1de79dd17c0f6f1e4bb991223fc0b2167
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 4 17:04:22 2019 +0200

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

 libgimp/gimpbrushselectbutton.c    | 144 ++++++++++++++++++-------------------
 libgimp/gimpbrushselectbutton.h    |  12 ++--
 libgimp/gimpfontselectbutton.c     |  46 +++++-------
 libgimp/gimpgradientselectbutton.c | 115 ++++++++++++++---------------
 libgimp/gimppaletteselectbutton.c  |  89 ++++++++---------------
 libgimp/gimppaletteselectbutton.h  |  11 ++-
 libgimp/gimppatternselectbutton.c  | 143 +++++++++++++-----------------------
 libgimp/gimppatternselectbutton.h  |   9 ++-
 8 files changed, 245 insertions(+), 324 deletions(-)
---
diff --git a/libgimp/gimpbrushselectbutton.c b/libgimp/gimpbrushselectbutton.c
index f2c76fdb0c..6df97de2dd 100644
--- a/libgimp/gimpbrushselectbutton.c
+++ b/libgimp/gimpbrushselectbutton.c
@@ -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;
diff --git a/libgimp/gimpbrushselectbutton.h b/libgimp/gimpbrushselectbutton.h
index 1319111ffc..95be946d0d 100644
--- a/libgimp/gimpbrushselectbutton.h
+++ b/libgimp/gimpbrushselectbutton.h
@@ -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,
diff --git a/libgimp/gimpfontselectbutton.c b/libgimp/gimpfontselectbutton.c
index 1b0ecc22d0..1c2e1b5382 100644
--- a/libgimp/gimpfontselectbutton.c
+++ b/libgimp/gimpfontselectbutton.c
@@ -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;
diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c
index be6679fb47..7a6ef141bb 100644
--- a/libgimp/gimpgradientselectbutton.c
+++ b/libgimp/gimpgradientselectbutton.c
@@ -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 ();
diff --git a/libgimp/gimppaletteselectbutton.c b/libgimp/gimppaletteselectbutton.c
index b213f0078f..2129ca218c 100644
--- a/libgimp/gimppaletteselectbutton.c
+++ b/libgimp/gimppaletteselectbutton.c
@@ -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);
+  g_clear_pointer (&button->priv->palette_name, g_free);
+  g_clear_pointer (&button->priv->title,        g_free);
 
   G_OBJECT_CLASS (gimp_palette_select_button_parent_class)->finalize (object);
 }
@@ -304,21 +291,19 @@ gimp_palette_select_button_set_property (GObject      *object,
                                          const GValue *value,
                                          GParamSpec   *pspec)
 {
-  GimpPaletteSelectButton        *button;
-  GimpPaletteSelectButtonPrivate *priv;
-
-  button = GIMP_PALETTE_SELECT_BUTTON (object);
-  priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+  GimpPaletteSelectButton *button = GIMP_PALETTE_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_PALETTE_NAME:
       gimp_palette_select_button_set_palette (button,
                                               g_value_get_string (value));
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -331,20 +316,18 @@ gimp_palette_select_button_get_property (GObject    *object,
                                          GValue     *value,
                                          GParamSpec *pspec)
 {
-  GimpPaletteSelectButton        *button;
-  GimpPaletteSelectButtonPrivate *priv;
-
-  button = GIMP_PALETTE_SELECT_BUTTON (object);
-  priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+  GimpPaletteSelectButton *button = GIMP_PALETTE_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_PALETTE_NAME:
-      g_value_set_string (value, priv->palette_name);
+      g_value_set_string (value, button->priv->palette_name);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -356,19 +339,13 @@ gimp_palette_select_button_callback (const gchar *palette_name,
                                      gboolean     dialog_closing,
                                      gpointer     user_data)
 {
-  GimpPaletteSelectButton        *button;
-  GimpPaletteSelectButtonPrivate *priv;
-  GimpSelectButton               *select_button;
-
-  button = GIMP_PALETTE_SELECT_BUTTON (user_data);
-
-  priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
-  select_button = GIMP_SELECT_BUTTON (button);
+  GimpPaletteSelectButton *button        = user_data;
+  GimpSelectButton        *select_button = GIMP_SELECT_BUTTON (button);
 
-  g_free (priv->palette_name);
-  priv->palette_name = g_strdup (palette_name);
+  g_free (button->priv->palette_name);
+  button->priv->palette_name = g_strdup (palette_name);
 
-  gtk_label_set_text (GTK_LABEL (priv->label), palette_name);
+  gtk_label_set_text (GTK_LABEL (button->priv->label), palette_name);
 
   if (dialog_closing)
     select_button->temp_callback = NULL;
@@ -381,22 +358,19 @@ gimp_palette_select_button_callback (const gchar *palette_name,
 static void
 gimp_palette_select_button_clicked (GimpPaletteSelectButton *button)
 {
-  GimpPaletteSelectButtonPrivate *priv;
-  GimpSelectButton               *select_button;
-
-  priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
-  select_button = GIMP_SELECT_BUTTON (button);
+  GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
 
   if (select_button->temp_callback)
     {
       /*  calling gimp_palettes_set_popup() raises the dialog  */
       gimp_palettes_set_popup (select_button->temp_callback,
-                               priv->palette_name);
+                               button->priv->palette_name);
     }
   else
     {
       select_button->temp_callback =
-        gimp_palette_select_new (priv->title, priv->palette_name,
+        gimp_palette_select_new (button->priv->title,
+                                 button->priv->palette_name,
                                  gimp_palette_select_button_callback,
                                  button, NULL);
     }
@@ -444,12 +418,9 @@ gimp_palette_select_drag_data_received (GimpPaletteSelectButton *button,
 static GtkWidget *
 gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_button)
 {
-  GtkWidget                      *button;
-  GtkWidget                      *hbox;
-  GtkWidget                      *image;
-  GimpPaletteSelectButtonPrivate *priv;
-
-  priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (palette_button);
+  GtkWidget *button;
+  GtkWidget *hbox;
+  GtkWidget *image;
 
   button = gtk_button_new ();
 
@@ -460,8 +431,8 @@ gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_butto
                                         GTK_ICON_SIZE_BUTTON);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
 
-  priv->label = gtk_label_new (priv->palette_name);
-  gtk_box_pack_start (GTK_BOX (hbox), priv->label, TRUE, TRUE, 4);
+  palette_button->priv->label = gtk_label_new (palette_button->priv->palette_name);
+  gtk_box_pack_start (GTK_BOX (hbox), palette_button->priv->label, TRUE, TRUE, 4);
 
   gtk_widget_show_all (button);
 
diff --git a/libgimp/gimppaletteselectbutton.h b/libgimp/gimppaletteselectbutton.h
index 15d411a9a6..23cf63264e 100644
--- a/libgimp/gimppaletteselectbutton.h
+++ b/libgimp/gimppaletteselectbutton.h
@@ -40,11 +40,14 @@ G_BEGIN_DECLS
 #define GIMP_PALETTE_SELECT_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GIMP_TYPE_PALETTE_SELECT_BUTTON, GimpPaletteSelectButtonClass))
 
 
-typedef struct _GimpPaletteSelectButtonClass  GimpPaletteSelectButtonClass;
+typedef struct _GimpPaletteSelectButtonPrivate GimpPaletteSelectButtonPrivate;
+typedef struct _GimpPaletteSelectButtonClass   GimpPaletteSelectButtonClass;
 
 struct _GimpPaletteSelectButton
 {
-  GimpSelectButton  parent_instance;
+  GimpSelectButton                parent_instance;
+
+  GimpPaletteSelectButtonPrivate *priv;
 };
 
 struct _GimpPaletteSelectButtonClass
@@ -61,6 +64,10 @@ struct _GimpPaletteSelectButtonClass
   void (*_gimp_reserved2) (void);
   void (*_gimp_reserved3) (void);
   void (*_gimp_reserved4) (void);
+  void (*_gimp_reserved5) (void);
+  void (*_gimp_reserved6) (void);
+  void (*_gimp_reserved7) (void);
+  void (*_gimp_reserved8) (void);
 };
 
 
diff --git a/libgimp/gimppatternselectbutton.c b/libgimp/gimppatternselectbutton.c
index 6d31dca6fe..fabc9e2bde 100644
--- a/libgimp/gimppatternselectbutton.c
+++ b/libgimp/gimppatternselectbutton.c
@@ -47,9 +47,7 @@
 #define CELL_SIZE 20
 
 
-#define GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpPatternSelectButtonPrivate *) 
gimp_pattern_select_button_get_instance_private ((GimpPatternSelectButton *) (obj)))
-
-typedef struct _GimpPatternSelectButtonPrivate GimpPatternSelectButtonPrivate;
+#define GET_PRIVATE(obj) (((GimpPatternSelectButtonPrivate *) (obj))->priv)
 
 struct _GimpPatternSelectButtonPrivate
 {
@@ -137,6 +135,7 @@ static guint pattern_button_signals[LAST_SIGNAL] = { 0 };
 G_DEFINE_TYPE_WITH_PRIVATE (GimpPatternSelectButton, gimp_pattern_select_button,
                             GIMP_TYPE_SELECT_BUTTON)
 
+
 static void
 gimp_pattern_select_button_class_init (GimpPatternSelectButtonClass *klass)
 {
@@ -213,23 +212,20 @@ gimp_pattern_select_button_class_init (GimpPatternSelectButtonClass *klass)
 static void
 gimp_pattern_select_button_init (GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-  gint                            mask_data_size;
+  gint mask_data_size;
 
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+  button->priv = gimp_pattern_select_button_get_instance_private (button);
 
-  priv->pattern_name = gimp_context_get_pattern ();
-  gimp_pattern_get_pixels (priv->pattern_name,
-                           &priv->width,
-                           &priv->height,
-                           &priv->bytes,
+  button->priv->pattern_name = gimp_context_get_pattern ();
+  gimp_pattern_get_pixels (button->priv->pattern_name,
+                           &button->priv->width,
+                           &button->priv->height,
+                           &button->priv->bytes,
                            &mask_data_size,
-                           &priv->mask_data);
+                           &button->priv->mask_data);
 
-  priv->inside = gimp_pattern_select_button_create_inside (button);
-  gtk_container_add (GTK_CONTAINER (button), priv->inside);
-
-  priv->popup = NULL;
+  button->priv->inside = gimp_pattern_select_button_create_inside (button);
+  gtk_container_add (GTK_CONTAINER (button), button->priv->inside);
 }
 
 /**
@@ -277,12 +273,9 @@ gimp_pattern_select_button_new (const gchar *title,
 const gchar *
 gimp_pattern_select_button_get_pattern (GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-
   g_return_val_if_fail (GIMP_IS_PATTERN_SELECT_BUTTON (button), NULL);
 
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
-  return priv->pattern_name;
+  return button->priv->pattern_name;
 }
 
 /**
@@ -346,13 +339,11 @@ gimp_pattern_select_button_set_pattern (GimpPatternSelectButton *button,
 static void
 gimp_pattern_select_button_finalize (GObject *object)
 {
-  GimpPatternSelectButtonPrivate *priv;
+  GimpPatternSelectButton *button = GIMP_PATTERN_SELECT_BUTTON (object);
 
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (object);
-
-  g_clear_pointer (&priv->pattern_name, g_free);
-  g_clear_pointer (&priv->mask_data,    g_free);
-  g_clear_pointer (&priv->title,        g_free);
+  g_clear_pointer (&button->priv->pattern_name, g_free);
+  g_clear_pointer (&button->priv->mask_data,    g_free);
+  g_clear_pointer (&button->priv->title,        g_free);
 
   G_OBJECT_CLASS (gimp_pattern_select_button_parent_class)->finalize (object);
 }
@@ -363,21 +354,19 @@ gimp_pattern_select_button_set_property (GObject      *object,
                                          const GValue *value,
                                          GParamSpec   *pspec)
 {
-  GimpPatternSelectButton        *button;
-  GimpPatternSelectButtonPrivate *priv;
-
-  button = GIMP_PATTERN_SELECT_BUTTON (object);
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+  GimpPatternSelectButton *button = GIMP_PATTERN_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_PATTERN_NAME:
       gimp_pattern_select_button_set_pattern (button,
                                               g_value_get_string (value));
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -390,20 +379,18 @@ gimp_pattern_select_button_get_property (GObject    *object,
                                          GValue     *value,
                                          GParamSpec *pspec)
 {
-  GimpPatternSelectButton        *button;
-  GimpPatternSelectButtonPrivate *priv;
-
-  button = GIMP_PATTERN_SELECT_BUTTON (object);
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+  GimpPatternSelectButton *button = GIMP_PATTERN_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_PATTERN_NAME:
-      g_value_set_string (value, priv->pattern_name);
+      g_value_set_string (value, button->priv->pattern_name);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -419,25 +406,19 @@ gimp_pattern_select_button_callback (const gchar  *pattern_name,
                                      gboolean      dialog_closing,
                                      gpointer      user_data)
 {
-  GimpPatternSelectButton        *button;
-  GimpPatternSelectButtonPrivate *priv;
-  GimpSelectButton               *select_button;
-
-  button = GIMP_PATTERN_SELECT_BUTTON (user_data);
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
-  select_button = GIMP_SELECT_BUTTON (button);
+  GimpPatternSelectButton *button        = user_data;
+  GimpSelectButton        *select_button = GIMP_SELECT_BUTTON (button);
 
-  g_free (priv->pattern_name);
-  g_free (priv->mask_data);
+  g_free (button->priv->pattern_name);
+  g_free (button->priv->mask_data);
 
-  priv->pattern_name = g_strdup (pattern_name);
-  priv->width        = width;
-  priv->height       = height;
-  priv->bytes        = bytes;
-  priv->mask_data    = g_memdup (mask_data, width * height * bytes);
+  button->priv->pattern_name = g_strdup (pattern_name);
+  button->priv->width        = width;
+  button->priv->height       = height;
+  button->priv->bytes        = bytes;
+  button->priv->mask_data    = g_memdup (mask_data, width * height * bytes);
 
-  gimp_pattern_select_preview_update (priv->preview,
+  gimp_pattern_select_preview_update (button->priv->preview,
                                       width, height, bytes, mask_data);
 
   if (dialog_closing)
@@ -451,22 +432,19 @@ gimp_pattern_select_button_callback (const gchar  *pattern_name,
 static void
 gimp_pattern_select_button_clicked (GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-  GimpSelectButton               *select_button;
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
-  select_button = GIMP_SELECT_BUTTON (button);
+  GimpSelectButton *select_button = GIMP_SELECT_BUTTON (button);
 
   if (select_button->temp_callback)
     {
       /*  calling gimp_patterns_set_popup() raises the dialog  */
       gimp_patterns_set_popup (select_button->temp_callback,
-                               priv->pattern_name);
+                               button->priv->pattern_name);
     }
   else
     {
       select_button->temp_callback =
-        gimp_pattern_select_new (priv->title, priv->pattern_name,
+        gimp_pattern_select_new (button->priv->title,
+                                 button->priv->pattern_name,
                                  gimp_pattern_select_button_callback,
                                  button, NULL);
     }
@@ -475,16 +453,12 @@ gimp_pattern_select_button_clicked (GimpPatternSelectButton *button)
 static void
 gimp_pattern_select_preview_resize (GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
-
-  if (priv->width > 0 && priv->height > 0)
-    gimp_pattern_select_preview_update (priv->preview,
-                                        priv->width,
-                                        priv->height,
-                                        priv->bytes,
-                                        priv->mask_data);
+  if (button->priv->width > 0 && button->priv->height > 0)
+    gimp_pattern_select_preview_update (button->priv->preview,
+                                        button->priv->width,
+                                        button->priv->height,
+                                        button->priv->bytes,
+                                        button->priv->mask_data);
 }
 
 static gboolean
@@ -492,12 +466,9 @@ gimp_pattern_select_preview_events (GtkWidget               *widget,
                                     GdkEvent                *event,
                                     GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-  GdkEventButton                 *bevent;
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+  GdkEventButton *bevent;
 
-  if (priv->mask_data)
+  if (button->priv->mask_data)
     {
       switch (event->type)
         {
@@ -561,7 +532,7 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
                                        gint                     x,
                                        gint                     y)
 {
-  GimpPatternSelectButtonPrivate *priv;
+  GimpPatternSelectButtonPrivate *priv = button->priv;
   GtkWidget                      *frame;
   GtkWidget                      *preview;
   GdkMonitor                    *monitor;
@@ -569,8 +540,6 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
   gint                            x_org;
   gint                            y_org;
 
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
-
   if (priv->popup)
     gimp_pattern_select_button_close_popup (button);
 
@@ -620,15 +589,7 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
 static void
 gimp_pattern_select_button_close_popup (GimpPatternSelectButton *button)
 {
-  GimpPatternSelectButtonPrivate *priv;
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_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
@@ -673,12 +634,10 @@ gimp_pattern_select_drag_data_received (GimpPatternSelectButton *button,
 static GtkWidget *
 gimp_pattern_select_button_create_inside (GimpPatternSelectButton *pattern_button)
 {
+  GimpPatternSelectButtonPrivate *priv = pattern_button->priv;
   GtkWidget                      *hbox;
   GtkWidget                      *frame;
   GtkWidget                      *button;
-  GimpPatternSelectButtonPrivate *priv;
-
-  priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (pattern_button);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
 
diff --git a/libgimp/gimppatternselectbutton.h b/libgimp/gimppatternselectbutton.h
index 934a402a1d..202f6920e9 100644
--- a/libgimp/gimppatternselectbutton.h
+++ b/libgimp/gimppatternselectbutton.h
@@ -40,11 +40,14 @@ G_BEGIN_DECLS
 #define GIMP_PATTERN_SELECT_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GIMP_TYPE_PATTERN_SELECT_BUTTON, GimpPatternSelectButtonClass))
 
 
+typedef struct _GimpPatternSelectButtonPrivate GimpPatternSelectButtonPrivate;
 typedef struct _GimpPatternSelectButtonClass   GimpPatternSelectButtonClass;
 
 struct _GimpPatternSelectButton
 {
-  GimpSelectButton  parent_instance;
+  GimpSelectButton                parent_instance;
+
+  GimpPatternSelectButtonPrivate *priv;
 };
 
 struct _GimpPatternSelectButtonClass
@@ -65,6 +68,10 @@ struct _GimpPatternSelectButtonClass
   void (*_gimp_reserved2) (void);
   void (*_gimp_reserved3) (void);
   void (*_gimp_reserved4) (void);
+  void (*_gimp_reserved5) (void);
+  void (*_gimp_reserved6) (void);
+  void (*_gimp_reserved7) (void);
+  void (*_gimp_reserved8) (void);
 };
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]