[gtk/wip/otte/listview: 3/161] gtk: Add GTK_DECLARE_EXPORTED_TYPE()



commit 72dc0cd5c35e44f62a18f769c80de9f46f964b88
Author: Benjamin Otte <otte redhat com>
Date:   Wed Dec 11 20:03:00 2019 +0100

    gtk: Add GTK_DECLARE_EXPORTED_TYPE()
    
    This is like G_DECLARE_FINAL_TYPE(), except it doesn't make the class
    struct public, so internally all the subclassing in the world can
    happen.
    
    Port The whole event controller + gesture machinery to make use of it.
    
    As a side effect, we gained a bunch of missing autocleanups.

 gtk/gtk-autocleanups.h         | 10 ----------
 gtk/gtkeventcontroller.h       | 11 +----------
 gtk/gtkeventcontrollerkey.h    | 11 +----------
 gtk/gtkeventcontrollerlegacy.h | 11 +----------
 gtk/gtkeventcontrollermotion.h | 11 +----------
 gtk/gtkeventcontrollerscroll.h | 13 ++-----------
 gtk/gtkgesture.h               | 10 +---------
 gtk/gtkgestureclick.h          | 11 +----------
 gtk/gtkgesturedrag.h           | 11 +----------
 gtk/gtkgesturelongpress.h      | 11 +----------
 gtk/gtkgesturepan.h            | 11 +----------
 gtk/gtkgesturerotate.h         | 11 +----------
 gtk/gtkgesturesingle.h         | 11 +----------
 gtk/gtkgesturestylus.h         | 11 +----------
 gtk/gtkgestureswipe.h          | 11 +----------
 gtk/gtkgesturezoom.h           | 11 +----------
 gtk/gtktypes.h                 | 20 ++++++++++++++++++++
 17 files changed, 36 insertions(+), 160 deletions(-)
---
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index 2e11f477d4..a5df67db17 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -67,7 +67,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEditable, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntry, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntryBuffer, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntryCompletion, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEventController, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkExpander, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFileChooserButton, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFileChooserDialog, g_object_unref)
@@ -82,15 +81,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFontChooserDialog, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFontChooserWidget, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFrame, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGLArea, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGesture, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureDrag, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureLongPress, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureClick, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGesturePan, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureRotate, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureSingle, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureSwipe, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureZoom, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGrid, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkHeaderBar, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkIMContext, g_object_unref)
diff --git a/gtk/gtkeventcontroller.h b/gtk/gtkeventcontroller.h
index e5a999961a..42d8dec59b 100644
--- a/gtk/gtkeventcontroller.h
+++ b/gtk/gtkeventcontroller.h
@@ -24,8 +24,6 @@
 #error "Only <gtk/gtk.h> can be included directly."
 #endif
 
-typedef struct _GtkEventControllerClass GtkEventControllerClass;
-
 #include <gdk/gdk.h>
 #include <gtk/gtktypes.h>
 #include <gtk/gtkenums.h>
@@ -33,15 +31,8 @@ typedef struct _GtkEventControllerClass GtkEventControllerClass;
 G_BEGIN_DECLS
 
 #define GTK_TYPE_EVENT_CONTROLLER         (gtk_event_controller_get_type ())
-#define GTK_EVENT_CONTROLLER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_EVENT_CONTROLLER, 
GtkEventController))
-#define GTK_EVENT_CONTROLLER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_EVENT_CONTROLLER, 
GtkEventControllerClass))
-#define GTK_IS_EVENT_CONTROLLER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_EVENT_CONTROLLER))
-#define GTK_IS_EVENT_CONTROLLER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_EVENT_CONTROLLER))
-#define GTK_EVENT_CONTROLLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_EVENT_CONTROLLER, 
GtkEventControllerClass))
-
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_event_controller_get_type       (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkEventController, gtk_event_controller, GTK, EVENT_CONTROLLER)
 
 GDK_AVAILABLE_IN_ALL
 GtkWidget  * gtk_event_controller_get_widget     (GtkEventController *controller);
