From 43e84f16b1ef254c130f649e55697aaf38883d6c Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 11 Apr 2022 17:42:26 +0900 Subject: [PATCH] timer: device_status: use an utility macro to declare GObject-derived object Since gobject v2.44, an utility macro is available to declare GObject-derived objects. This commit replaces existent boireplates with it. Signed-off-by: Takashi Sakamoto --- src/timer/device-status.c | 4 ++-- src/timer/device-status.h | 33 ++------------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/timer/device-status.c b/src/timer/device-status.c index cb3a041..5d89103 100644 --- a/src/timer/device-status.c +++ b/src/timer/device-status.c @@ -13,9 +13,9 @@ * * The object wraps 'struct snd_timer_gstatus' in UAPI of Linux sound subsystem. */ -struct _ALSATimerDeviceStatusPrivate { +typedef struct { struct snd_timer_gstatus status; -}; +} ALSATimerDeviceStatusPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerDeviceStatus, alsatimer_device_status, G_TYPE_OBJECT) enum timer_device_status_prop_type { diff --git a/src/timer/device-status.h b/src/timer/device-status.h index 96a97aa..45fcd67 100644 --- a/src/timer/device-status.h +++ b/src/timer/device-status.h @@ -8,42 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_DEVICE_STATUS (alsatimer_device_status_get_type()) -#define ALSATIMER_DEVICE_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_DEVICE_STATUS, \ - ALSATimerDeviceStatus)) -#define ALSATIMER_IS_DEVICE_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_DEVICE_STATUS)) - -#define ALSATIMER_DEVICE_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_DEVICE_STATUS, \ - ALSATimerDeviceStatusClass)) -#define ALSATIMER_IS_DEVICE_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_DEVICE_STATUS)) -#define ALSATIMER_DEVICE_STATUS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_DEVICE_STATUS, \ - ALSATimerDeviceStatusClass)) - -typedef struct _ALSATimerDeviceStatus ALSATimerDeviceStatus; -typedef struct _ALSATimerDeviceStatusClass ALSATimerDeviceStatusClass; -typedef struct _ALSATimerDeviceStatusPrivate ALSATimerDeviceStatusPrivate; - -struct _ALSATimerDeviceStatus { - GObject parent_instance; - - ALSATimerDeviceStatusPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSATimerDeviceStatus, alsatimer_device_status, ALSATIMER, DEVICE_STATUS, + GObject); struct _ALSATimerDeviceStatusClass { GObjectClass parent_class; }; -GType alsatimer_device_status_get_type() G_GNUC_CONST; - ALSATimerDeviceStatus *alsatimer_device_status_new(); G_END_DECLS -- 2.47.3