[gimp/wip/nielsdg/g-define-boxed-type: 3/6] libgimpcolor: Use G_DEFINE_BOXED_TYPE()



commit 89f692cd73e6fa6963ebdedd62fb13171daeaca5
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Wed Jul 17 06:35:00 2019 +0200

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

 libgimpcolor/gimpcmyk.c | 13 +------------
 libgimpcolor/gimphsl.c  | 13 +------------
 libgimpcolor/gimphsv.c  | 13 +------------
 libgimpcolor/gimprgb.c  | 13 +------------
 4 files changed, 4 insertions(+), 48 deletions(-)
---
diff --git a/libgimpcolor/gimpcmyk.c b/libgimpcolor/gimpcmyk.c
index 28b08eb6ca..def52dddd0 100644
--- a/libgimpcolor/gimpcmyk.c
+++ b/libgimpcolor/gimpcmyk.c
@@ -43,18 +43,7 @@
 static GimpCMYK * gimp_cmyk_copy (const GimpCMYK *cmyk);
 
 
-GType
-gimp_cmyk_get_type (void)
-{
-  static GType cmyk_type = 0;
-
-  if (!cmyk_type)
-    cmyk_type = g_boxed_type_register_static ("GimpCMYK",
-                                              (GBoxedCopyFunc) gimp_cmyk_copy,
-                                              (GBoxedFreeFunc) g_free);
-
-  return cmyk_type;
-}
+G_DEFINE_BOXED_TYPE (GimpCMYK, gimp_cmyk, gimp_cmyk_copy, g_free)
 
 static GimpCMYK *
 gimp_cmyk_copy (const GimpCMYK *cmyk)
diff --git a/libgimpcolor/gimphsl.c b/libgimpcolor/gimphsl.c
index 050a40d3b5..84575edeb3 100644
--- a/libgimpcolor/gimphsl.c
+++ b/libgimpcolor/gimphsl.c
@@ -32,18 +32,7 @@
 static GimpHSL * gimp_hsl_copy (const GimpHSL *hsl);
 
 
-GType
-gimp_hsl_get_type (void)
-{
-  static GType hsl_type = 0;
-
-  if (!hsl_type)
-    hsl_type = g_boxed_type_register_static ("GimpHSL",
-                                              (GBoxedCopyFunc) gimp_hsl_copy,
-                                              (GBoxedFreeFunc) g_free);
-
-  return hsl_type;
-}
+G_DEFINE_BOXED_TYPE (GimpHSL, gimp_hsl, gimp_hsl_copy, g_free)
 
 static GimpHSL *
 gimp_hsl_copy (const GimpHSL *hsl)
diff --git a/libgimpcolor/gimphsv.c b/libgimpcolor/gimphsv.c
index 56bfbd7ed1..6cb430067f 100644
--- a/libgimpcolor/gimphsv.c
+++ b/libgimpcolor/gimphsv.c
@@ -41,18 +41,7 @@
 static GimpHSV * gimp_hsv_copy (const GimpHSV *hsv);
 
 
-GType
-gimp_hsv_get_type (void)
-{
-  static GType hsv_type = 0;
-
-  if (!hsv_type)
-    hsv_type = g_boxed_type_register_static ("GimpHSV",
-                                              (GBoxedCopyFunc) gimp_hsv_copy,
-                                              (GBoxedFreeFunc) g_free);
-
-  return hsv_type;
-}
+G_DEFINE_BOXED_TYPE (GimpHSV, gimp_hsv, gimp_hsv_copy, g_free)
 
 static GimpHSV *
 gimp_hsv_copy (const GimpHSV *hsv)
diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c
index 64c4767a1a..695d5e8b20 100644
--- a/libgimpcolor/gimprgb.c
+++ b/libgimpcolor/gimprgb.c
@@ -43,18 +43,7 @@
 static GimpRGB * gimp_rgb_copy (const GimpRGB *rgb);
 
 
-GType
-gimp_rgb_get_type (void)
-{
-  static GType rgb_type = 0;
-
-  if (!rgb_type)
-    rgb_type = g_boxed_type_register_static ("GimpRGB",
-                                             (GBoxedCopyFunc) gimp_rgb_copy,
-                                             (GBoxedFreeFunc) g_free);
-
-  return rgb_type;
-}
+G_DEFINE_BOXED_TYPE (GimpRGB, gimp_rgb, gimp_rgb_copy, g_free)
 
 void
 gimp_value_get_rgb (const GValue *value,


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