[libhandy] Add a separate header for HdySwipeTracker forward declaration



commit a19f5326678d97ea59348efa2386e75089d7b2bf
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Jul 22 02:57:10 2020 +0500

    Add a separate header for HdySwipeTracker forward declaration
    
    HdySwipeable and HdySwipeTracker reference each other, so one of them needs
    a forward declaration. Previously it was in hdy-swipeable.h, but it seems
    to confuse gtk-doc.
    
    To work around that, mirror what GTK does: have a separate public header
    named hdy-types.h for forward declarations, include it in hdy-swipeable.h,
    and mark it as private header for gtk-doc.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/302
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 doc/meson.build     |  1 +
 src/handy.h         |  1 +
 src/hdy-swipeable.h |  3 +--
 src/hdy-types.h     | 17 +++++++++++++++++
 src/meson.build     |  1 +
 5 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
index 1077cb56..2e7c13ed 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -16,6 +16,7 @@ private_headers = [
     'hdy-shadow-helper-private.h',
     'hdy-stackable-box-private.h',
     'hdy-swipe-tracker-private.h',
+    'hdy-types.h',
     'hdy-view-switcher-button-private.h',
     'hdy-window-handle-controller-private.h',
     'hdy-window-mixin-private.h',
diff --git a/src/handy.h b/src/handy.h
index 1e5128f8..73d8bbc7 100644
--- a/src/handy.h
+++ b/src/handy.h
@@ -52,6 +52,7 @@ G_BEGIN_DECLS
 #include "hdy-swipe-tracker.h"
 #include "hdy-swipeable.h"
 #include "hdy-title-bar.h"
+#include "hdy-types.h"
 #include "hdy-value-object.h"
 #include "hdy-view-switcher.h"
 #include "hdy-view-switcher-bar.h"
diff --git a/src/hdy-swipeable.h b/src/hdy-swipeable.h
index 1218d624..85fa7a4e 100644
--- a/src/hdy-swipeable.h
+++ b/src/hdy-swipeable.h
@@ -12,11 +12,10 @@
 
 #include <gtk/gtk.h>
 #include "hdy-navigation-direction.h"
+#include "hdy-types.h"
 
 G_BEGIN_DECLS
 
-typedef struct _HdySwipeTracker HdySwipeTracker;
-
 #define HDY_TYPE_SWIPEABLE (hdy_swipeable_get_type ())
 
 G_DECLARE_INTERFACE (HdySwipeable, hdy_swipeable, HDY, SWIPEABLE, GtkWidget)
diff --git a/src/hdy-types.h b/src/hdy-types.h
new file mode 100644
index 00000000..56a3763f
--- /dev/null
+++ b/src/hdy-types.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2020 Alexander Mikhaylenko <alexm gnome org>
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#pragma once
+
+#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
+#error "Only <handy.h> can be included directly."
+#endif
+
+G_BEGIN_DECLS
+
+typedef struct _HdySwipeTracker HdySwipeTracker;
+
+G_END_DECLS
diff --git a/src/meson.build b/src/meson.build
index 72f0efcb..432316a8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -93,6 +93,7 @@ src_headers = [
   'hdy-swipe-tracker.h',
   'hdy-swipeable.h',
   'hdy-title-bar.h',
+  'hdy-types.h',
   'hdy-value-object.h',
   'hdy-view-switcher.h',
   'hdy-view-switcher-bar.h',


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