[gimp/wip/nielsdg/g-define-boxed-type: 13/15] app: Use G_DEFINE_BOXED_TYPE()



commit 2e7e93f0b164e7d58f91caacc2835ead5a364e24
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Wed Jul 17 06:59:53 2019 +0200

    app: Use G_DEFINE_BOXED_TYPE()
    
    This isn't any functional change, but allows us to get rid of some of
    the GObject boilerplate.

 app/core/gimpbezierdesc.c  | 13 +------------
 app/core/gimpdashpattern.c | 14 ++------------
 app/vectors/gimpanchor.c   | 13 +------------
 3 files changed, 4 insertions(+), 36 deletions(-)
---
diff --git a/app/core/gimpbezierdesc.c b/app/core/gimpbezierdesc.c
index 6047544a67..65acd9f24f 100644
--- a/app/core/gimpbezierdesc.c
+++ b/app/core/gimpbezierdesc.c
@@ -29,18 +29,7 @@
 #include "gimpboundary.h"
 
 
-GType
-gimp_bezier_desc_get_type (void)
-{
-  static GType type = 0;
-
-  if (! type)
-    type = g_boxed_type_register_static ("GimpBezierDesc",
-                                         (GBoxedCopyFunc) gimp_bezier_desc_copy,
-                                         (GBoxedFreeFunc) gimp_bezier_desc_free);
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (GimpBezierDesc, gimp_bezier_desc, gimp_bezier_desc_copy, gimp_bezier_desc_free)
 
 GimpBezierDesc *
 gimp_bezier_desc_new (cairo_path_data_t *data,
diff --git a/app/core/gimpdashpattern.c b/app/core/gimpdashpattern.c
index e9fb9fc9a2..4ed756b97a 100644
--- a/app/core/gimpdashpattern.c
+++ b/app/core/gimpdashpattern.c
@@ -30,18 +30,8 @@
 #include "gimpdashpattern.h"
 
 
-GType
-gimp_dash_pattern_get_type (void)
-{
-  static GType type = 0;
-
-  if (! type)
-    type = g_boxed_type_register_static ("GimpDashPattern",
-                                         (GBoxedCopyFunc) gimp_dash_pattern_copy,
-                                         (GBoxedFreeFunc) gimp_dash_pattern_free);
-
-  return type;
-}
+typedef GArray GimpDashPattern;
+G_DEFINE_BOXED_TYPE (GimpDashPattern, gimp_dash_pattern, gimp_dash_pattern_copy, gimp_dash_pattern_free)
 
 GArray *
 gimp_dash_pattern_new_from_preset (GimpDashPreset preset)
diff --git a/app/vectors/gimpanchor.c b/app/vectors/gimpanchor.c
index f5085cdb60..fa348ae798 100644
--- a/app/vectors/gimpanchor.c
+++ b/app/vectors/gimpanchor.c
@@ -27,18 +27,7 @@
 #include "gimpanchor.h"
 
 
-GType
-gimp_anchor_get_type (void)
-{
-  static GType anchor_type = 0;
-
-  if (!anchor_type)
-    anchor_type = g_boxed_type_register_static ("GimpAnchor",
-                                                (GBoxedCopyFunc) gimp_anchor_copy,
-                                                (GBoxedFreeFunc) gimp_anchor_free);
-
-  return anchor_type;
-}
+G_DEFINE_BOXED_TYPE (GimpAnchor, gimp_anchor, gimp_anchor_copy, gimp_anchor_free)
 
 GimpAnchor *
 gimp_anchor_new (GimpAnchorType    type,


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