diff --git a/gtk/gtkeventcontrollerkey.h b/gtk/gtkeventcontrollerkey.h
index 755947d255..293603916a 100644
--- a/gtk/gtkeventcontrollerkey.h
+++ b/gtk/gtkeventcontrollerkey.h
@@ -31,17 +31,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_EVENT_CONTROLLER_KEY         (gtk_event_controller_key_get_type ())
-#define GTK_EVENT_CONTROLLER_KEY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GTK_TYPE_EVENT_CONTROLLER_KEY, GtkEventControllerKey))
-#define GTK_EVENT_CONTROLLER_KEY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_EVENT_CONTROLLER_KEY, 
GtkEventControllerKeyClass))
-#define GTK_IS_EVENT_CONTROLLER_KEY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GTK_TYPE_EVENT_CONTROLLER_KEY))
-#define GTK_IS_EVENT_CONTROLLER_KEY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_EVENT_CONTROLLER_KEY))
-#define GTK_EVENT_CONTROLLER_KEY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GTK_TYPE_EVENT_CONTROLLER_KEY, GtkEventControllerKeyClass))
-
-typedef struct _GtkEventControllerKey GtkEventControllerKey;
-typedef struct _GtkEventControllerKeyClass GtkEventControllerKeyClass;
-
 GDK_AVAILABLE_IN_ALL
-GType               gtk_event_controller_key_get_type  (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkEventControllerKey, gtk_event_controller_key, GTK, EVENT_CONTROLLER_KEY)
 
 GDK_AVAILABLE_IN_ALL
 GtkEventController *gtk_event_controller_key_new (void);
diff --git a/gtk/gtkeventcontrollerlegacy.h b/gtk/gtkeventcontrollerlegacy.h
index 748bebb59a..5c4390dfbf 100644
--- a/gtk/gtkeventcontrollerlegacy.h
+++ b/gtk/gtkeventcontrollerlegacy.h
@@ -29,17 +29,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_EVENT_CONTROLLER_LEGACY         (gtk_event_controller_legacy_get_type ())
-#define GTK_EVENT_CONTROLLER_LEGACY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GTK_TYPE_EVENT_CONTROLLER_LEGACY, GtkEventControllerLegacy))
-#define GTK_EVENT_CONTROLLER_LEGACY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), 
GTK_TYPE_EVENT_CONTROLLER_LEGACY, GtkEventControllerLegacyClass))
-#define GTK_IS_EVENT_CONTROLLER_LEGACY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GTK_TYPE_EVENT_CONTROLLER_LEGACY))
-#define GTK_IS_EVENT_CONTROLLER_LEGACY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), 
GTK_TYPE_EVENT_CONTROLLER_LEGACY))
-#define GTK_EVENT_CONTROLLER_LEGACY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GTK_TYPE_EVENT_CONTROLLER_LEGACY, GtkEventControllerLegacyClass))
-
-typedef struct _GtkEventControllerLegacy GtkEventControllerLegacy;
-typedef struct _GtkEventControllerLegacyClass GtkEventControllerLegacyClass;
-
 GDK_AVAILABLE_IN_ALL
-GType               gtk_event_controller_legacy_get_type   (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkEventControllerLegacy, gtk_event_controller_legacy, GTK, 
EVENT_CONTROLLER_LEGACY)
 
 GDK_AVAILABLE_IN_ALL
 GtkEventController *gtk_event_controller_legacy_new        (void);
