[gimp/wip/nielsdg/gimpbject-declare-derivable: 88/88] app/core: Use G_DECLARE_DERIVABLE_TYPE() for GimpObject



commit 92c081663274a9279ee0e1f9fbc0588101608408
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Jul 30 08:38:42 2019 +0200

    app/core: Use G_DECLARE_DERIVABLE_TYPE() for GimpObject
    
    This removes quite a bit of the usual GObject boilerplate (and
    technically gives us also g_autoptr support, although that is less
    relevant for our use case). Since it's a base class, this will allow us
    to also use the `G_DECLARE_*` macros on its subtypes.

 app/core/gimpobject.h | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpobject.h b/app/core/gimpobject.h
index 839dbd5851..d0a22e199b 100644
--- a/app/core/gimpobject.h
+++ b/app/core/gimpobject.h
@@ -19,22 +19,10 @@
 #define __GIMP_OBJECT_H__
 
 
-#define GIMP_TYPE_OBJECT            (gimp_object_get_type ())
-#define GIMP_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OBJECT, GimpObject))
-#define GIMP_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OBJECT, GimpObjectClass))
-#define GIMP_IS_OBJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OBJECT))
-#define GIMP_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OBJECT))
-#define GIMP_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OBJECT, GimpObjectClass))
+#define GIMP_TYPE_OBJECT (gimp_object_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GimpObject, gimp_object, GIMP, OBJECT, GObject)
 
 
-typedef struct _GimpObjectPrivate  GimpObjectPrivate;
-typedef struct _GimpObjectClass    GimpObjectClass;
-
-struct _GimpObject
-{
-  GObject            parent_instance;
-};
-
 struct _GimpObjectClass
 {
   GObjectClass  parent_class;
@@ -49,8 +37,6 @@ struct _GimpObjectClass
 };
 
 
-GType         gimp_object_get_type        (void) G_GNUC_CONST;
-
 void          gimp_object_set_name        (GimpObject       *object,
                                            const gchar      *name);
 void          gimp_object_set_name_safe   (GimpObject       *object,


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