From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: timer: device_info: use an utility macro to declare GObject-derived object X-Git-Tag: v0.3.0~213 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=23758ebea4232df272bfb11a9c10c28dda1215cc;p=alsa-gobject.git timer: device_info: 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 --- diff --git a/src/timer/device-info.c b/src/timer/device-info.c index 8df40de..83e5454 100644 --- a/src/timer/device-info.c +++ b/src/timer/device-info.c @@ -13,9 +13,9 @@ * * The object wraps 'struct snd_timer_ginfo' in UAPI of Linux sound subsystem. */ -struct _ALSATimerDeviceInfoPrivate { +typedef struct { struct snd_timer_ginfo info; -}; +} ALSATimerDeviceInfoPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerDeviceInfo, alsatimer_device_info, G_TYPE_OBJECT) enum timer_device_info_prop_type { diff --git a/src/timer/device-info.h b/src/timer/device-info.h index 9177e09..c18a874 100644 --- a/src/timer/device-info.h +++ b/src/timer/device-info.h @@ -8,42 +8,13 @@ G_BEGIN_DECLS #define ALSATIMER_TYPE_DEVICE_INFO (alsatimer_device_info_get_type()) -#define ALSATIMER_DEVICE_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSATIMER_TYPE_DEVICE_INFO, \ - ALSATimerDeviceInfo)) -#define ALSATIMER_IS_DEVICE_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSATIMER_TYPE_DEVICE_INFO)) - -#define ALSATIMER_DEVICE_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSATIMER_TYPE_DEVICE_INFO, \ - ALSATimerDeviceInfoClass)) -#define ALSATIMER_IS_DEVICE_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSATIMER_TYPE_DEVICE_INFO)) -#define ALSATIMER_DEVICE_INFO_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSATIMER_TYPE_DEVICE_INFO, \ - ALSATimerDeviceInfoClass)) - -typedef struct _ALSATimerDeviceInfo ALSATimerDeviceInfo; -typedef struct _ALSATimerDeviceInfoClass ALSATimerDeviceInfoClass; -typedef struct _ALSATimerDeviceInfoPrivate ALSATimerDeviceInfoPrivate; - -struct _ALSATimerDeviceInfo { - GObject parent_instance; - - ALSATimerDeviceInfoPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSATimerDeviceInfo, alsatimer_device_info, ALSATIMER, DEVICE_INFO, + GObject); struct _ALSATimerDeviceInfoClass { GObjectClass parent_class; }; -GType alsatimer_device_info_get_type() G_GNUC_CONST; - G_END_DECLS #endif