diff --git a/gtk/gtkeventcontrollermotion.h b/gtk/gtkeventcontrollermotion.h
index 05d1852986..2b0c266b81 100644
--- a/gtk/gtkeventcontrollermotion.h
+++ b/gtk/gtkeventcontrollermotion.h
@@ -30,17 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_EVENT_CONTROLLER_MOTION         (gtk_event_controller_motion_get_type ())
-#define GTK_EVENT_CONTROLLER_MOTION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GTK_TYPE_EVENT_CONTROLLER_MOTION, GtkEventControllerMotion))
-#define GTK_EVENT_CONTROLLER_MOTION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), 
GTK_TYPE_EVENT_CONTROLLER_MOTION, GtkEventControllerMotionClass))
-#define GTK_IS_EVENT_CONTROLLER_MOTION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GTK_TYPE_EVENT_CONTROLLER_MOTION))
-#define GTK_IS_EVENT_CONTROLLER_MOTION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), 
GTK_TYPE_EVENT_CONTROLLER_MOTION))
-#define GTK_EVENT_CONTROLLER_MOTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GTK_TYPE_EVENT_CONTROLLER_MOTION, GtkEventControllerMotionClass))
-
-typedef struct _GtkEventControllerMotion GtkEventControllerMotion;
-typedef struct _GtkEventControllerMotionClass GtkEventControllerMotionClass;
-
 GDK_AVAILABLE_IN_ALL
-GType               gtk_event_controller_motion_get_type (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkEventControllerMotion, gtk_event_controller_motion, GTK, 
EVENT_CONTROLLER_MOTION)
 
 GDK_AVAILABLE_IN_ALL
 GtkEventController *gtk_event_controller_motion_new      (void);
