summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmatemixer/Makefile.am25
-rw-r--r--libmatemixer/matemixer-device-port.c47
-rw-r--r--libmatemixer/matemixer-enum-types.c78
-rw-r--r--libmatemixer/matemixer-enum-types.c.template36
-rw-r--r--libmatemixer/matemixer-enum-types.h41
-rw-r--r--libmatemixer/matemixer-enum-types.h.template26
-rw-r--r--libmatemixer/matemixer-enums.h5
7 files changed, 161 insertions, 97 deletions
diff --git a/libmatemixer/Makefile.am b/libmatemixer/Makefile.am
index a986a98..a269397 100644
--- a/libmatemixer/Makefile.am
+++ b/libmatemixer/Makefile.am
@@ -7,10 +7,6 @@ AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"libmatemixer\" \
-DLIBMATEMIXER_BACKEND_DIR=\"$(libdir)/libmatemixer\"
-BUILT_SOURCES = \
- matemixer-enum-types.c \
- matemixer-enum-types.h
-
libmatemixer_includedir = $(includedir)/libmatemixer
libmatemixer_include_HEADERS = \
@@ -32,8 +28,9 @@ libmatemixer_la_SOURCES = \
matemixer-device.c \
matemixer-device-port.c \
matemixer-device-profile.c \
- matemixer-track.c \
- $(BUILD_SOURCES)
+ matemixer-enum-types.c \
+ matemixer-enum-types.h \
+ matemixer-track.c
libmatemixer_la_LIBADD = $(GLIB_LIBS)
@@ -41,20 +38,4 @@ libmatemixer_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-export-dynamic
-libmatemixer_ENUM_TYPES = matemixer-enums.h
-
-matemixer-enum-types.h: $(libmatemixer_ENUM_TYPES)
- $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template matemixer-enum-types.h.template \
- $(libmatemixer_ENUM_TYPES) ) > matemixer-enum-types.h.tmp \
- && mv matemixer-enum-types.h.tmp matemixer-enum-types.h \
- || rm -f matemixer-enum-type.h.tmp
-
-matemixer-enum-types.c: $(libmatemixer_ENUM_TYPES)
- $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template matemixer-enum-types.c.template \
- $(libmatemixer_ENUM_TYPES) ) > matemixer-enum-types.c.tmp \
- && mv matemixer-enum-types.c.tmp matemixer-enum-types.c \
- || rm -f matemixer-enum-type.c.tmp
-
-CLEANFILES = $(BUILT_SOURCES)
-
-include $(top_srcdir)/git.mk
diff --git a/libmatemixer/matemixer-device-port.c b/libmatemixer/matemixer-device-port.c
index 04771fa..63da869 100644
--- a/libmatemixer/matemixer-device-port.c
+++ b/libmatemixer/matemixer-device-port.c
@@ -20,6 +20,7 @@
#include "matemixer-device-port.h"
#include "matemixer-enums.h"
+#include "matemixer-enum-types.h"
struct _MateMixerDevicePortPrivate
{
@@ -40,8 +41,8 @@ enum
PROP_NAME,
PROP_ICON,
PROP_PRIORITY,
- // PROP_DIRECTION,
- // PROP_STATUS,
+ PROP_DIRECTION,
+ PROP_STATUS,
PROP_LATENCY_OFFSET,
N_PROPERTIES
};
@@ -82,10 +83,12 @@ mate_mixer_device_port_get_property (GObject *object,
case PROP_PRIORITY:
g_value_set_uint (value, port->priv->priority);
break;
- // case PROP_DIRECTION:
- // break;
- // case PROP_STATUS:
- // break;
+ case PROP_DIRECTION:
+ g_value_set_flags (value, port->priv->direction);
+ break;
+ case PROP_STATUS:
+ g_value_set_flags (value, port->priv->status);
+ break;
case PROP_LATENCY_OFFSET:
g_value_set_int64 (value, port->priv->latency_offset);
break;
@@ -118,10 +121,12 @@ mate_mixer_device_port_set_property (GObject *object,
case PROP_PRIORITY:
port->priv->priority = g_value_get_uint (value);
break;
- // case PROP_DIRECTION:
- // break;
- // case PROP_STATUS:
- // break;
+ case PROP_DIRECTION:
+ port->priv->direction = g_value_get_flags (value);
+ break;
+ case PROP_STATUS:
+ port->priv->status = g_value_get_flags (value);
+ break;
case PROP_LATENCY_OFFSET:
port->priv->latency_offset = g_value_get_int64 (value);
break;
@@ -185,6 +190,22 @@ mate_mixer_device_port_class_init (MateMixerDevicePortClass *klass)
0,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+ properties[PROP_DIRECTION] = g_param_spec_flags (
+ "direction",
+ "Direction",
+ "Direction(s) for the device port",
+ MATE_MIXER_TYPE_DEVICE_PORT_DIRECTION,
+ 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+ properties[PROP_STATUS] = g_param_spec_flags (
+ "status",
+ "Status",
+ "Status for the device port",
+ MATE_MIXER_TYPE_DEVICE_PORT_STATUS,
+ 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
properties[PROP_LATENCY_OFFSET] = g_param_spec_int64 (
"latency-offset",
"Latency offset",
@@ -200,7 +221,7 @@ mate_mixer_device_port_class_init (MateMixerDevicePortClass *klass)
}
MateMixerDevicePort *
-mate_mixer_device_port_new (const gchar *identifier,
+mate_mixer_device_port_new (const gchar *identifier,
const gchar *name,
const gchar *icon,
guint32 priority,
@@ -213,8 +234,8 @@ mate_mixer_device_port_new (const gchar *identifier,
"name", name,
"icon", icon,
"priority", priority,
- //"direction", direction,
- //"status", status,
+ "direction", direction,
+ "status", status,
"latency-offset", latency_offset,
NULL);
}
diff --git a/libmatemixer/matemixer-enum-types.c b/libmatemixer/matemixer-enum-types.c
new file mode 100644
index 0000000..390e32d
--- /dev/null
+++ b/libmatemixer/matemixer-enum-types.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "matemixer-enum-types.h"
+#include "matemixer-enums.h"
+
+/*
+ * GTypes are not generated by glib-mkenums, see:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=621942
+ */
+
+GType
+mate_mixer_backend_type_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { MATE_MIXER_BACKEND_TYPE_UNKNOWN, "MATE_MIXER_BACKEND_TYPE_UNKNOWN", "unknown" },
+ { MATE_MIXER_BACKEND_TYPE_PULSE, "MATE_MIXER_BACKEND_TYPE_PULSE", "pulse" },
+ { MATE_MIXER_BACKEND_TYPE_NULL, "MATE_MIXER_BACKEND_TYPE_NULL", "null" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static (
+ g_intern_static_string ("MateMixerBackendType"),
+ values);
+ }
+ return etype;
+}
+
+GType
+mate_mixer_device_port_direction_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { MATE_MIXER_DEVICE_PORT_DIRECTION_INPUT, "MATE_MIXER_DEVICE_PORT_DIRECTION_INPUT", "input" },
+ { MATE_MIXER_DEVICE_PORT_DIRECTION_OUTPUT, "MATE_MIXER_DEVICE_PORT_DIRECTION_OUTPUT", "output" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static (
+ g_intern_static_string ("MateMixerDevicePortDirection"),
+ values);
+ }
+ return etype;
+}
+
+GType
+mate_mixer_device_port_status_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GFlagsValue values[] = {
+ { MATE_MIXER_DEVICE_PORT_STATUS_AVAILABLE, "MATE_MIXER_DEVICE_PORT_STATUS_AVAILABLE", "available" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static (
+ g_intern_static_string ("MateMixerDevicePortStatus"),
+ values);
+ }
+ return etype;
+}
diff --git a/libmatemixer/matemixer-enum-types.c.template b/libmatemixer/matemixer-enum-types.c.template
deleted file mode 100644
index 475aed7..0000000
--- a/libmatemixer/matemixer-enum-types.c.template
+++ /dev/null
@@ -1,36 +0,0 @@
-/*** BEGIN file-header ***/
-#include "matemixer-enum-types.h"
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
-#include "@filename@"
-
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType
-@enum_name@_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const G@Type@Value values[] = {
-/*** END value-header ***/
-
-/*** BEGIN value-production ***/
- { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
-/*** END value-production ***/
-
-/*** BEGIN value-tail ***/
- { 0, NULL, NULL }
- };
- etype = g_@type@_register_static (
- g_intern_static_string ("@EnumName@"),
- values);
- }
- return etype;
-}
-
-/*** END value-tail ***/
diff --git a/libmatemixer/matemixer-enum-types.h b/libmatemixer/matemixer-enum-types.h
new file mode 100644
index 0000000..fa1551a
--- /dev/null
+++ b/libmatemixer/matemixer-enum-types.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MATEMIXER_ENUM_TYPES_H
+#define MATEMIXER_ENUM_TYPES_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*
+ * GTypes are not generated by glib-mkenums, see:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=621942
+ */
+
+#define MATE_MIXER_TYPE_BACKEND_TYPE (mate_mixer_backend_type_get_type ())
+GType mate_mixer_backend_type_get_type (void) G_GNUC_CONST;
+
+#define MATE_MIXER_TYPE_DEVICE_PORT_DIRECTION (mate_mixer_device_port_direction_get_type ())
+GType mate_mixer_device_port_direction_get_type (void) G_GNUC_CONST;
+
+#define MATE_MIXER_TYPE_DEVICE_PORT_STATUS (mate_mixer_device_port_status_get_type ())
+GType mate_mixer_device_port_status_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* MATEMIXER_ENUM_TYPES_H */
diff --git a/libmatemixer/matemixer-enum-types.h.template b/libmatemixer/matemixer-enum-types.h.template
deleted file mode 100644
index 55f405a..0000000
--- a/libmatemixer/matemixer-enum-types.h.template
+++ /dev/null
@@ -1,26 +0,0 @@
-/*** BEGIN file-header ***/
-#ifndef MATEMIXER_ENUM_TYPES_H
-#define MATEMIXER_ENUM_TYPES_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* Enumerations from "@filename@" */
-
-/*** END file-production ***/
-
-/*** BEGIN enumeration-production ***/
-#define MATE_MIXER_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
-GType @enum_name@_get_type (void) G_GNUC_CONST;
-
-/*** END enumeration-production ***/
-
-/*** BEGIN file-tail ***/
-G_END_DECLS
-
-#endif /* MATEMIXER_ENUM_TYPES_H */
-/*** END file-tail ***/
diff --git a/libmatemixer/matemixer-enums.h b/libmatemixer/matemixer-enums.h
index 50190ce..d83f283 100644
--- a/libmatemixer/matemixer-enums.h
+++ b/libmatemixer/matemixer-enums.h
@@ -18,6 +18,11 @@
#ifndef MATEMIXER_ENUMS_H
#define MATEMIXER_ENUMS_H
+/*
+ * GTypes are not generated by glib-mkenums, see:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=621942
+ */
+
typedef enum {
MATE_MIXER_BACKEND_TYPE_UNKNOWN,
MATE_MIXER_BACKEND_TYPE_PULSE,