[gegl] gegl: don't use g_type_class_add_private() ...



commit 040e9490b9128955f32ba79de64c9797cc385206
Author: Ell <ell_se yahoo com>
Date:   Thu Sep 20 11:15:56 2018 -0400

    gegl: don't use g_type_class_add_private() ...
    
    ... and G_TYPE_INSTANCE_GET_PRIVATE()
    
    g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
    deprecated in GLib 2.58.  Instead, use
    G_DEFINE_TYPE_WITH_PRIVATE(), and G_ADD_PRIVATE(), and the
    implictly-defined foo_get_instance_private() functions, all of
    which are available in the GLib version we depend on.

 gegl/buffer/gegl-tile-backend.c           |  9 +++------
 gegl/buffer/gegl-tile-handler.c           |  9 +++------
 gegl/gegl-dot-visitor.c                   | 10 +++-------
 gegl/gegl-dot-visitor.h                   |  8 ++++----
 gegl/graph/gegl-node.c                    |  7 ++-----
 gegl/operation/gegl-operation-temporal.c  |  9 +++------
 gegl/property-types/gegl-audio-fragment.c |  7 +++----
 gegl/property-types/gegl-color.c          |  6 ++----
 gegl/property-types/gegl-curve.c          |  8 +++-----
 gegl/property-types/gegl-path.c           |  9 ++++-----
 10 files changed, 30 insertions(+), 52 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend.c b/gegl/buffer/gegl-tile-backend.c
index 720fa5ffc..0f70dda1c 100644
--- a/gegl/buffer/gegl-tile-backend.c
+++ b/gegl/buffer/gegl-tile-backend.c
@@ -28,7 +28,8 @@
 #include "gegl-tile-backend.h"
 #include "gegl-config.h"
 
-G_DEFINE_TYPE (GeglTileBackend, gegl_tile_backend, GEGL_TYPE_TILE_SOURCE)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglTileBackend, gegl_tile_backend,
+                            GEGL_TYPE_TILE_SOURCE)
 
 #define parent_class gegl_tile_backend_parent_class
 
@@ -256,16 +257,12 @@ gegl_tile_backend_class_init (GeglTileBackendClass *klass)
                                                          "Cache tiles will be flushed before the backend is 
destroyed",
                                                          TRUE,
                                                          G_PARAM_READWRITE));
-
-  g_type_class_add_private (gobject_class, sizeof (GeglTileBackendPrivate));
 }
 
 static void
 gegl_tile_backend_init (GeglTileBackend *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                            GEGL_TYPE_TILE_BACKEND,
-                                            GeglTileBackendPrivate);
+  self->priv = gegl_tile_backend_get_instance_private (self);
   self->priv->shared = FALSE;
   self->priv->flush_on_destroy = TRUE;
 }
diff --git a/gegl/buffer/gegl-tile-handler.c b/gegl/buffer/gegl-tile-handler.c
index 2c09ec60a..bc87a6138 100644
--- a/gegl/buffer/gegl-tile-handler.c
+++ b/gegl/buffer/gegl-tile-handler.c
@@ -35,7 +35,8 @@ struct _GeglTileHandlerPrivate
   GeglTileHandlerCache *cache;
 };
 
-G_DEFINE_TYPE (GeglTileHandler, gegl_tile_handler, GEGL_TYPE_TILE_SOURCE)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglTileHandler, gegl_tile_handler,
+                            GEGL_TYPE_TILE_SOURCE)
 
 enum
 {
@@ -128,8 +129,6 @@ gegl_tile_handler_class_init (GeglTileHandlerClass *klass)
                                                         G_TYPE_OBJECT,
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT));
-
-  g_type_class_add_private (gobject_class, sizeof (GeglTileHandlerPrivate));
 }
 
 static void
@@ -137,9 +136,7 @@ gegl_tile_handler_init (GeglTileHandler *self)
 {
   ((GeglTileSource *) self)->command = gegl_tile_handler_command;
 
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                            GEGL_TYPE_TILE_HANDLER,
-                                            GeglTileHandlerPrivate);
+  self->priv = gegl_tile_handler_get_instance_private (self);
 }
 
 void
diff --git a/gegl/gegl-dot-visitor.c b/gegl/gegl-dot-visitor.c
index 55b1e7d11..003c11a94 100644
--- a/gegl/gegl-dot-visitor.c
+++ b/gegl/gegl-dot-visitor.c
@@ -29,7 +29,7 @@
 #include "graph/gegl-visitable.h"
 
 
-struct _GeglDotVisitorPriv
+struct _GeglDotVisitorPrivate
 {
   GString *string_to_append;
 };
@@ -42,7 +42,7 @@ static gboolean   gegl_dot_visitor_visit_pad  (GeglVisitor         *self,
                                                GeglPad             *pad);
 
 
