]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
ctl: elem_info_bool: add object to represent information for boolean type element
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 18 Nov 2019 04:22:44 +0000 (13:22 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 12 Dec 2019 05:29:11 +0000 (14:29 +0900)
src/ctl/alsactl.map
src/ctl/elem-info-bool.c [new file with mode: 0644]
src/ctl/elem-info-bool.h [new file with mode: 0644]
src/ctl/meson.build
tests/alsactl-elem-info-bool [new file with mode: 0644]
tests/meson.build

index 5bbe16220873efe23b850d0c76b6fb950a9a8fff..cfb13c18f3e199632c6195bd77ad1fb845ae6a01 100644 (file)
@@ -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 (file)
index 0000000..0a72ce0
--- /dev/null
@@ -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 (file)
index 0000000..96f2665
--- /dev/null
@@ -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 <glib.h>
+#include <glib-object.h>
+
+#include <ctl/elem-info.h>
+
+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
index ddff5853ab6d6aaecc68b22670adad16bc24953f..fe2f6304093af7c3d327171468bb019fbe842bf1 100644 (file)
@@ -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 (file)
index 0000000..0493eec
--- /dev/null
@@ -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)
index 3582a43564892dcd44258a7423ceeb458b51f460..5a3e07cef89a7c3d9518488190add4a7ab389586 100644 (file)
@@ -7,6 +7,7 @@ tests = {
     'alsactl-card',
     'alsactl-card-info',
     'alsactl-elem-info',
+    'alsactl-elem-info-bool',
   ],
 }