From 4472003afcfd4cd223ee48368cf238084737f533 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 18 Nov 2019 13:22:44 +0900 Subject: [PATCH] ctl: elem_info_bool: add object to represent information for boolean type element --- src/ctl/alsactl.map | 2 ++ src/ctl/elem-info-bool.c | 15 +++++++++++ src/ctl/elem-info-bool.h | 49 ++++++++++++++++++++++++++++++++++++ src/ctl/meson.build | 2 ++ tests/alsactl-elem-info-bool | 18 +++++++++++++ tests/meson.build | 1 + 6 files changed, 87 insertions(+) create mode 100644 src/ctl/elem-info-bool.c create mode 100644 src/ctl/elem-info-bool.h create mode 100644 tests/alsactl-elem-info-bool diff --git a/src/ctl/alsactl.map b/src/ctl/alsactl.map index 5bbe162..cfb13c1 100644 --- a/src/ctl/alsactl.map +++ b/src/ctl/alsactl.map @@ -31,6 +31,8 @@ ALSA_GOBJECT_0_0_0 { "alsactl_elem_id_get_index"; "alsactl_elem_info_get_type"; + + "alsactl_elem_info_bool_get_type"; local: *; }; diff --git a/src/ctl/elem-info-bool.c b/src/ctl/elem-info-bool.c new file mode 100644 index 0000000..0a72ce0 --- /dev/null +++ b/src/ctl/elem-info-bool.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#include "elem-info-bool.h" + +G_DEFINE_TYPE(ALSACtlElemInfoBool, alsactl_elem_info_bool, ALSACTL_TYPE_ELEM_INFO) + +static void alsactl_elem_info_bool_class_init(ALSACtlElemInfoBoolClass *klass) +{ + return; +} + +static void alsactl_elem_info_bool_init(ALSACtlElemInfoBool *self) +{ + return; +} + diff --git a/src/ctl/elem-info-bool.h b/src/ctl/elem-info-bool.h new file mode 100644 index 0000000..96f2665 --- /dev/null +++ b/src/ctl/elem-info-bool.h @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#ifndef __ALSA_GOBJECT_ALSACTL_ELEM_INFO_BOOL__H__ +#define __ALSA_GOBJECT_ALSACTL_ELEM_INFO_BOOL__H__ + +#include +#include + +#include + +G_BEGIN_DECLS + +#define ALSACTL_TYPE_ELEM_INFO_BOOL (alsactl_elem_info_bool_get_type()) + +#define ALSACTL_ELEM_INFO_BOOL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + ALSACTL_TYPE_ELEM_INFO_BOOL, \ + ALSACtlElemInfoBool)) +#define ALSACTL_IS_ELEM_INFO_BOOL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + ALSACTL_TYPE_ELEM_INFO_BOOL)) + +#define ALSACTL_ELEM_INFO_BOOL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + ALSACTL_TYPE_ELEM_INFO_BOOL, \ + ALSACtlElemInfoBoolClass)) +#define ALSACTL_IS_ELEM_INFO_BOOL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + ALSACTL_TYPE_ELEM_INFO_BOOL)) +#define ALSACTL_ELEM_INFO_BOOL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + ALSACTL_TYPE_ELEM_INFO_BOOL, \ + ALSACtlElemInfoBoolClass)) + +typedef struct _ALSACtlElemInfoBool ALSACtlElemInfoBool; +typedef struct _ALSACtlElemInfoBoolClass ALSACtlElemInfoBoolClass; + +struct _ALSACtlElemInfoBool { + ALSACtlElemInfo parent_instance; +}; + +struct _ALSACtlElemInfoBoolClass { + ALSACtlElemInfoClass parent_class; +}; + +GType alsactl_elem_info_bool_get_type(void) G_GNUC_CONST; + +G_END_DECLS + +#endif diff --git a/src/ctl/meson.build b/src/ctl/meson.build index ddff585..fe2f630 100644 --- a/src/ctl/meson.build +++ b/src/ctl/meson.build @@ -14,6 +14,7 @@ sources = files( 'card-info.c', 'elem-id.c', 'elem-info.c', + 'elem-info-bool.c', ) headers = files( @@ -22,6 +23,7 @@ headers = files( 'card-info.h', 'elem-id.h', 'elem-info.h', + 'elem-info-bool.h', ) privates = files( diff --git a/tests/alsactl-elem-info-bool b/tests/alsactl-elem-info-bool new file mode 100644 index 0000000..0493eec --- /dev/null +++ b/tests/alsactl-elem-info-bool @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +from sys import exit +from errno import ENXIO + +from helper import test + +import gi +gi.require_version('ALSACtl', '0.0') +from gi.repository import ALSACtl + +target = ALSACtl.ElemInfoBool() +props = () +methods = () +signals = () + +if not test(target, props, methods, signals): + exit(ENXIO) diff --git a/tests/meson.build b/tests/meson.build index 3582a43..5a3e07c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -7,6 +7,7 @@ tests = { 'alsactl-card', 'alsactl-card-info', 'alsactl-elem-info', + 'alsactl-elem-info-bool', ], } -- 2.47.3