-G_DEFINE_TYPE (GeglDotVisitor, gegl_dot_visitor, GEGL_TYPE_VISITOR)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglDotVisitor, gegl_dot_visitor, GEGL_TYPE_VISITOR)
 
 
 static void
@@ -52,16 +52,12 @@ gegl_dot_visitor_class_init (GeglDotVisitorClass *klass)
 
   visitor_class->visit_node = gegl_dot_visitor_visit_node;
   visitor_class->visit_pad = gegl_dot_visitor_visit_pad;
-
-  g_type_class_add_private (klass, sizeof (GeglDotVisitorPriv));
 }
 
 static void
 gegl_dot_visitor_init (GeglDotVisitor *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                            GEGL_TYPE_DOT_VISITOR,
-                                            GeglDotVisitorPriv);
+  self->priv = gegl_dot_visitor_get_instance_private (self);
 }
 
 void
diff --git a/gegl/gegl-dot-visitor.h b/gegl/gegl-dot-visitor.h
index 83dc7eba8..87a95be0a 100644
--- a/gegl/gegl-dot-visitor.h
+++ b/gegl/gegl-dot-visitor.h
@@ -31,14 +31,14 @@ G_BEGIN_DECLS
 #define GEGL_IS_DOT_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_DOT_VISITOR))
 #define GEGL_DOT_VISITOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_DOT_VISITOR, 
GeglDotVisitorClass))
 
-typedef struct _GeglDotVisitorPriv GeglDotVisitorPriv;
-typedef struct _GeglDotVisitorClass GeglDotVisitorClass;
+typedef struct _GeglDotVisitorPrivate GeglDotVisitorPrivate;
+typedef struct _GeglDotVisitorClass   GeglDotVisitorClass;
 
 struct _GeglDotVisitor
 {
-  GeglVisitor         parent_instance;
+  GeglVisitor            parent_instance;
 
-  GeglDotVisitorPriv *priv;
+  GeglDotVisitorPrivate *priv;
 };
 
 struct _GeglDotVisitorClass
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 8c92ae365..9803ad6db 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -121,6 +121,7 @@ static void            gegl_node_update_debug_name        (GeglNode *node);
 
 
 G_DEFINE_TYPE_WITH_CODE (GeglNode, gegl_node, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GeglNode)
                          G_IMPLEMENT_INTERFACE (GEGL_TYPE_VISITABLE,
                                                 gegl_node_visitable_iface_init))
 
@@ -130,8 +131,6 @@ gegl_node_class_init (GeglNodeClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GeglNodePrivate));
-
   gobject_class->finalize     = gegl_node_finalize;
   gobject_class->dispose      = gegl_node_dispose;
   gobject_class->set_property = gegl_node_local_set_property;
@@ -219,9 +218,7 @@ gegl_node_class_init (GeglNodeClass *klass)
 static void
 gegl_node_init (GeglNode *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                            GEGL_TYPE_NODE,
-                                            GeglNodePrivate);
+  self->priv = gegl_node_get_instance_private (self);
 
   self->pads             = NULL;
   self->input_pads       = NULL;
diff --git a/gegl/operation/gegl-operation-temporal.c b/gegl/operation/gegl-operation-temporal.c
index 4347da52c..7e0a3db62 100644
--- a/gegl/operation/gegl-operation-temporal.c
+++ b/gegl/operation/gegl-operation-temporal.c
@@ -38,12 +38,11 @@ struct _GeglOperationTemporalPrivate
 
 static void gegl_operation_temporal_prepare (GeglOperation *operation);
 
-G_DEFINE_TYPE (GeglOperationTemporal,
-               gegl_operation_temporal,
-               GEGL_TYPE_OPERATION_FILTER)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglOperationTemporal, gegl_operation_temporal,
+                            GEGL_TYPE_OPERATION_FILTER)
 
 #define GEGL_OPERATION_TEMPORAL_GET_PRIVATE(obj) \
-  G_TYPE_INSTANCE_GET_PRIVATE (obj, GEGL_TYPE_OPERATION_TEMPORAL, GeglOperationTemporalPrivate)
+  ((GeglOperationTemporalPrivate *) gegl_operation_temporal_get_instance_private ((GeglOperationTemporal *) 
(obj)))
 
 
 
@@ -127,8 +126,6 @@ gegl_operation_temporal_class_init (GeglOperationTemporalClass *klass)
 
   operation_class->prepare = gegl_operation_temporal_prepare;
   operation_filter_class->process = gegl_operation_temporal_process;
-
-  g_type_class_add_private (klass, sizeof (GeglOperationTemporalPrivate));
 }
 
 static void
diff --git a/gegl/property-types/gegl-audio-fragment.c b/gegl/property-types/gegl-audio-fragment.c
index 4fac57565..394752269 100644
--- a/gegl/property-types/gegl-audio-fragment.c
+++ b/gegl/property-types/gegl-audio-fragment.c
@@ -47,7 +47,8 @@ static void      get_property (GObject    *gobject,
                                GValue     *value,
                                GParamSpec *pspec);
 
