From: Takashi Sakamoto Date: Wed, 1 Apr 2020 09:13:28 +0000 (+0900) Subject: seq: port_info: add object to represent information of port for ALSA Sequencer X-Git-Tag: v0.1.0~293 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2ce823529df88007aa81ca1797c113df16313aa4;p=alsa-gobject.git seq: port_info: add object to represent information of port for ALSA Sequencer Signed-off-by: Takashi Sakamoto --- diff --git a/src/seq/alsaseq.map b/src/seq/alsaseq.map index 798d74a..96d1858 100644 --- a/src/seq/alsaseq.map +++ b/src/seq/alsaseq.map @@ -40,6 +40,9 @@ ALSA_GOBJECT_0_0_0 { "alsaseq_addr_new"; "alsaseq_addr_get_client_id"; "alsaseq_addr_get_port_id"; + + "alsaseq_port_info_get_type"; + "alsaseq_port_info_new"; local: *; }; diff --git a/src/seq/meson.build b/src/seq/meson.build index d5fc3b6..cea2452 100644 --- a/src/seq/meson.build +++ b/src/seq/meson.build @@ -14,6 +14,7 @@ sources = files( 'client-info.c', 'user-client.c', 'addr.c', + 'port-info.c', ) headers = files( @@ -22,6 +23,7 @@ headers = files( 'client-info.h', 'user-client.h', 'addr.h', + 'port-info.h', ) privates = files( diff --git a/src/seq/port-info.c b/src/seq/port-info.c new file mode 100644 index 0000000..65e8553 --- /dev/null +++ b/src/seq/port-info.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#include "port-info.h" + +G_DEFINE_TYPE(ALSASeqPortInfo, alsaseq_port_info, G_TYPE_OBJECT) + +static void alsaseq_port_info_class_init(ALSASeqPortInfoClass *klass) +{ + return; +} + +static void alsaseq_port_info_init(ALSASeqPortInfo *self) +{ + return; +} + +/** + * alsaseq_port_info_new: + * + * Allocate and return an instance of ALSASeqPortInfo class. + */ +ALSASeqPortInfo *alsaseq_port_info_new() +{ + return g_object_new(ALSASEQ_TYPE_PORT_INFO, NULL); +} diff --git a/src/seq/port-info.h b/src/seq/port-info.h new file mode 100644 index 0000000..2925278 --- /dev/null +++ b/src/seq/port-info.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#ifndef __ALSA_GOBJECT_ALSASEQ_PORT_INFO__H__ +#define __ALSA_GOBJECT_ALSASEQ_PORT_INFO__H__ + +#include +#include + +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; + +struct _ALSASeqPortInfo { + GObject parent_instance; +}; + +struct _ALSASeqPortInfoClass { + GObjectClass parent_class; +}; + +GType alsaseq_port_info_get_type() G_GNUC_CONST; + +ALSASeqPortInfo *alsaseq_port_info_new(); + +#endif diff --git a/tests/alsaseq-port-info b/tests/alsaseq-port-info new file mode 100644 index 0000000..4c6a576 --- /dev/null +++ b/tests/alsaseq-port-info @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +from sys import exit +from errno import ENXIO + +from helper import test + +import gi +gi.require_version('ALSASeq', '0.0') +from gi.repository import ALSASeq + +target = ALSASeq.PortInfo() +props = () +methods = ( + 'new', +) +signals = () + +if not test(target, props, methods, signals): + exit(ENXIO) diff --git a/tests/meson.build b/tests/meson.build index 4f81e3c..a682172 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -33,6 +33,7 @@ tests = { 'alsaseq-system-info', 'alsaseq-client-info', 'alsaseq-user-client', + 'alsaseq-port-info', ], }