From: Takashi Sakamoto Date: Mon, 11 Apr 2022 08:42:26 +0000 (+0900) Subject: seq: port_info: use an utility macro to declare GObject-derived object X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=dd1a56d47a7387769182c717d47b4c3947fc2ad5;p=alsa-gobject.git seq: port_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/seq/port-info.c b/src/seq/port-info.c index 9092a3d..c1b1178 100644 --- a/src/seq/port-info.c +++ b/src/seq/port-info.c @@ -13,9 +13,9 @@ * * The object wraps 'struct snd_port_info' in UAPI of Linux sound subsystem. */ -struct _ALSASeqPortInfoPrivate { +typedef struct { struct snd_seq_port_info info; -}; +} ALSASeqPortInfoPrivate; G_DEFINE_TYPE_WITH_PRIVATE(ALSASeqPortInfo, alsaseq_port_info, G_TYPE_OBJECT) enum seq_port_info_prop_type { diff --git a/src/seq/port-info.h b/src/seq/port-info.h index 2ea729b..531f86e 100644 --- a/src/seq/port-info.h +++ b/src/seq/port-info.h @@ -8,42 +8,12 @@ G_BEGIN_DECLS #define ALSASEQ_TYPE_PORT_INFO (alsaseq_port_info_get_type()) -#define ALSASEQ_PORT_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSASEQ_TYPE_PORT_INFO, \ - ALSASeqPortInfo)) -#define ALSASEQ_IS_PORT_INFO(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSASEQ_TYPE_PORT_INFO)) - -#define ALSASEQ_PORT_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSASEQ_TYPE_PORT_INFO, \ - ALSASeqPortInfoClass)) -#define ALSASEQ_IS_PORT_INFO_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSASEQ_TYPE_PORT_INFO)) -#define ALSASEQ_PORT_INFO_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSASEQ_TYPE_PORT_INFO, \ - ALSASeqPortInfoClass)) - -typedef struct _ALSASeqPortInfo ALSASeqPortInfo; -typedef struct _ALSASeqPortInfoClass ALSASeqPortInfoClass; -typedef struct _ALSASeqPortInfoPrivate ALSASeqPortInfoPrivate; - -struct _ALSASeqPortInfo { - GObject parent_instance; - - ALSASeqPortInfoPrivate *priv; -}; +G_DECLARE_DERIVABLE_TYPE(ALSASeqPortInfo, alsaseq_port_info, ALSASEQ, PORT_INFO, GObject); struct _ALSASeqPortInfoClass { GObjectClass parent_class; }; -GType alsaseq_port_info_get_type() G_GNUC_CONST; - ALSASeqPortInfo *alsaseq_port_info_new(); #endif