diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libappstream-glib/as-app.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-app.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-bundle.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-bundle.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-checksum.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-checksum.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-icon.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-icon.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-image.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-image.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-monitor.c | 7 | ||||
-rw-r--r-- | libappstream-glib/as-monitor.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-problem.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-problem.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-provide.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-provide.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-release.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-release.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-screenshot.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-screenshot.h | 17 | ||||
-rw-r--r-- | libappstream-glib/as-store.c | 5 | ||||
-rw-r--r-- | libappstream-glib/as-store.h | 17 |
23 files changed, 45 insertions, 201 deletions
diff --git a/configure.ac b/configure.ac index fc1e74a..185cb2c 100644 --- a/configure.ac +++ b/configure.ac @@ -126,7 +126,7 @@ if test x$GPERF != xno ; then fi AM_CONDITIONAL(HAVE_GPERF, [test x$GPERF != xno]) -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16.1 gio-2.0 gobject-2.0 gthread-2.0 gio-unix-2.0 gmodule-2.0) +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44.0 gio-2.0 gobject-2.0 gthread-2.0 gio-unix-2.0 gmodule-2.0) PKG_CHECK_MODULES(LIBARCHIVE, libarchive) PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.24) PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0 >= 2.14) diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index eee6ef5..4f5495a 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -49,8 +49,7 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsAppPrivate AsAppPrivate; -struct _AsAppPrivate +typedef struct { AsAppProblems problems; AsIconKind icon_kind; @@ -94,7 +93,7 @@ struct _AsAppPrivate gint priority; gsize token_cache_valid; GPtrArray *token_cache; /* of AsAppTokenItem */ -}; +} AsAppPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsApp, as_app, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h index 4ee5d48..fb7d366 100644 --- a/libappstream-glib/as-app.h +++ b/libappstream-glib/as-app.h @@ -35,22 +35,10 @@ #include "as-release.h" #include "as-screenshot.h" -#define AS_TYPE_APP (as_app_get_type()) -#define AS_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_APP, AsApp)) -#define AS_APP_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_APP, AsAppClass)) -#define AS_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_APP)) -#define AS_IS_APP_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_APP)) -#define AS_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_APP, AsAppClass)) - G_BEGIN_DECLS -typedef struct _AsApp AsApp; -typedef struct _AsAppClass AsAppClass; - -struct _AsApp -{ - GObject parent; -}; +#define AS_TYPE_APP (as_app_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsApp, as_app, AS, APP, GObject) struct _AsAppClass { @@ -210,7 +198,6 @@ typedef enum { #define AS_APP_ERROR as_app_error_quark () -GType as_app_get_type (void); AsApp *as_app_new (void); GQuark as_app_error_quark (void); AsAppSourceKind as_app_guess_source_kind (const gchar *filename); diff --git a/libappstream-glib/as-bundle.c b/libappstream-glib/as-bundle.c index 4a02975..7bd0180 100644 --- a/libappstream-glib/as-bundle.c +++ b/libappstream-glib/as-bundle.c @@ -40,12 +40,11 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsBundlePrivate AsBundlePrivate; -struct _AsBundlePrivate +typedef struct { AsBundleKind kind; gchar *id; -}; +} AsBundlePrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsBundle, as_bundle, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-bundle.h b/libappstream-glib/as-bundle.h index 0a000e2..d98892d 100644 --- a/libappstream-glib/as-bundle.h +++ b/libappstream-glib/as-bundle.h @@ -28,22 +28,10 @@ #include <glib-object.h> -#define AS_TYPE_BUNDLE (as_bundle_get_type()) -#define AS_BUNDLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_BUNDLE, AsBundle)) -#define AS_BUNDLE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_BUNDLE, AsBundleClass)) -#define AS_IS_BUNDLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_BUNDLE)) -#define AS_IS_BUNDLE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_BUNDLE)) -#define AS_BUNDLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_BUNDLE, AsBundleClass)) - G_BEGIN_DECLS -typedef struct _AsBundle AsBundle; -typedef struct _AsBundleClass AsBundleClass; - -struct _AsBundle -{ - GObject parent; -}; +#define AS_TYPE_BUNDLE (as_bundle_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsBundle, as_bundle, AS, BUNDLE, GObject) struct _AsBundleClass { @@ -75,7 +63,6 @@ typedef enum { AS_BUNDLE_KIND_LAST } AsBundleKind; -GType as_bundle_get_type (void); AsBundle *as_bundle_new (void); /* helpers */ diff --git a/libappstream-glib/as-checksum.c b/libappstream-glib/as-checksum.c index 52215ea..27d6da0 100644 --- a/libappstream-glib/as-checksum.c +++ b/libappstream-glib/as-checksum.c @@ -38,14 +38,13 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsChecksumPrivate AsChecksumPrivate; -struct _AsChecksumPrivate +typedef struct { AsChecksumTarget target; GChecksumType kind; gchar *filename; gchar *value; -}; +} AsChecksumPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsChecksum, as_checksum, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-checksum.h b/libappstream-glib/as-checksum.h index 485ae6b..929927f 100644 --- a/libappstream-glib/as-checksum.h +++ b/libappstream-glib/as-checksum.h @@ -28,22 +28,10 @@ #include <glib-object.h> -#define AS_TYPE_CHECKSUM (as_checksum_get_type()) -#define AS_CHECKSUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_CHECKSUM, AsChecksum)) -#define AS_CHECKSUM_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_CHECKSUM, AsChecksumClass)) -#define AS_IS_CHECKSUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_CHECKSUM)) -#define AS_IS_CHECKSUM_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_CHECKSUM)) -#define AS_CHECKSUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_CHECKSUM, AsChecksumClass)) - G_BEGIN_DECLS -typedef struct _AsChecksum AsChecksum; -typedef struct _AsChecksumClass AsChecksumClass; - -struct _AsChecksum -{ - GObject parent; -}; +#define AS_TYPE_CHECKSUM (as_checksum_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsChecksum, as_checksum, AS, CHECKSUM, GObject) struct _AsChecksumClass { @@ -75,7 +63,6 @@ typedef enum { AS_CHECKSUM_TARGET_LAST } AsChecksumTarget; -GType as_checksum_get_type (void); AsChecksum *as_checksum_new (void); AsChecksumTarget as_checksum_target_from_string (const gchar *target); const gchar *as_checksum_target_to_string (AsChecksumTarget target); diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c index 83586e2..dfdf37e 100644 --- a/libappstream-glib/as-icon.c +++ b/libappstream-glib/as-icon.c @@ -40,8 +40,7 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsIconPrivate AsIconPrivate; -struct _AsIconPrivate +typedef struct { AsIconKind kind; gchar *name; @@ -53,7 +52,7 @@ struct _AsIconPrivate guint height; GdkPixbuf *pixbuf; GBytes *data; -}; +} AsIconPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsIcon, as_icon, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-icon.h b/libappstream-glib/as-icon.h index e842cea..7a1c9f5 100644 --- a/libappstream-glib/as-icon.h +++ b/libappstream-glib/as-icon.h @@ -29,22 +29,10 @@ #include <glib-object.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#define AS_TYPE_ICON (as_icon_get_type()) -#define AS_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_ICON, AsIcon)) -#define AS_ICON_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_ICON, AsIconClass)) -#define AS_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_ICON)) -#define AS_IS_ICON_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_ICON)) -#define AS_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_ICON, AsIconClass)) - G_BEGIN_DECLS -typedef struct _AsIcon AsIcon; -typedef struct _AsIconClass AsIconClass; - -struct _AsIcon -{ - GObject parent; -}; +#define AS_TYPE_ICON (as_icon_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsIcon, as_icon, AS, ICON, GObject) struct _AsIconClass { @@ -110,7 +98,6 @@ typedef enum { #define AS_ICON_ERROR as_icon_error_quark () -GType as_icon_get_type (void); AsIcon *as_icon_new (void); GQuark as_icon_error_quark (void); diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c index 89ca8db..661e5ee 100644 --- a/libappstream-glib/as-image.c +++ b/libappstream-glib/as-image.c @@ -40,8 +40,7 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsImagePrivate AsImagePrivate; -struct _AsImagePrivate +typedef struct { AsImageKind kind; gchar *url; @@ -50,7 +49,7 @@ struct _AsImagePrivate guint width; guint height; GdkPixbuf *pixbuf; -}; +} AsImagePrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsImage, as_image, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-image.h b/libappstream-glib/as-image.h index 2032d49..8e14b66 100644 --- a/libappstream-glib/as-image.h +++ b/libappstream-glib/as-image.h @@ -29,22 +29,10 @@ #include <glib-object.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#define AS_TYPE_IMAGE (as_image_get_type()) -#define AS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_IMAGE, AsImage)) -#define AS_IMAGE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_IMAGE, AsImageClass)) -#define AS_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_IMAGE)) -#define AS_IS_IMAGE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_IMAGE)) -#define AS_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_IMAGE, AsImageClass)) - G_BEGIN_DECLS -typedef struct _AsImage AsImage; -typedef struct _AsImageClass AsImageClass; - -struct _AsImage -{ - GObject parent; -}; +#define AS_TYPE_IMAGE (as_image_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsImage, as_image, AS, IMAGE, GObject) struct _AsImageClass { @@ -124,7 +112,6 @@ typedef enum { #define AS_IMAGE_THUMBNAIL_HEIGHT 63 /* Since: 0.2.2 */ #define AS_IMAGE_THUMBNAIL_WIDTH 112 /* Since: 0.2.2 */ -GType as_image_get_type (void); AsImage *as_image_new (void); /* helpers */ diff --git a/libappstream-glib/as-monitor.c b/libappstream-glib/as-monitor.c index 2582c32..f7b15d1 100644 --- a/libappstream-glib/as-monitor.c +++ b/libappstream-glib/as-monitor.c @@ -35,10 +35,7 @@ #include "as-cleanup.h" #include "as-monitor.h" - - -typedef struct _AsMonitorPrivate AsMonitorPrivate; -struct _AsMonitorPrivate +typedef struct { GPtrArray *array; /* of GFileMonitor */ GPtrArray *files; /* of gchar* */ @@ -46,7 +43,7 @@ struct _AsMonitorPrivate GPtrArray *queue_changed; /* of gchar* */ GPtrArray *queue_temp; /* of gchar* */ guint pending_id; -}; +} AsMonitorPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsMonitor, as_monitor, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-monitor.h b/libappstream-glib/as-monitor.h index 0906f09..511215a 100644 --- a/libappstream-glib/as-monitor.h +++ b/libappstream-glib/as-monitor.h @@ -29,22 +29,10 @@ #include <glib-object.h> #include <gio/gio.h> -#define AS_TYPE_MONITOR (as_monitor_get_type()) -#define AS_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_MONITOR, AsMonitor)) -#define AS_MONITOR_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_MONITOR, AsMonitorClass)) -#define AS_IS_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_MONITOR)) -#define AS_IS_MONITOR_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_MONITOR)) -#define AS_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_MONITOR, AsMonitorClass)) - G_BEGIN_DECLS -typedef struct _AsMonitor AsMonitor; -typedef struct _AsMonitorClass AsMonitorClass; - -struct _AsMonitor -{ - GObject parent; -}; +#define AS_TYPE_MONITOR (as_monitor_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsMonitor, as_monitor, AS, MONITOR, GObject) struct _AsMonitorClass { @@ -79,7 +67,6 @@ typedef enum { #define AS_MONITOR_ERROR as_monitor_error_quark () -GType as_monitor_get_type (void); AsMonitor *as_monitor_new (void); GQuark as_monitor_error_quark (void); diff --git a/libappstream-glib/as-problem.c b/libappstream-glib/as-problem.c index f4447b6..d8c850d 100644 --- a/libappstream-glib/as-problem.c +++ b/libappstream-glib/as-problem.c @@ -34,13 +34,12 @@ #include "as-problem.h" -typedef struct _AsProblemPrivate AsProblemPrivate; -struct _AsProblemPrivate +typedef struct { AsProblemKind kind; gchar *message; guint line_number; -}; +} AsProblemPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsProblem, as_problem, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-problem.h b/libappstream-glib/as-problem.h index 9f59352..700e946 100644 --- a/libappstream-glib/as-problem.h +++ b/libappstream-glib/as-problem.h @@ -28,22 +28,10 @@ #include <glib-object.h> -#define AS_TYPE_PROBLEM (as_problem_get_type()) -#define AS_PROBLEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_PROBLEM, AsProblem)) -#define AS_PROBLEM_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_PROBLEM, AsProblemClass)) -#define AS_IS_PROBLEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_PROBLEM)) -#define AS_IS_PROBLEM_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_PROBLEM)) -#define AS_PROBLEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_PROBLEM, AsProblemClass)) - G_BEGIN_DECLS -typedef struct _AsProblem AsProblem; -typedef struct _AsProblemClass AsProblemClass; - -struct _AsProblem -{ - GObject parent; -}; +#define AS_TYPE_PROBLEM (as_problem_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsProblem, as_problem, AS, PROBLEM, GObject) struct _AsProblemClass { @@ -99,7 +87,6 @@ typedef enum { AS_PROBLEM_KIND_LAST } AsProblemKind; -GType as_problem_get_type (void); AsProblem *as_problem_new (void); /* helpers */ diff --git a/libappstream-glib/as-provide.c b/libappstream-glib/as-provide.c index 27b1aec..8189973 100644 --- a/libappstream-glib/as-provide.c +++ b/libappstream-glib/as-provide.c @@ -38,12 +38,11 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsProvidePrivate AsProvidePrivate; -struct _AsProvidePrivate +typedef struct { AsProvideKind kind; gchar *value; -}; +} AsProvidePrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsProvide, as_provide, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-provide.h b/libappstream-glib/as-provide.h index 0196f3c..ba4b7ee 100644 --- a/libappstream-glib/as-provide.h +++ b/libappstream-glib/as-provide.h @@ -28,22 +28,10 @@ #include <glib-object.h> -#define AS_TYPE_PROVIDE (as_provide_get_type()) -#define AS_PROVIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_PROVIDE, AsProvide)) -#define AS_PROVIDE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_PROVIDE, AsProvideClass)) -#define AS_IS_PROVIDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_PROVIDE)) -#define AS_IS_PROVIDE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_PROVIDE)) -#define AS_PROVIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_PROVIDE, AsProvideClass)) - G_BEGIN_DECLS -typedef struct _AsProvide AsProvide; -typedef struct _AsProvideClass AsProvideClass; - -struct _AsProvide -{ - GObject parent; -}; +#define AS_TYPE_PROVIDE (as_provide_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsProvide, as_provide, AS, PROVIDE, GObject) struct _AsProvideClass { @@ -91,7 +79,6 @@ typedef enum { AS_PROVIDE_KIND_LAST } AsProvideKind; -GType as_provide_get_type (void); AsProvide *as_provide_new (void); /* helpers */ diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c index 0ca7a11..2cff6c6 100644 --- a/libappstream-glib/as-release.c +++ b/libappstream-glib/as-release.c @@ -46,15 +46,14 @@ #include "as-tag.h" #include "as-utils-private.h" -typedef struct _AsReleasePrivate AsReleasePrivate; -struct _AsReleasePrivate +typedef struct { gchar *version; GHashTable *descriptions; guint64 timestamp; GPtrArray *locations; GPtrArray *checksums; -}; +} AsReleasePrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsRelease, as_release, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-release.h b/libappstream-glib/as-release.h index d1bb49b..8515ce1 100644 --- a/libappstream-glib/as-release.h +++ b/libappstream-glib/as-release.h @@ -30,22 +30,10 @@ #include "as-checksum.h" -#define AS_TYPE_RELEASE (as_release_get_type()) -#define AS_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_RELEASE, AsRelease)) -#define AS_RELEASE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_RELEASE, AsReleaseClass)) -#define AS_IS_RELEASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_RELEASE)) -#define AS_IS_RELEASE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_RELEASE)) -#define AS_RELEASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_RELEASE, AsReleaseClass)) - G_BEGIN_DECLS -typedef struct _AsRelease AsRelease; -typedef struct _AsReleaseClass AsReleaseClass; - -struct _AsRelease -{ - GObject parent; -}; +#define AS_TYPE_RELEASE (as_release_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsRelease, as_release, AS, RELEASE, GObject) struct _AsReleaseClass { @@ -61,7 +49,6 @@ struct _AsReleaseClass void (*_as_reserved8) (void); }; -GType as_release_get_type (void); AsRelease *as_release_new (void); gint as_release_vercmp (AsRelease *rel1, AsRelease *rel2); diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c index d2183c6..e43c767 100644 --- a/libappstream-glib/as-screenshot.c +++ b/libappstream-glib/as-screenshot.c @@ -41,14 +41,13 @@ #include "as-utils-private.h" #include "as-yaml.h" -typedef struct _AsScreenshotPrivate AsScreenshotPrivate; -struct _AsScreenshotPrivate +typedef struct { AsScreenshotKind kind; GHashTable *captions; GPtrArray *images; gint priority; -}; +} AsScreenshotPrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsScreenshot, as_screenshot, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-screenshot.h b/libappstream-glib/as-screenshot.h index 15f9f17..008c902 100644 --- a/libappstream-glib/as-screenshot.h +++ b/libappstream-glib/as-screenshot.h @@ -30,22 +30,10 @@ #include "as-image.h" -#define AS_TYPE_SCREENSHOT (as_screenshot_get_type()) -#define AS_SCREENSHOT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_SCREENSHOT, AsScreenshot)) -#define AS_SCREENSHOT_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_SCREENSHOT, AsScreenshotClass)) -#define AS_IS_SCREENSHOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_SCREENSHOT)) -#define AS_IS_SCREENSHOT_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_SCREENSHOT)) -#define AS_SCREENSHOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_SCREENSHOT, AsScreenshotClass)) - G_BEGIN_DECLS -typedef struct _AsScreenshot AsScreenshot; -typedef struct _AsScreenshotClass AsScreenshotClass; - -struct _AsScreenshot -{ - GObject parent; -}; +#define AS_TYPE_SCREENSHOT (as_screenshot_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsScreenshot, as_screenshot, AS, SCREENSHOT, GObject) struct _AsScreenshotClass { @@ -77,7 +65,6 @@ typedef enum { AS_SCREENSHOT_KIND_LAST } AsScreenshotKind; -GType as_screenshot_get_type (void); AsScreenshot *as_screenshot_new (void); /* helpers */ diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index b6d8677..0a0f5b0 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -53,8 +53,7 @@ typedef enum { AS_STORE_PROBLEM_LAST } AsStoreProblems; -typedef struct _AsStorePrivate AsStorePrivate; -struct _AsStorePrivate +typedef struct { gchar *destdir; gchar *origin; @@ -71,7 +70,7 @@ struct _AsStorePrivate guint32 filter; guint changed_block_refcnt; gboolean is_pending_changed_signal; -}; +} AsStorePrivate; G_DEFINE_TYPE_WITH_PRIVATE (AsStore, as_store, G_TYPE_OBJECT) diff --git a/libappstream-glib/as-store.h b/libappstream-glib/as-store.h index 3ca2ffc..85cc5b1 100644 --- a/libappstream-glib/as-store.h +++ b/libappstream-glib/as-store.h @@ -32,22 +32,10 @@ #include "as-app.h" #include "as-node.h" -#define AS_TYPE_STORE (as_store_get_type()) -#define AS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AS_TYPE_STORE, AsStore)) -#define AS_STORE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), AS_TYPE_STORE, AsStoreClass)) -#define AS_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AS_TYPE_STORE)) -#define AS_IS_STORE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), AS_TYPE_STORE)) -#define AS_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AS_TYPE_STORE, AsStoreClass)) - G_BEGIN_DECLS -typedef struct _AsStore AsStore; -typedef struct _AsStoreClass AsStoreClass; - -struct _AsStore -{ - GObject parent; -}; +#define AS_TYPE_STORE (as_store_get_type ()) +G_DECLARE_DERIVABLE_TYPE (AsStore, as_store, AS, STORE, GObject) struct _AsStoreClass { @@ -131,7 +119,6 @@ typedef enum { #define AS_STORE_ERROR as_store_error_quark () -GType as_store_get_type (void); AsStore *as_store_new (void); GQuark as_store_error_quark (void); |