summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/alsa/alsa-device.c83
-rw-r--r--backends/alsa/alsa-toggle.c13
-rw-r--r--backends/alsa/alsa-toggle.h7
-rw-r--r--docs/reference/libmatemixer-docs.xml2
-rw-r--r--docs/reference/libmatemixer-sections.txt40
-rw-r--r--libmatemixer/Makefile.am6
-rw-r--r--libmatemixer/matemixer-stream-toggle.c (renamed from libmatemixer/matemixer-toggle.c)138
-rw-r--r--libmatemixer/matemixer-stream-toggle.h81
-rw-r--r--libmatemixer/matemixer-toggle.h80
-rw-r--r--libmatemixer/matemixer-types.h2
-rw-r--r--libmatemixer/matemixer.h2
11 files changed, 231 insertions, 223 deletions
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c
index 4c78f9d..66bb80a 100644
--- a/backends/alsa/alsa-device.c
+++ b/backends/alsa/alsa-device.c
@@ -92,6 +92,11 @@ static void add_switch (AlsaDevice
AlsaStream *stream,
snd_mixer_elem_t *el);
+static void add_toggle (AlsaDevice *device,
+ AlsaStream *stream,
+ AlsaToggleType type,
+ snd_mixer_elem_t *el);
+
static void add_stream_input_switch (AlsaDevice *device,
snd_mixer_elem_t *el);
static void add_stream_output_switch (AlsaDevice *device,
@@ -582,33 +587,6 @@ add_stream_output_control (AlsaDevice *device, snd_mixer_elem_t *el)
g_object_unref (control);
}
-static AlsaToggle *
-create_toggle (AlsaDevice *device, snd_mixer_elem_t *el, AlsaToggleType type)
-{
- AlsaToggle *toggle;
- AlsaSwitchOption *on;
- AlsaSwitchOption *off;
- gchar *name;
- gchar *label;
- MateMixerStreamSwitchRole role;
-
- on = alsa_switch_option_new ("On", _("On"), NULL, 1);
- off = alsa_switch_option_new ("Off", _("Off"), NULL, 0);
-
- get_switch_info (el, &name, &label, &role);
-
- toggle = alsa_toggle_new (name, label, role, type, on, off);
-
- alsa_element_set_snd_element (ALSA_ELEMENT (toggle), el);
-
- g_free (name);
- g_free (label);
- g_object_unref (on);
- g_object_unref (off);
-
- return toggle;
-}
-
static void
add_switch (AlsaDevice *device, AlsaStream *stream, snd_mixer_elem_t *el)
{
@@ -674,6 +652,41 @@ add_switch (AlsaDevice *device, AlsaStream *stream, snd_mixer_elem_t *el)
}
static void
+add_toggle (AlsaDevice *device,
+ AlsaStream *stream,
+ AlsaToggleType type,
+ snd_mixer_elem_t *el)
+{
+ AlsaElement *element;
+ AlsaSwitchOption *on;
+ AlsaSwitchOption *off;
+ gchar *name;
+ gchar *label;
+ MateMixerStreamSwitchRole role;
+
+ on = alsa_switch_option_new ("On", _("On"), NULL, 1);
+ off = alsa_switch_option_new ("Off", _("Off"), NULL, 0);
+
+ get_switch_info (el, &name, &label, &role);
+
+ element = ALSA_ELEMENT (alsa_toggle_new (stream,
+ name, label,
+ role,
+ type,
+ on, off));
+ g_free (name);
+ g_free (label);
+ g_object_unref (on);
+ g_object_unref (off);
+
+ alsa_element_set_snd_element (element, el);
+
+ add_element (device, stream, element);
+
+ g_object_unref (element);
+}
+
+static void
add_stream_input_switch (AlsaDevice *device, snd_mixer_elem_t *el)
{
g_debug ("Reading device %s input switch %s (%d items)",
@@ -698,33 +711,21 @@ add_stream_output_switch (AlsaDevice *device, snd_mixer_elem_t *el)
static void
add_stream_input_toggle (AlsaDevice *device, snd_mixer_elem_t *el)
{
- AlsaToggle *toggle;
-
g_debug ("Reading device %s input toggle %s",
mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)),
snd_mixer_selem_get_name (el));
- toggle = create_toggle (device, el, ALSA_TOGGLE_CAPTURE);
-
- add_element (device, device->priv->input, ALSA_ELEMENT (toggle));
-
- g_object_unref (toggle);
+ add_toggle (device, device->priv->input, ALSA_TOGGLE_CAPTURE, el);
}
static void
add_stream_output_toggle (AlsaDevice *device, snd_mixer_elem_t *el)
{
- AlsaToggle *toggle;
-
g_debug ("Reading device %s output toggle %s",
mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)),
snd_mixer_selem_get_name (el));
- toggle = create_toggle (device, el, ALSA_TOGGLE_PLAYBACK);
-
- add_element (device, device->priv->output, ALSA_ELEMENT (toggle));
-
- g_object_unref (toggle);
+ add_toggle (device, device->priv->output, ALSA_TOGGLE_PLAYBACK, el);
}
static void
diff --git a/backends/alsa/alsa-toggle.c b/backends/alsa/alsa-toggle.c
index 3ceedf5..c41e29a 100644
--- a/backends/alsa/alsa-toggle.c
+++ b/backends/alsa/alsa-toggle.c
@@ -23,6 +23,7 @@
#include <libmatemixer/matemixer-private.h>
#include "alsa-element.h"
+#include "alsa-stream.h"
#include "alsa-switch-option.h"
#include "alsa-toggle.h"
@@ -38,7 +39,7 @@ static void alsa_element_interface_init (AlsaElementInterface *iface);
static void alsa_toggle_class_init (AlsaToggleClass *klass);
static void alsa_toggle_init (AlsaToggle *toggle);
-G_DEFINE_TYPE_WITH_CODE (AlsaToggle, alsa_toggle, MATE_MIXER_TYPE_TOGGLE,
+G_DEFINE_TYPE_WITH_CODE (AlsaToggle, alsa_toggle, MATE_MIXER_TYPE_STREAM_TOGGLE,
G_IMPLEMENT_INTERFACE (ALSA_TYPE_ELEMENT,
alsa_element_interface_init))
@@ -78,7 +79,8 @@ alsa_toggle_init (AlsaToggle *toggle)
}
AlsaToggle *
-alsa_toggle_new (const gchar *name,
+alsa_toggle_new (AlsaStream *stream,
+ const gchar *name,
const gchar *label,
MateMixerStreamSwitchRole role,
AlsaToggleType type,
@@ -92,6 +94,7 @@ alsa_toggle_new (const gchar *name,
"label", label,
"flags", MATE_MIXER_SWITCH_TOGGLE,
"role", role,
+ "stream", stream,
"on-state-option", on,
"off-state-option", off,
NULL);
@@ -212,9 +215,11 @@ alsa_toggle_load (AlsaElement *element)
MateMixerSwitchOption *active;
if (value > 0)
- active = mate_mixer_toggle_get_state_option (MATE_MIXER_TOGGLE (toggle), TRUE);
+ active = mate_mixer_stream_toggle_get_state_option (MATE_MIXER_STREAM_TOGGLE (toggle),
+ TRUE);
else
- active = mate_mixer_toggle_get_state_option (MATE_MIXER_TOGGLE (toggle), FALSE);
+ active = mate_mixer_stream_toggle_get_state_option (MATE_MIXER_STREAM_TOGGLE (toggle),
+ FALSE);
_mate_mixer_switch_set_active_option (MATE_MIXER_SWITCH (toggle), active);
return TRUE;
diff --git a/backends/alsa/alsa-toggle.h b/backends/alsa/alsa-toggle.h
index 2d772f9..16a0410 100644
--- a/backends/alsa/alsa-toggle.h
+++ b/backends/alsa/alsa-toggle.h
@@ -49,7 +49,7 @@ typedef struct _AlsaTogglePrivate AlsaTogglePrivate;
struct _AlsaToggle
{
- MateMixerToggle parent;
+ MateMixerStreamToggle parent;
/*< private >*/
AlsaTogglePrivate *priv;
@@ -57,12 +57,13 @@ struct _AlsaToggle
struct _AlsaToggleClass
{
- MateMixerToggleClass parent_class;
+ MateMixerStreamToggleClass parent_class;
};
GType alsa_toggle_get_type (void) G_GNUC_CONST;
-AlsaToggle *alsa_toggle_new (const gchar *name,
+AlsaToggle *alsa_toggle_new (AlsaStream *stream,
+ const gchar *name,
const gchar *label,
MateMixerStreamSwitchRole role,
AlsaToggleType type,
diff --git a/docs/reference/libmatemixer-docs.xml b/docs/reference/libmatemixer-docs.xml
index 615a67a..196e484 100644
--- a/docs/reference/libmatemixer-docs.xml
+++ b/docs/reference/libmatemixer-docs.xml
@@ -23,10 +23,10 @@
<xi:include href="xml/matemixer-stream.xml"/>
<xi:include href="xml/matemixer-stream-control.xml"/>
<xi:include href="xml/matemixer-stream-switch.xml"/>
+ <xi:include href="xml/matemixer-stream-toggle.xml"/>
<xi:include href="xml/matemixer-stored-control.xml"/>
<xi:include href="xml/matemixer-switch.xml"/>
<xi:include href="xml/matemixer-switch-option.xml"/>
- <xi:include href="xml/matemixer-toggle.xml"/>
</chapter>
<index id="api-index-full">
<title>API Index</title>
diff --git a/docs/reference/libmatemixer-sections.txt b/docs/reference/libmatemixer-sections.txt
index 0049cfa..ddc5f19 100644
--- a/docs/reference/libmatemixer-sections.txt
+++ b/docs/reference/libmatemixer-sections.txt
@@ -227,6 +227,26 @@ mate_mixer_stream_switch_get_type
</SECTION>
<SECTION>
+<FILE>matemixer-stream-toggle</FILE>
+<TITLE>MateMixerStreamToggle</TITLE>
+MateMixerStreamToggle
+MateMixerStreamToggleClass
+mate_mixer_stream_toggle_get_state
+mate_mixer_stream_toggle_set_state
+mate_mixer_stream_toggle_get_state_option
+<SUBSECTION Standard>
+MATE_MIXER_IS_STREAM_TOGGLE
+MATE_MIXER_IS_STREAM_TOGGLE_CLASS
+MATE_MIXER_STREAM_TOGGLE
+MATE_MIXER_STREAM_TOGGLE_CLASS
+MATE_MIXER_STREAM_TOGGLE_GET_CLASS
+MATE_MIXER_TYPE_STREAM_TOGGLE
+<SUBSECTION Private>
+MateMixerStreamTogglePrivate
+mate_mixer_stream_toggle_get_type
+</SECTION>
+
+<SECTION>
<FILE>matemixer-switch</FILE>
<TITLE>MateMixerSwitch</TITLE>
MateMixerSwitchFlags
@@ -270,23 +290,3 @@ MATE_MIXER_TYPE_SWITCH_OPTION
MateMixerSwitchOptionPrivate
mate_mixer_switch_option_get_type
</SECTION>
-
-<SECTION>
-<FILE>matemixer-toggle</FILE>
-<TITLE>MateMixerToggle</TITLE>
-MateMixerToggle
-MateMixerToggleClass
-mate_mixer_toggle_get_state
-mate_mixer_toggle_set_state
-mate_mixer_toggle_get_state_option
-<SUBSECTION Standard>
-MATE_MIXER_IS_TOGGLE
-MATE_MIXER_IS_TOGGLE_CLASS
-MATE_MIXER_TOGGLE
-MATE_MIXER_TOGGLE_CLASS
-MATE_MIXER_TOGGLE_GET_CLASS
-MATE_MIXER_TYPE_TOGGLE
-<SUBSECTION Private>
-MateMixerTogglePrivate
-mate_mixer_toggle_get_type
-</SECTION>
diff --git a/libmatemixer/Makefile.am b/libmatemixer/Makefile.am
index f89f784..59f0e63 100644
--- a/libmatemixer/Makefile.am
+++ b/libmatemixer/Makefile.am
@@ -20,9 +20,9 @@ libmatemixer_include_HEADERS = \
matemixer-stream.h \
matemixer-stream-control.h \
matemixer-stream-switch.h \
+ matemixer-stream-toggle.h \
matemixer-switch.h \
matemixer-switch-option.h \
- matemixer-toggle.h \
matemixer-types.h \
matemixer-version.h
@@ -47,11 +47,11 @@ libmatemixer_la_SOURCES = \
matemixer-stream-control.c \
matemixer-stream-control-private.h \
matemixer-stream-switch.c \
+ matemixer-stream-toggle.c \
matemixer-switch.c \
matemixer-switch-private.h \
matemixer-switch-option.c \
- matemixer-switch-option-private.h \
- matemixer-toggle.c
+ matemixer-switch-option-private.h
libmatemixer_la_LIBADD = $(GLIB_LIBS)
diff --git a/libmatemixer/matemixer-toggle.c b/libmatemixer/matemixer-stream-toggle.c
index 78f7f5b..70c829e 100644
--- a/libmatemixer/matemixer-toggle.c
+++ b/libmatemixer/matemixer-stream-toggle.c
@@ -20,15 +20,15 @@
#include "matemixer-switch.h"
#include "matemixer-switch-option.h"
-#include "matemixer-toggle.h"
+#include "matemixer-stream-toggle.h"
/**
- * SECTION:matemixer-toggle
+ * SECTION:matemixer-stream-toggle
* @short_description: On/Off switch
* @include: libmatemixer/matemixer.h
*/
-struct _MateMixerTogglePrivate
+struct _MateMixerStreamTogglePrivate
{
GList *options;
MateMixerSwitchOption *on;
@@ -45,44 +45,44 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-static void mate_mixer_toggle_class_init (MateMixerToggleClass *klass);
+static void mate_mixer_stream_toggle_class_init (MateMixerStreamToggleClass *klass);
-static void mate_mixer_toggle_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void mate_mixer_toggle_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
+static void mate_mixer_stream_toggle_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void mate_mixer_stream_toggle_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
-static void mate_mixer_toggle_init (MateMixerToggle *toggle);
-static void mate_mixer_toggle_dispose (GObject *object);
+static void mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle);
+static void mate_mixer_stream_toggle_dispose (GObject *object);
-G_DEFINE_ABSTRACT_TYPE (MateMixerToggle, mate_mixer_toggle, MATE_MIXER_TYPE_SWITCH)
+G_DEFINE_ABSTRACT_TYPE (MateMixerStreamToggle, mate_mixer_stream_toggle, MATE_MIXER_TYPE_STREAM_SWITCH)
-static MateMixerSwitchOption *mate_mixer_toggle_get_option (MateMixerSwitch *swtch,
- const gchar *name);
+static MateMixerSwitchOption *mate_mixer_stream_toggle_get_option (MateMixerSwitch *swtch,
+ const gchar *name);
-static const GList * mate_mixer_toggle_list_options (MateMixerSwitch *swtch);
+static const GList * mate_mixer_stream_toggle_list_options (MateMixerSwitch *swtch);
static void
-mate_mixer_toggle_class_init (MateMixerToggleClass *klass)
+mate_mixer_stream_toggle_class_init (MateMixerStreamToggleClass *klass)
{
GObjectClass *object_class;
MateMixerSwitchClass *switch_class;
object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = mate_mixer_toggle_dispose;
- object_class->get_property = mate_mixer_toggle_get_property;
- object_class->set_property = mate_mixer_toggle_set_property;
+ object_class->dispose = mate_mixer_stream_toggle_dispose;
+ object_class->get_property = mate_mixer_stream_toggle_get_property;
+ object_class->set_property = mate_mixer_stream_toggle_set_property;
switch_class = MATE_MIXER_SWITCH_CLASS (klass);
- switch_class->get_option = mate_mixer_toggle_get_option;
- switch_class->list_options = mate_mixer_toggle_list_options;
+ switch_class->get_option = mate_mixer_stream_toggle_get_option;
+ switch_class->list_options = mate_mixer_stream_toggle_list_options;
/**
- * MateMixerToggle:state:
+ * MateMixerStreamToggle:state:
*
* The current state of the toggle. %TRUE corresponds to the 'on' state and
* %FALSE to the 'off' state.
@@ -96,7 +96,7 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass)
G_PARAM_STATIC_STRINGS);
/**
- * MateMixerToggle:on-state-option:
+ * MateMixerStreamToggle:on-state-option:
*
* The #MateMixerSwitchOption representing the 'on' value of the toggle.
*/
@@ -110,7 +110,7 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass)
G_PARAM_STATIC_STRINGS);
/**
- * MateMixerToggle:off-state-option:
+ * MateMixerStreamToggle:off-state-option:
*
* The #MateMixerSwitchOption representing the 'off' value of the toggle.
*/
@@ -125,22 +125,22 @@ mate_mixer_toggle_class_init (MateMixerToggleClass *klass)
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
- g_type_class_add_private (object_class, sizeof (MateMixerTogglePrivate));
+ g_type_class_add_private (object_class, sizeof (MateMixerStreamTogglePrivate));
}
static void
-mate_mixer_toggle_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+mate_mixer_stream_toggle_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- MateMixerToggle *toggle;
+ MateMixerStreamToggle *toggle;
- toggle = MATE_MIXER_TOGGLE (object);
+ toggle = MATE_MIXER_STREAM_TOGGLE (object);
switch (param_id) {
case PROP_STATE:
- g_value_set_boolean (value, mate_mixer_toggle_get_state (toggle));
+ g_value_set_boolean (value, mate_mixer_stream_toggle_get_state (toggle));
break;
case PROP_ON_STATE_OPTION:
g_value_set_object (value, toggle->priv->on);
@@ -156,18 +156,18 @@ mate_mixer_toggle_get_property (GObject *object,
}
static void
-mate_mixer_toggle_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+mate_mixer_stream_toggle_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- MateMixerToggle *toggle;
+ MateMixerStreamToggle *toggle;
- toggle = MATE_MIXER_TOGGLE (object);
+ toggle = MATE_MIXER_STREAM_TOGGLE (object);
switch (param_id) {
case PROP_STATE:
- mate_mixer_toggle_set_state (toggle, g_value_get_boolean (value));
+ mate_mixer_stream_toggle_set_state (toggle, g_value_get_boolean (value));
break;
case PROP_ON_STATE_OPTION:
/* Construct-only object */
@@ -185,19 +185,19 @@ mate_mixer_toggle_set_property (GObject *object,
}
static void
-mate_mixer_toggle_init (MateMixerToggle *toggle)
+mate_mixer_stream_toggle_init (MateMixerStreamToggle *toggle)
{
toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (toggle,
- MATE_MIXER_TYPE_TOGGLE,
- MateMixerTogglePrivate);
+ MATE_MIXER_TYPE_STREAM_TOGGLE,
+ MateMixerStreamTogglePrivate);
}
static void
-mate_mixer_toggle_dispose (GObject *object)
+mate_mixer_stream_toggle_dispose (GObject *object)
{
- MateMixerToggle *toggle;
+ MateMixerStreamToggle *toggle;
- toggle = MATE_MIXER_TOGGLE (object);
+ toggle = MATE_MIXER_STREAM_TOGGLE (object);
if (toggle->priv->options != NULL) {
g_list_free (toggle->priv->options);
@@ -207,12 +207,12 @@ mate_mixer_toggle_dispose (GObject *object)
g_clear_object (&toggle->priv->on);
g_clear_object (&toggle->priv->off);
- G_OBJECT_CLASS (mate_mixer_toggle_parent_class)->dispose (object);
+ G_OBJECT_CLASS (mate_mixer_stream_toggle_parent_class)->dispose (object);
}
/**
- * mate_mixer_toggle_get_state:
- * @toggle: a #MateMixerToggle
+ * mate_mixer_stream_toggle_get_state:
+ * @toggle: a #MateMixerStreamToggle
*
* Gets the current state of the toggle. %TRUE corresponds to the 'on' state and
* %FALSE to the 'off' state.
@@ -220,11 +220,11 @@ mate_mixer_toggle_dispose (GObject *object)
* Returns: %TRUE or %FALSE.
*/
gboolean
-mate_mixer_toggle_get_state (MateMixerToggle *toggle)
+mate_mixer_stream_toggle_get_state (MateMixerStreamToggle *toggle)
{
MateMixerSwitchOption *active;
- g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), FALSE);
+ g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), FALSE);
active = mate_mixer_switch_get_active_option (MATE_MIXER_SWITCH (toggle));
if G_UNLIKELY (active == NULL)
@@ -237,8 +237,8 @@ mate_mixer_toggle_get_state (MateMixerToggle *toggle)
}
/**
- * mate_mixer_toggle_get_state_option:
- * @toggle: a #MateMixerToggle
+ * mate_mixer_stream_toggle_get_state_option:
+ * @toggle: a #MateMixerStreamToggle
* @state: the state to get the #MateMixerSwitchOption for
*
* Gets the #MateMixerSwitchOption representing the selected state.
@@ -246,9 +246,9 @@ mate_mixer_toggle_get_state (MateMixerToggle *toggle)
* Returns: a #MateMixerSwitchOption.
*/
MateMixerSwitchOption *
-mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state)
+mate_mixer_stream_toggle_get_state_option (MateMixerStreamToggle *toggle, gboolean state)
{
- g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), NULL);
+ g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), NULL);
if (state == TRUE)
return toggle->priv->on;
@@ -257,8 +257,8 @@ mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state)
}
/**
- * mate_mixer_toggle_set_state:
- * @toggle: a #MateMixerToggle
+ * mate_mixer_stream_toggle_set_state:
+ * @toggle: a #MateMixerStreamToggle
* @state: the state to set
*
* Sets the @toggle to the selected state.
@@ -269,11 +269,11 @@ mate_mixer_toggle_get_state_option (MateMixerToggle *toggle, gboolean state)
* Returns: %TRUE on success or %FALSE on failure.
*/
gboolean
-mate_mixer_toggle_set_state (MateMixerToggle *toggle, gboolean state)
+mate_mixer_stream_toggle_set_state (MateMixerStreamToggle *toggle, gboolean state)
{
MateMixerSwitchOption *active;
- g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (toggle), FALSE);
+ g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (toggle), FALSE);
if (state == TRUE)
active = toggle->priv->on;
@@ -287,14 +287,14 @@ mate_mixer_toggle_set_state (MateMixerToggle *toggle, gboolean state)
}
static MateMixerSwitchOption *
-mate_mixer_toggle_get_option (MateMixerSwitch *swtch, const gchar *name)
+mate_mixer_stream_toggle_get_option (MateMixerSwitch *swtch, const gchar *name)
{
- MateMixerToggle *toggle;
+ MateMixerStreamToggle *toggle;
- g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (swtch), NULL);
+ g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (swtch), NULL);
g_return_val_if_fail (name != NULL, NULL);
- toggle = MATE_MIXER_TOGGLE (swtch);
+ toggle = MATE_MIXER_STREAM_TOGGLE (swtch);
if (g_strcmp0 (name, mate_mixer_switch_option_get_name (toggle->priv->on)) == 0)
return toggle->priv->on;
@@ -305,13 +305,13 @@ mate_mixer_toggle_get_option (MateMixerSwitch *swtch, const gchar *name)
}
static const GList *
-mate_mixer_toggle_list_options (MateMixerSwitch *swtch)
+mate_mixer_stream_toggle_list_options (MateMixerSwitch *swtch)
{
- MateMixerToggle *toggle;
+ MateMixerStreamToggle *toggle;
- g_return_val_if_fail (MATE_MIXER_IS_TOGGLE (swtch), NULL);
+ g_return_val_if_fail (MATE_MIXER_IS_STREAM_TOGGLE (swtch), NULL);
- toggle = MATE_MIXER_TOGGLE (swtch);
+ toggle = MATE_MIXER_STREAM_TOGGLE (swtch);
if (toggle->priv->options == NULL) {
if G_LIKELY (toggle->priv->off != NULL)
diff --git a/libmatemixer/matemixer-stream-toggle.h b/libmatemixer/matemixer-stream-toggle.h
new file mode 100644
index 0000000..7417568
--- /dev/null
+++ b/libmatemixer/matemixer-stream-toggle.h
@@ -0,0 +1,81 @@
+/*
+ * 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_STREAM_TOGGLE_H
+#define MATEMIXER_STREAM_TOGGLE_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libmatemixer/matemixer-stream-switch.h>
+#include <libmatemixer/matemixer-types.h>
+
+G_BEGIN_DECLS
+
+#define MATE_MIXER_TYPE_STREAM_TOGGLE \
+ (mate_mixer_stream_toggle_get_type ())
+#define MATE_MIXER_STREAM_TOGGLE(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggle))
+#define MATE_MIXER_IS_STREAM_TOGGLE(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_STREAM_TOGGLE))
+#define MATE_MIXER_STREAM_TOGGLE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggleClass))
+#define MATE_MIXER_IS_STREAM_TOGGLE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_STREAM_TOGGLE))
+#define MATE_MIXER_STREAM_TOGGLE_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_STREAM_TOGGLE, MateMixerStreamToggleClass))
+
+typedef struct _MateMixerStreamToggleClass MateMixerStreamToggleClass;
+typedef struct _MateMixerStreamTogglePrivate MateMixerStreamTogglePrivate;
+
+/**
+ * MateMixerStreamToggle:
+ *
+ * The #MateMixerStreamToggle structure contains only private data and should only
+ * be accessed using the provided API.
+ */
+struct _MateMixerStreamToggle
+{
+ MateMixerStreamSwitch object;
+
+ /*< private >*/
+ MateMixerStreamTogglePrivate *priv;
+};
+
+/**
+ * MateMixerStreamToggleClass:
+ * @parent_class: The parent class.
+ *
+ * The class structure for #MateMixerStreamToggle.
+ */
+struct _MateMixerStreamToggleClass
+{
+ MateMixerStreamSwitchClass parent_class;
+};
+
+GType mate_mixer_stream_toggle_get_type (void) G_GNUC_CONST;
+
+gboolean mate_mixer_stream_toggle_get_state (MateMixerStreamToggle *toggle);
+gboolean mate_mixer_stream_toggle_set_state (MateMixerStreamToggle *toggle,
+ gboolean state);
+
+MateMixerSwitchOption *mate_mixer_stream_toggle_get_state_option (MateMixerStreamToggle *toggle,
+ gboolean state);
+
+G_END_DECLS
+
+#endif /* MATEMIXER_STREAM_TOGGLE_H */
diff --git a/libmatemixer/matemixer-toggle.h b/libmatemixer/matemixer-toggle.h
deleted file mode 100644
index 09e8943..0000000
--- a/libmatemixer/matemixer-toggle.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_TOGGLE_H
-#define MATEMIXER_TOGGLE_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libmatemixer/matemixer-types.h>
-
-G_BEGIN_DECLS
-
-#define MATE_MIXER_TYPE_TOGGLE \
- (mate_mixer_toggle_get_type ())
-#define MATE_MIXER_TOGGLE(o) \
- (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_TOGGLE, MateMixerToggle))
-#define MATE_MIXER_IS_TOGGLE(o) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_TOGGLE))
-#define MATE_MIXER_TOGGLE_CLASS(k) \
- (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_TOGGLE, MateMixerToggleClass))
-#define MATE_MIXER_IS_TOGGLE_CLASS(k) \
- (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_TOGGLE))
-#define MATE_MIXER_TOGGLE_GET_CLASS(o) \
- (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_TOGGLE, MateMixerToggleClass))
-
-typedef struct _MateMixerToggleClass MateMixerToggleClass;
-typedef struct _MateMixerTogglePrivate MateMixerTogglePrivate;
-
-/**
- * MateMixerToggle:
- *
- * The #MateMixerToggle structure contains only private data and should only
- * be accessed using the provided API.
- */
-struct _MateMixerToggle
-{
- MateMixerSwitch object;
-
- /*< private >*/
- MateMixerTogglePrivate *priv;
-};
-
-/**
- * MateMixerToggleClass:
- * @parent_class: The parent class.
- *
- * The class structure for #MateMixerToggle.
- */
-struct _MateMixerToggleClass
-{
- MateMixerSwitchClass parent_class;
-};
-
-GType mate_mixer_toggle_get_type (void) G_GNUC_CONST;
-
-gboolean mate_mixer_toggle_get_state (MateMixerToggle *toggle);
-gboolean mate_mixer_toggle_set_state (MateMixerToggle *toggle,
- gboolean state);
-
-MateMixerSwitchOption *mate_mixer_toggle_get_state_option (MateMixerToggle *toggle,
- gboolean state);
-
-G_END_DECLS
-
-#endif /* MATEMIXER_TOGGLE_H */
diff --git a/libmatemixer/matemixer-types.h b/libmatemixer/matemixer-types.h
index 1d116d1..8ed2ab2 100644
--- a/libmatemixer/matemixer-types.h
+++ b/libmatemixer/matemixer-types.h
@@ -28,9 +28,9 @@ typedef struct _MateMixerStoredControl MateMixerStoredControl;
typedef struct _MateMixerStream MateMixerStream;
typedef struct _MateMixerStreamControl MateMixerStreamControl;
typedef struct _MateMixerStreamSwitch MateMixerStreamSwitch;
+typedef struct _MateMixerStreamToggle MateMixerStreamToggle;
typedef struct _MateMixerSwitch MateMixerSwitch;
typedef struct _MateMixerSwitchOption MateMixerSwitchOption;
-typedef struct _MateMixerToggle MateMixerToggle;
G_END_DECLS
diff --git a/libmatemixer/matemixer.h b/libmatemixer/matemixer.h
index 2df604d..309c30c 100644
--- a/libmatemixer/matemixer.h
+++ b/libmatemixer/matemixer.h
@@ -33,9 +33,9 @@
#include <libmatemixer/matemixer-stream.h>
#include <libmatemixer/matemixer-stream-control.h>
#include <libmatemixer/matemixer-stream-switch.h>
+#include <libmatemixer/matemixer-stream-toggle.h>
#include <libmatemixer/matemixer-switch.h>
#include <libmatemixer/matemixer-switch-option.h>
-#include <libmatemixer/matemixer-toggle.h>
#include <libmatemixer/matemixer-version.h>
G_BEGIN_DECLS