]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: device_status: use an utility macro to declare GObject-derived object
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 11 Apr 2022 08:42:26 +0000 (17:42 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 12 Apr 2022 03:42:19 +0000 (12:42 +0900)
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 <o-takashi@sakamocchi.jp>
src/timer/device-status.c
src/timer/device-status.h

index cb3a041f447b50e700ddd3f9f385ce7b9e8bea0b..5d8910369a2fe24c8f8fd2c03286af85de0ab1e7 100644 (file)
@@ -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 {
index 96a97aa3ebfa02dbd25e84ed8bcd7d40c0d29535..45fcd672c3acc5f8733015c66759331699db8d9e 100644 (file)
@@ -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