[gimp] libgimp: add instance-private struct to all new objects
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: add instance-private struct to all new objects
- Date: Tue, 27 Aug 2019 14:47:41 +0000 (UTC)
commit f57725a96a34310bccccfb144f28a6eedecd1d76
Author: Michael Natterer <mitch gimp org>
Date: Tue Aug 27 16:47:17 2019 +0200
libgimp: add instance-private struct to all new objects
Just in case we need it later.
libgimp/gimpchannel.c | 10 +++++++++-
libgimp/gimpchannel.h | 8 ++++++--
libgimp/gimpdisplay.c | 16 ++++++++--------
libgimp/gimpdisplay.h | 5 +++--
libgimp/gimpdrawable.c | 10 +++++++++-
libgimp/gimpdrawable.h | 7 ++++++-
libgimp/gimpimage.c | 16 ++++++++--------
libgimp/gimpimage.h | 3 ++-
libgimp/gimpitem.c | 16 ++++++++--------
libgimp/gimpitem.h | 8 ++++----
libgimp/gimplayer.c | 10 ++++++++--
libgimp/gimplayer.h | 5 +++--
libgimp/gimplayermask.c | 10 +++++++++-
libgimp/gimplayermask.h | 8 +++++---
libgimp/gimpselection.c | 18 +++++++++++++-----
libgimp/gimpselection.h | 6 ++++--
libgimp/gimpvectors.c | 10 +++++++++-
libgimp/gimpvectors.h | 8 ++++++--
18 files changed, 120 insertions(+), 54 deletions(-)
---
diff --git a/libgimp/gimpchannel.c b/libgimp/gimpchannel.c
index dd865a1ecc..6bb657b5eb 100644
--- a/libgimp/gimpchannel.c
+++ b/libgimp/gimpchannel.c
@@ -23,10 +23,17 @@
#include "gimp.h"
-G_DEFINE_TYPE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE)
+struct _GimpChannelPrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE)
#define parent_class gimp_drawable_parent_class
+
static void
gimp_channel_class_init (GimpChannelClass *klass)
{
@@ -35,6 +42,7 @@ gimp_channel_class_init (GimpChannelClass *klass)
static void
gimp_channel_init (GimpChannel *channel)
{
+ channel->priv = gimp_channel_get_instance_private (channel);
}
/**
diff --git a/libgimp/gimpchannel.h b/libgimp/gimpchannel.h
index d286cffd24..4b9557fbe3 100644
--- a/libgimp/gimpchannel.h
+++ b/libgimp/gimpchannel.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
#include <libgimp/gimpdrawable.h>
+
#define GIMP_TYPE_CHANNEL (gimp_channel_get_type ())
#define GIMP_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL, GimpChannel))
#define GIMP_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL, GimpChannelClass))
@@ -40,10 +41,13 @@ G_BEGIN_DECLS
typedef struct _GimpChannelClass GimpChannelClass;
+typedef struct _GimpChannelPrivate GimpChannelPrivate;
struct _GimpChannel
{
- GimpDrawable parent_instance;
+ GimpDrawable parent_instance;
+
+ GimpChannelPrivate *priv;
};
struct _GimpChannelClass
@@ -59,7 +63,6 @@ struct _GimpChannelClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
@@ -72,6 +75,7 @@ GimpChannel * gimp_channel_new (GimpImage *image,
gdouble opacity,
const GimpRGB *color);
+
G_END_DECLS
#endif /* __GIMP_CHANNEL_H__ */
diff --git a/libgimp/gimpdisplay.c b/libgimp/gimpdisplay.c
index fe971cc3d1..af6ea38deb 100644
--- a/libgimp/gimpdisplay.c
+++ b/libgimp/gimpdisplay.c
@@ -43,14 +43,14 @@ struct _GimpDisplayPrivate
};
-static void gimp_display_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_display_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+static void gimp_display_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_display_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
G_DEFINE_TYPE_WITH_PRIVATE (GimpDisplay, gimp_display, G_TYPE_OBJECT)
diff --git a/libgimp/gimpdisplay.h b/libgimp/gimpdisplay.h
index 7abfb0b053..8b91dfd3f1 100644
--- a/libgimp/gimpdisplay.h
+++ b/libgimp/gimpdisplay.h
@@ -28,6 +28,7 @@
G_BEGIN_DECLS
+
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
@@ -43,7 +44,7 @@ typedef struct _GimpDisplayPrivate GimpDisplayPrivate;
struct _GimpDisplay
{
- GObject parent_instance;
+ GObject parent_instance;
GimpDisplayPrivate *priv;
};
@@ -61,9 +62,9 @@ struct _GimpDisplayClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
+
GType gimp_display_get_type (void) G_GNUC_CONST;
gint32 gimp_display_get_id (GimpDisplay *display);
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
index 54c744bbbf..c5146c14fa 100644
--- a/libgimp/gimpdrawable.c
+++ b/libgimp/gimpdrawable.c
@@ -26,10 +26,17 @@
#include "gimptilebackendplugin.h"
-G_DEFINE_ABSTRACT_TYPE (GimpDrawable, gimp_drawable, GIMP_TYPE_ITEM)
+struct _GimpDrawablePrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpDrawable, gimp_drawable, GIMP_TYPE_ITEM)
#define parent_class gimp_drawable_parent_class
+
static void
gimp_drawable_class_init (GimpDrawableClass *klass)
{
@@ -38,6 +45,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
static void
gimp_drawable_init (GimpDrawable *drawable)
{
+ drawable->priv = gimp_drawable_get_instance_private (drawable);
}
diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h
index 607eec47f9..8359394595 100644
--- a/libgimp/gimpdrawable.h
+++ b/libgimp/gimpdrawable.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+
#include <libgimp/gimpitem.h>
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
@@ -40,10 +41,13 @@ G_BEGIN_DECLS
typedef struct _GimpDrawableClass GimpDrawableClass;
+typedef struct _GimpDrawablePrivate GimpDrawablePrivate;
struct _GimpDrawable
{
- GimpItem parent_instance;
+ GimpItem parent_instance;
+
+ GimpDrawablePrivate *priv;
};
struct _GimpDrawableClass
@@ -62,6 +66,7 @@ struct _GimpDrawableClass
void (*_gimp_reserved9) (void);
};
+
GType gimp_drawable_get_type (void) G_GNUC_CONST;
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c
index ca3986a285..8338de172a 100644
--- a/libgimp/gimpimage.c
+++ b/libgimp/gimpimage.c
@@ -43,14 +43,14 @@ struct _GimpImagePrivate
};
-static void gimp_image_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_image_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+static void gimp_image_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_image_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
G_DEFINE_TYPE_WITH_PRIVATE (GimpImage, gimp_image, G_TYPE_OBJECT)
diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h
index 4f6cbee389..75afd24543 100644
--- a/libgimp/gimpimage.h
+++ b/libgimp/gimpimage.h
@@ -27,6 +27,7 @@
G_BEGIN_DECLS
+
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_IMAGE (gimp_image_get_type ())
@@ -60,9 +61,9 @@ struct _GimpImageClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
+
GType gimp_image_get_type (void) G_GNUC_CONST;
gint32 gimp_image_get_id (GimpImage *image);
diff --git a/libgimp/gimpitem.c b/libgimp/gimpitem.c
index 25deef248a..4d16574ce8 100644
--- a/libgimp/gimpitem.c
+++ b/libgimp/gimpitem.c
@@ -43,14 +43,14 @@ struct _GimpItemPrivate
};
-static void gimp_item_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_item_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+static void gimp_item_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_item_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpItem, gimp_item, G_TYPE_OBJECT)
diff --git a/libgimp/gimpitem.h b/libgimp/gimpitem.h
index 4bb4a6af73..743583a02e 100644
--- a/libgimp/gimpitem.h
+++ b/libgimp/gimpitem.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+
#define GIMP_TYPE_ITEM (gimp_item_get_type ())
#define GIMP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM, GimpItem))
#define GIMP_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM, GimpItemClass))
@@ -61,13 +62,13 @@ struct _GimpItemClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
+
GType gimp_item_get_type (void) G_GNUC_CONST;
-gint32 gimp_item_get_id (GimpItem *item);
-GimpItem * gimp_item_get_by_id (gint32 item_id);
+gint32 gimp_item_get_id (GimpItem *item);
+GimpItem * gimp_item_get_by_id (gint32 item_id);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
@@ -81,7 +82,6 @@ GList * gimp_item_list_children (GimpItem *item);
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
-
gint * gimp_item_get_children_deprecated (gint32 item_id,
gint *num_children);
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
index 56bb4497b8..def792bd47 100644
--- a/libgimp/gimplayer.c
+++ b/libgimp/gimplayer.c
@@ -25,7 +25,13 @@
#include "gimp.h"
-G_DEFINE_TYPE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
+struct _GimpLayerPrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
#define parent_class gimp_layer_parent_class
@@ -38,12 +44,12 @@ gimp_layer_class_init (GimpLayerClass *klass)
static void
gimp_layer_init (GimpLayer *layer)
{
+ layer->priv = gimp_layer_get_instance_private (layer);
}
/* Public API. */
-
/**
* gimp_layer_new:
* @image: The image to which to add the layer.
diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h
index ccf95a42ca..7fe5bd9c8c 100644
--- a/libgimp/gimplayer.h
+++ b/libgimp/gimplayer.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+
#define GIMP_TYPE_LAYER (gimp_layer_get_type ())
#define GIMP_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER, GimpLayer))
#define GIMP_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER, GimpLayerClass))
@@ -43,6 +44,8 @@ typedef struct _GimpLayerPrivate GimpLayerPrivate;
struct _GimpLayer
{
GimpDrawable parent_instance;
+
+ GimpLayerPrivate *priv;
};
struct _GimpLayerClass
@@ -58,7 +61,6 @@ struct _GimpLayerClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
@@ -97,7 +99,6 @@ GimpLayer * gimp_layer_copy (GimpLayer *layer);
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
-
gint32 gimp_layer_new_deprecated (gint32 image_id,
const gchar *name,
gint width,
diff --git a/libgimp/gimplayermask.c b/libgimp/gimplayermask.c
index dd04bb7476..d955facbde 100644
--- a/libgimp/gimplayermask.c
+++ b/libgimp/gimplayermask.c
@@ -24,10 +24,17 @@
#include "gimp.h"
-G_DEFINE_TYPE (GimpLayerMask, gimp_layer_mask, GIMP_TYPE_CHANNEL)
+struct _GimpLayerMaskPrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpLayerMask, gimp_layer_mask, GIMP_TYPE_CHANNEL)
#define parent_class gimp_layer_mask_parent_class
+
static void
gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
{
@@ -36,4 +43,5 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
static void
gimp_layer_mask_init (GimpLayerMask *layer_mask)
{
+ layer_mask->priv = gimp_layer_mask_get_instance_private (layer_mask);
}
diff --git a/libgimp/gimplayermask.h b/libgimp/gimplayermask.h
index 8796841d93..90fa951e9b 100644
--- a/libgimp/gimplayermask.h
+++ b/libgimp/gimplayermask.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+
#define GIMP_TYPE_LAYER_MASK (gimp_layer_mask_get_type ())
#define GIMP_LAYER_MASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_MASK,
GimpLayerMask))
#define GIMP_LAYER_MASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_MASK,
GimpLayerMaskClass))
@@ -43,7 +44,9 @@ typedef struct _GimpLayerMaskPrivate GimpLayerMaskPrivate;
struct _GimpLayerMask
{
- GimpChannel parent_instance;
+ GimpChannel parent_instance;
+
+ GimpLayerMaskPrivate *priv;
};
struct _GimpLayerMaskClass
@@ -59,10 +62,9 @@ struct _GimpLayerMaskClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
-GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
+GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
G_END_DECLS
diff --git a/libgimp/gimpselection.c b/libgimp/gimpselection.c
index fb9737b286..e4a8aa7176 100644
--- a/libgimp/gimpselection.c
+++ b/libgimp/gimpselection.c
@@ -23,10 +23,17 @@
#include "gimp.h"
-G_DEFINE_TYPE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
+struct _GimpSelectionPrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
#define parent_class gimp_selection_parent_class
+
static void
gimp_selection_class_init (GimpSelectionClass *klass)
{
@@ -35,14 +42,15 @@ gimp_selection_class_init (GimpSelectionClass *klass)
static void
gimp_selection_init (GimpSelection *selection)
{
+ selection->priv = gimp_selection_get_instance_private (selection);
}
/**
* gimp_selection_float:
- * @image: ignored
+ * @image: ignored
* @drawable: The drawable from which to float selection.
- * @offx: x offset for translation.
- * @offy: y offset for translation.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
*
* Float the selection from the specified drawable with initial offsets
* as specified.
@@ -53,7 +61,7 @@ gimp_selection_init (GimpSelection *selection)
* instantiated as a floating selection. The offsets allow initial
* positioning of the new floating selection.
*
- * Returns: (transfer full): The floated layer.
+ * Returns: (transfer none): The floated layer.
*/
GimpLayer *
gimp_selection_float (GimpImage *image,
diff --git a/libgimp/gimpselection.h b/libgimp/gimpselection.h
index 93b03b3190..509ee01410 100644
--- a/libgimp/gimpselection.h
+++ b/libgimp/gimpselection.h
@@ -39,10 +39,13 @@ G_BEGIN_DECLS
typedef struct _GimpSelectionClass GimpSelectionClass;
+typedef struct _GimpSelectionPrivate GimpSelectionPrivate;
struct _GimpSelection
{
- GimpChannel parent_instance;
+ GimpChannel parent_instance;
+
+ GimpSelectionPrivate *priv;
};
struct _GimpSelectionClass
@@ -58,7 +61,6 @@ struct _GimpSelectionClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
diff --git a/libgimp/gimpvectors.c b/libgimp/gimpvectors.c
index 034e00c0e8..13402a6669 100644
--- a/libgimp/gimpvectors.c
+++ b/libgimp/gimpvectors.c
@@ -24,10 +24,17 @@
#include "gimp.h"
-G_DEFINE_TYPE (GimpVectors, gimp_vectors, GIMP_TYPE_ITEM)
+struct _GimpVectorsPrivate
+{
+ gpointer unused;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpVectors, gimp_vectors, GIMP_TYPE_ITEM)
#define parent_class gimp_vectors_parent_class
+
static void
gimp_vectors_class_init (GimpVectorsClass *klass)
{
@@ -36,4 +43,5 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
static void
gimp_vectors_init (GimpVectors *vectors)
{
+ vectors->priv = gimp_vectors_get_instance_private (vectors);
}
diff --git a/libgimp/gimpvectors.h b/libgimp/gimpvectors.h
index 5b9702542c..ff76d9a27a 100644
--- a/libgimp/gimpvectors.h
+++ b/libgimp/gimpvectors.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+
#define GIMP_TYPE_VECTORS (gimp_vectors_get_type ())
#define GIMP_VECTORS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS, GimpVectors))
#define GIMP_VECTORS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS, GimpVectorsClass))
@@ -43,7 +44,9 @@ typedef struct _GimpVectorsPrivate GimpVectorsPrivate;
struct _GimpVectors
{
- GimpItem parent_instance;
+ GimpItem parent_instance;
+
+ GimpVectorsPrivate *priv;
};
struct _GimpVectorsClass
@@ -59,11 +62,12 @@ struct _GimpVectorsClass
void (*_gimp_reserved6) (void);
void (*_gimp_reserved7) (void);
void (*_gimp_reserved8) (void);
- void (*_gimp_reserved9) (void);
};
+
GType gimp_vectors_get_type (void) G_GNUC_CONST;
+
G_END_DECLS
#endif /* __GIMP_VECTORS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]