-G_DEFINE_TYPE (GeglAudioFragment, gegl_audio_fragment, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglAudioFragment, gegl_audio_fragment,
+                            G_TYPE_OBJECT)
 
 
 static void deallocate_data (GeglAudioFragment *audio)
@@ -77,7 +78,7 @@ static void allocate_data (GeglAudioFragment *audio)
 static void
 gegl_audio_fragment_init (GeglAudioFragment *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), GEGL_TYPE_AUDIO_FRAGMENT, GeglAudioFragmentPrivate);
+  self->priv = gegl_audio_fragment_get_instance_private ((self));
   self->priv->max_samples = GEGL_MAX_AUDIO_SAMPLES;
   allocate_data (self);
 }
@@ -104,8 +105,6 @@ gegl_audio_fragment_class_init (GeglAudioFragmentClass *klass)
                                                         "A String representation of the GeglAudioFragment",
                                                         "",
                                                         G_PARAM_READWRITE));
-
-  g_type_class_add_private (klass, sizeof (GeglAudioFragmentPrivate));
 }
 
 static void
diff --git a/gegl/property-types/gegl-color.c b/gegl/property-types/gegl-color.c
index 035c2495d..d18240ba9 100644
--- a/gegl/property-types/gegl-color.c
+++ b/gegl/property-types/gegl-color.c
@@ -95,13 +95,13 @@ static const gfloat parsing_error_color[4] = { 0.f, 1.f, 1.f, 0.67f };
 /* Copied into all GeglColor:s at their instantiation. */
 static const gfloat init_color[4] = { 1.f, 1.f, 1.f, 1.f };
 
-G_DEFINE_TYPE (GeglColor, gegl_color, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglColor, gegl_color, G_TYPE_OBJECT)
 
 
 static void
 gegl_color_init (GeglColor *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), GEGL_TYPE_COLOR, GeglColorPrivate);
+  self->priv = gegl_color_get_instance_private ((self));
 
   memcpy (self->priv->rgba_color, init_color, sizeof (init_color));
 }
@@ -120,8 +120,6 @@ gegl_color_class_init (GeglColorClass *klass)
                                                         "A String representation of the GeglColor",
                                                         "",
                                                         G_PARAM_READWRITE));
-
-  g_type_class_add_private (klass, sizeof (GeglColorPrivate));
 }
 
 static gboolean
diff --git a/gegl/property-types/gegl-curve.c b/gegl/property-types/gegl-curve.c
index 8f8c86342..207014190 100644
--- a/gegl/property-types/gegl-curve.c
+++ b/gegl/property-types/gegl-curve.c
@@ -64,10 +64,10 @@ static void get_property (GObject      *gobject,
                           GValue       *value,
                           GParamSpec   *pspec);
 
-G_DEFINE_TYPE (GeglCurve, gegl_curve, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GeglCurve, gegl_curve, G_TYPE_OBJECT)
 
-#define GEGL_CURVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),\
-                                   GEGL_TYPE_CURVE, GeglCurvePrivate))
+#define GEGL_CURVE_GET_PRIVATE(o) \
+  ((GeglCurvePrivate *) gegl_curve_get_instance_private ((GeglCurve *) (o)))
 
 static void
 gegl_curve_init (GeglCurve *self)
@@ -89,8 +89,6 @@ gegl_curve_class_init (GeglCurveClass *klass)
   gobject_class->finalize     = finalize;
   gobject_class->set_property = set_property;
   gobject_class->get_property = get_property;
-
-  g_type_class_add_private (klass, sizeof (GeglCurvePrivate));
 }
 
 static void
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index 95d530e24..6a08cb5e1 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -60,9 +60,10 @@ struct _GeglPathPrivate
 
 typedef struct _GeglPathPrivate  GeglPathPrivate;
 
-G_DEFINE_TYPE (GeglPath, gegl_path, G_TYPE_OBJECT)
-#define GEGL_PATH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),\
-                                   GEGL_TYPE_PATH, GeglPathPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (GeglPath, gegl_path, G_TYPE_OBJECT)
+
+#define GEGL_PATH_GET_PRIVATE(o) \
+  ((GeglPathPrivate *) gegl_path_get_instance_private ((GeglPath *) (o)))
 
 enum
 {
@@ -205,8 +206,6 @@ gegl_path_class_init (GeglPathClass *klass)
   gobject_class->set_property = set_property;
   gobject_class->get_property = get_property;
 
-  g_type_class_add_private (klass, sizeof (GeglPathPrivate));
-
   gegl_path_signals[GEGL_PATH_CHANGED] =
     g_signal_new ("changed", G_TYPE_FROM_CLASS (klass),
                   G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,


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