diff --git a/gtk/gtkeventcontrollerscroll.h b/gtk/gtkeventcontrollerscroll.h
index cba616dae6..45c492651d 100644
--- a/gtk/gtkeventcontrollerscroll.h
+++ b/gtk/gtkeventcontrollerscroll.h
@@ -30,14 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_EVENT_CONTROLLER_SCROLL         (gtk_event_controller_scroll_get_type ())
-#define GTK_EVENT_CONTROLLER_SCROLL(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GTK_TYPE_EVENT_CONTROLLER_SCROLL, GtkEventControllerScroll))
-#define GTK_EVENT_CONTROLLER_SCROLL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), 
GTK_TYPE_EVENT_CONTROLLER_SCROLL, GtkEventControllerScrollClass))
-#define GTK_IS_EVENT_CONTROLLER_SCROLL(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GTK_TYPE_EVENT_CONTROLLER_SCROLL))
-#define GTK_IS_EVENT_CONTROLLER_SCROLL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), 
GTK_TYPE_EVENT_CONTROLLER_SCROLL))
-#define GTK_EVENT_CONTROLLER_SCROLL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GTK_TYPE_EVENT_CONTROLLER_SCROLL, GtkEventControllerScrollClass))
-
-typedef struct _GtkEventControllerScroll GtkEventControllerScroll;
-typedef struct _GtkEventControllerScrollClass GtkEventControllerScrollClass;
+GDK_AVAILABLE_IN_ALL
+GTK_DECLARE_EXPORTED_TYPE (GtkEventControllerScroll, gtk_event_controller_scroll, GTK, 
EVENT_CONTROLLER_SCROLL)
 
 /**
  * GtkEventControllerScrollFlags:
@@ -60,9 +54,6 @@ typedef enum {
   GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES  = (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL | 
GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL),
 } GtkEventControllerScrollFlags;
 
-GDK_AVAILABLE_IN_ALL
-GType               gtk_event_controller_scroll_get_type  (void) G_GNUC_CONST;
-
 GDK_AVAILABLE_IN_ALL
 GtkEventController *gtk_event_controller_scroll_new       (GtkEventControllerScrollFlags  flags);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkgesture.h b/gtk/gtkgesture.h
index 7513853157..846b456dd1 100644
--- a/gtk/gtkgesture.h
+++ b/gtk/gtkgesture.h
@@ -30,16 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE         (gtk_gesture_get_type ())
-#define GTK_GESTURE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE, GtkGesture))
-#define GTK_GESTURE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE, GtkGestureClass))
-#define GTK_IS_GESTURE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE))
-#define GTK_IS_GESTURE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE))
-#define GTK_GESTURE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE, GtkGestureClass))
-
-typedef struct _GtkGestureClass GtkGestureClass;
-
 GDK_AVAILABLE_IN_ALL
-GType       gtk_gesture_get_type             (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGesture, gtk_gesture, GTK, GESTURE)
 
 GDK_AVAILABLE_IN_ALL
 GdkDevice * gtk_gesture_get_device           (GtkGesture       *gesture);
diff --git a/gtk/gtkgestureclick.h b/gtk/gtkgestureclick.h
index ea86fdb6d5..f7111cd5e9 100644
--- a/gtk/gtkgestureclick.h
+++ b/gtk/gtkgestureclick.h
@@ -29,17 +29,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_CLICK         (gtk_gesture_click_get_type ())
-#define GTK_GESTURE_CLICK(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_CLICK, 
GtkGestureClick))
-#define GTK_GESTURE_CLICK_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_CLICK, 
GtkGestureClickClass))
-#define GTK_IS_GESTURE_CLICK(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_CLICK))
-#define GTK_IS_GESTURE_CLICK_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_CLICK))
-#define GTK_GESTURE_CLICK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_CLICK, 
GtkGestureClickClass))
-
-typedef struct _GtkGestureClick GtkGestureClick;
-typedef struct _GtkGestureClickClass GtkGestureClickClass;
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_gesture_click_get_type (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureClick, gtk_gesture_click, GTK, GESTURE_CLICK)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_click_new      (void);
diff --git a/gtk/gtkgesturedrag.h b/gtk/gtkgesturedrag.h
index 2493e65de4..678448b4c7 100644
--- a/gtk/gtkgesturedrag.h
+++ b/gtk/gtkgesturedrag.h
@@ -29,17 +29,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_DRAG         (gtk_gesture_drag_get_type ())
-#define GTK_GESTURE_DRAG(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_DRAG, 
GtkGestureDrag))
-#define GTK_GESTURE_DRAG_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_DRAG, 
GtkGestureDragClass))
-#define GTK_IS_GESTURE_DRAG(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_DRAG))
-#define GTK_IS_GESTURE_DRAG_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_DRAG))
-#define GTK_GESTURE_DRAG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_DRAG, 
GtkGestureDragClass))
-
-typedef struct _GtkGestureDrag GtkGestureDrag;
-typedef struct _GtkGestureDragClass GtkGestureDragClass;
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_gesture_drag_get_type          (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureDrag, gtk_gesture_drag, GTK, GESTURE_DRAG)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_drag_new               (void);
diff --git a/gtk/gtkgesturelongpress.h b/gtk/gtkgesturelongpress.h
index da983355cd..96cf577ce1 100644
--- a/gtk/gtkgesturelongpress.h
+++ b/gtk/gtkgesturelongpress.h
@@ -29,17 +29,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_LONG_PRESS         (gtk_gesture_long_press_get_type ())
-#define GTK_GESTURE_LONG_PRESS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_LONG_PRESS, 
GtkGestureLongPress))
-#define GTK_GESTURE_LONG_PRESS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_LONG_PRESS, 
GtkGestureLongPressClass))
-#define GTK_IS_GESTURE_LONG_PRESS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_LONG_PRESS))
-#define GTK_IS_GESTURE_LONG_PRESS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_LONG_PRESS))
-#define GTK_GESTURE_LONG_PRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_LONG_PRESS, 
GtkGestureLongPressClass))
-
-typedef struct _GtkGestureLongPress GtkGestureLongPress;
-typedef struct _GtkGestureLongPressClass GtkGestureLongPressClass;
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_gesture_long_press_get_type   (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureLongPress, gtk_gesture_long_press, GTK, GESTURE_LONG_PRESS)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_long_press_new        (void);
diff --git a/gtk/gtkgesturepan.h b/gtk/gtkgesturepan.h
index 496f4db57b..da4c1c9cf4 100644
--- a/gtk/gtkgesturepan.h
+++ b/gtk/gtkgesturepan.h
@@ -29,17 +29,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_PAN         (gtk_gesture_pan_get_type ())
-#define GTK_GESTURE_PAN(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_PAN, GtkGesturePan))
-#define GTK_GESTURE_PAN_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_PAN, 
GtkGesturePanClass))
-#define GTK_IS_GESTURE_PAN(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_PAN))
-#define GTK_IS_GESTURE_PAN_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_PAN))
-#define GTK_GESTURE_PAN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_PAN, 
GtkGesturePanClass))
-
-typedef struct _GtkGesturePan GtkGesturePan;
-typedef struct _GtkGesturePanClass GtkGesturePanClass;
-
 GDK_AVAILABLE_IN_ALL
-GType             gtk_gesture_pan_get_type        (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGesturePan, gtk_gesture_pan, GTK, GESTURE_PAN)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture *      gtk_gesture_pan_new             (GtkOrientation  orientation);
diff --git a/gtk/gtkgesturerotate.h b/gtk/gtkgesturerotate.h
index 1c7529bd4a..e820a6c66d 100644
--- a/gtk/gtkgesturerotate.h
+++ b/gtk/gtkgesturerotate.h
@@ -30,17 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_ROTATE         (gtk_gesture_rotate_get_type ())
-#define GTK_GESTURE_ROTATE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_ROTATE, 
GtkGestureRotate))
-#define GTK_GESTURE_ROTATE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_ROTATE, 
GtkGestureRotateClass))
-#define GTK_IS_GESTURE_ROTATE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_ROTATE))
-#define GTK_IS_GESTURE_ROTATE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_ROTATE))
-#define GTK_GESTURE_ROTATE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_ROTATE, 
GtkGestureRotateClass))
-
-typedef struct _GtkGestureRotate GtkGestureRotate;
-typedef struct _GtkGestureRotateClass GtkGestureRotateClass;
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_gesture_rotate_get_type        (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureRotate, gtk_gesture_rotate, GTK, GESTURE_ROTATE)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_rotate_new             (void);
diff --git a/gtk/gtkgesturesingle.h b/gtk/gtkgesturesingle.h
index 09dc9b6bb8..3178e3d7b8 100644
--- a/gtk/gtkgesturesingle.h
+++ b/gtk/gtkgesturesingle.h
@@ -30,17 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_SINGLE         (gtk_gesture_single_get_type ())
-#define GTK_GESTURE_SINGLE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_SINGLE, 
GtkGestureSingle))
-#define GTK_GESTURE_SINGLE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_SINGLE, 
GtkGestureSingleClass))
-#define GTK_IS_GESTURE_SINGLE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_SINGLE))
-#define GTK_IS_GESTURE_SINGLE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_SINGLE))
-#define GTK_GESTURE_SINGLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_SINGLE, 
GtkGestureSingleClass))
-
-typedef struct _GtkGestureSingle GtkGestureSingle;
-typedef struct _GtkGestureSingleClass GtkGestureSingleClass;
-
 GDK_AVAILABLE_IN_ALL
-GType       gtk_gesture_single_get_type       (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureSingle, gtk_gesture_single, GTK, GESTURE_SINGLE)
 
 GDK_AVAILABLE_IN_ALL
 gboolean    gtk_gesture_single_get_touch_only (GtkGestureSingle *gesture);
diff --git a/gtk/gtkgesturestylus.h b/gtk/gtkgesturestylus.h
index cb4c13efb6..e01c635ffd 100644
--- a/gtk/gtkgesturestylus.h
+++ b/gtk/gtkgesturestylus.h
@@ -28,17 +28,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_STYLUS         (gtk_gesture_stylus_get_type ())
-#define GTK_GESTURE_STYLUS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_STYLUS, 
GtkGestureStylus))
-#define GTK_GESTURE_STYLUS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_STYLUS, 
GtkGestureStylusClass))
-#define GTK_IS_GESTURE_STYLUS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_STYLUS))
-#define GTK_IS_GESTURE_STYLUS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_STYLUS))
-#define GTK_GESTURE_STYLUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_STYLUS, 
GtkGestureStylusClass))
-
-typedef struct _GtkGestureStylus GtkGestureStylus;
-typedef struct _GtkGestureStylusClass GtkGestureStylusClass;
-
 GDK_AVAILABLE_IN_ALL
-GType             gtk_gesture_stylus_get_type (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureStylus, gtk_gesture_stylus, GTK, GESTURE_STYLUS)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture *      gtk_gesture_stylus_new      (void);
diff --git a/gtk/gtkgestureswipe.h b/gtk/gtkgestureswipe.h
index 330ae7eb69..bc7532f40a 100644
--- a/gtk/gtkgestureswipe.h
+++ b/gtk/gtkgestureswipe.h
@@ -30,17 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_SWIPE         (gtk_gesture_swipe_get_type ())
-#define GTK_GESTURE_SWIPE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_SWIPE, 
GtkGestureSwipe))
-#define GTK_GESTURE_SWIPE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_SWIPE, 
GtkGestureSwipeClass))
-#define GTK_IS_GESTURE_SWIPE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_SWIPE))
-#define GTK_IS_GESTURE_SWIPE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_SWIPE))
-#define GTK_GESTURE_SWIPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_SWIPE, 
GtkGestureSwipeClass))
-
-typedef struct _GtkGestureSwipe GtkGestureSwipe;
-typedef struct _GtkGestureSwipeClass GtkGestureSwipeClass;
-
 GDK_AVAILABLE_IN_ALL
-GType           gtk_gesture_swipe_get_type      (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureSwipe, gtk_gesture_swipe, GTK, GESTURE_SWIPE)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture *    gtk_gesture_swipe_new           (void);
diff --git a/gtk/gtkgesturezoom.h b/gtk/gtkgesturezoom.h
index 0a02852c58..a710dba5a2 100644
--- a/gtk/gtkgesturezoom.h
+++ b/gtk/gtkgesturezoom.h
@@ -30,17 +30,8 @@
 G_BEGIN_DECLS
 
 #define GTK_TYPE_GESTURE_ZOOM         (gtk_gesture_zoom_get_type ())
-#define GTK_GESTURE_ZOOM(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_ZOOM, 
GtkGestureZoom))
-#define GTK_GESTURE_ZOOM_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_ZOOM, 
GtkGestureZoomClass))
-#define GTK_IS_GESTURE_ZOOM(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_ZOOM))
-#define GTK_IS_GESTURE_ZOOM_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_ZOOM))
-#define GTK_GESTURE_ZOOM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_ZOOM, 
GtkGestureZoomClass))
-
-typedef struct _GtkGestureZoom GtkGestureZoom;
-typedef struct _GtkGestureZoomClass GtkGestureZoomClass;
-
 GDK_AVAILABLE_IN_ALL
-GType        gtk_gesture_zoom_get_type        (void) G_GNUC_CONST;
+GTK_DECLARE_EXPORTED_TYPE (GtkGestureZoom, gtk_gesture_zoom, GTK, GESTURE_ZOOM)
 
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_zoom_new             (void);
diff --git a/gtk/gtktypes.h b/gtk/gtktypes.h
index 83a462448d..2470dc17fb 100644
--- a/gtk/gtktypes.h
+++ b/gtk/gtktypes.h
@@ -58,6 +58,26 @@ typedef GClosure*       (* GtkBuilderClosureFunc)               (GtkBuilder
                                                                  gpointer                user_data,
                                                                  GError                **error);
 
+#define GTK_DECLARE_EXPORTED_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME) \
+  GType module_obj_name##_get_type (void);                                                               \
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                       \
+  typedef struct _##ModuleObjName ModuleObjName;                                                         \
+  typedef struct _##ModuleObjName##Class ModuleObjName##Class;                                             \
+                                                                                                         \
+  G_DEFINE_AUTOPTR_CLEANUP_FUNC(ModuleObjName, g_object_unref)                                           \
+                                                                                                         \
+  G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gconstpointer ptr) {                  \
+    return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); }             \
+  G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gconstpointer ptr) {   \
+    return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); }         \
+  G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                           \
+    return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); }                            \
+  G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) {                   \
+    return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); }                               \
+  G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) {    \
+    return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); }       \
+  G_GNUC_END_IGNORE_DEPRECATIONS
+
 G_END_DECLS
 
 #endif /* __GTK_TYPES_H__ */


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