summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/alsa/alsa-backend.c23
-rw-r--r--backends/alsa/alsa-device.c25
-rw-r--r--backends/alsa/alsa-stream.c30
-rw-r--r--backends/oss/oss-backend.c23
-rw-r--r--backends/oss/oss-device.c15
-rw-r--r--backends/oss/oss-stream.c12
-rw-r--r--backends/pulse/pulse-backend.c49
-rw-r--r--backends/pulse/pulse-device.c12
-rw-r--r--backends/pulse/pulse-sink.c12
-rw-r--r--backends/pulse/pulse-source.c12
-rw-r--r--examples/monitor.c16
-rw-r--r--libmatemixer/matemixer-backend.c90
-rw-r--r--libmatemixer/matemixer-backend.h26
-rw-r--r--libmatemixer/matemixer-context.c134
-rw-r--r--libmatemixer/matemixer-context.h26
-rw-r--r--libmatemixer/matemixer-device.c16
-rw-r--r--libmatemixer/matemixer-device.h17
-rw-r--r--libmatemixer/matemixer-stream.c16
-rw-r--r--libmatemixer/matemixer-stream.h18
19 files changed, 239 insertions, 333 deletions
diff --git a/backends/alsa/alsa-backend.c b/backends/alsa/alsa-backend.c
index 45bee15..6445057 100644
--- a/backends/alsa/alsa-backend.c
+++ b/backends/alsa/alsa-backend.c
@@ -79,7 +79,7 @@ static void remove_device_by_list_item (AlsaBackend *alsa,
GList *item);
static void remove_stream (AlsaBackend *alsa,
- const gchar *name);
+ MateMixerStream *stream);
static void select_default_input_stream (AlsaBackend *alsa);
static void select_default_output_stream (AlsaBackend *alsa);
@@ -401,7 +401,7 @@ add_device (AlsaBackend *alsa, AlsaDevice *device)
g_signal_emit_by_name (G_OBJECT (alsa),
"device-added",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
+ MATE_MIXER_DEVICE (device));
/* Load the device elements after emitting device-added, because the load
* function will most likely emit stream-added on the device and backend */
@@ -451,29 +451,24 @@ remove_device_by_list_item (AlsaBackend *alsa, GList *item)
g_hash_table_remove (alsa->priv->devices_ids,
ALSA_DEVICE_GET_ID (device));
- /* The list may have been invalidated by device signals */
- free_stream_list (alsa);
-
g_signal_emit_by_name (G_OBJECT (alsa),
"device-removed",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
+ MATE_MIXER_DEVICE (device));
g_object_unref (device);
}
static void
-remove_stream (AlsaBackend *alsa, const gchar *name)
+remove_stream (AlsaBackend *alsa, MateMixerStream *stream)
{
- MateMixerStream *stream;
+ MateMixerStream *def;
- stream = mate_mixer_backend_get_default_input_stream (MATE_MIXER_BACKEND (alsa));
-
- if (stream != NULL && strcmp (mate_mixer_stream_get_name (stream), name) == 0)
+ def = mate_mixer_backend_get_default_input_stream (MATE_MIXER_BACKEND (alsa));
+ if (def == stream)
select_default_input_stream (alsa);
- stream = mate_mixer_backend_get_default_output_stream (MATE_MIXER_BACKEND (alsa));
-
- if (stream != NULL && strcmp (mate_mixer_stream_get_name (stream), name) == 0)
+ def = mate_mixer_backend_get_default_output_stream (MATE_MIXER_BACKEND (alsa));
+ if (def == stream)
select_default_output_stream (alsa);
}
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c
index fb12447..2064f79 100644
--- a/backends/alsa/alsa-device.c
+++ b/backends/alsa/alsa-device.c
@@ -338,27 +338,21 @@ alsa_device_close (AlsaDevice *device)
/* Make each stream remove its controls and switches */
if (alsa_stream_has_controls_or_switches (device->priv->input) == TRUE) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->input));
-
alsa_stream_remove_all (device->priv->input);
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- name);
+ MATE_MIXER_STREAM (device->priv->input));
}
if (alsa_stream_has_controls_or_switches (device->priv->output) == TRUE) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->output));
-
alsa_stream_remove_all (device->priv->output);
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- name);
+ MATE_MIXER_STREAM (device->priv->output));
}
close_mixer (device);
@@ -481,16 +475,13 @@ add_element (AlsaDevice *device, AlsaStream *stream, AlsaElement *element)
}
if (add_stream == TRUE) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
free_stream_list (device);
/* Pretend the stream has just been created now that we have added
* the first control */
g_signal_emit_by_name (G_OBJECT (device),
"stream-added",
- name);
+ MATE_MIXER_STREAM (stream));
}
el = alsa_element_get_snd_element (element);
@@ -764,26 +755,20 @@ remove_elements_by_name (AlsaDevice *device, const gchar *name)
if (alsa_stream_remove_elements (device->priv->input, name) == TRUE) {
/* Removing last stream element "removes" the stream */
if (alsa_stream_has_controls_or_switches (device->priv->input) == FALSE) {
- const gchar *stream_name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->input));
-
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- stream_name);
+ MATE_MIXER_STREAM (device->priv->input));
}
}
if (alsa_stream_remove_elements (device->priv->output, name) == TRUE) {
/* Removing last stream element "removes" the stream */
if (alsa_stream_has_controls_or_switches (device->priv->output) == FALSE) {
- const gchar *stream_name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->output));
-
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- stream_name);
+ MATE_MIXER_STREAM (device->priv->output));
}
}
}
diff --git a/backends/alsa/alsa-stream.c b/backends/alsa/alsa-stream.c
index fc72f65..7e9c89f 100644
--- a/backends/alsa/alsa-stream.c
+++ b/backends/alsa/alsa-stream.c
@@ -113,19 +113,15 @@ alsa_stream_new (const gchar *name,
void
alsa_stream_add_control (AlsaStream *stream, AlsaStreamControl *control)
{
- const gchar *name;
-
g_return_if_fail (ALSA_IS_STREAM (stream));
g_return_if_fail (ALSA_IS_STREAM_CONTROL (control));
- name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (control));
-
stream->priv->controls =
g_list_append (stream->priv->controls, g_object_ref (control));
g_signal_emit_by_name (G_OBJECT (stream),
"control-added",
- name);
+ MATE_MIXER_STREAM_CONTROL (control));
if (alsa_stream_has_default_control (stream) == FALSE)
alsa_stream_set_default_control (stream, control);
@@ -134,38 +130,30 @@ alsa_stream_add_control (AlsaStream *stream, AlsaStreamControl *control)
void
alsa_stream_add_switch (AlsaStream *stream, AlsaSwitch *swtch)
{
- const gchar *name;
-
g_return_if_fail (ALSA_IS_STREAM (stream));
g_return_if_fail (ALSA_IS_SWITCH (swtch));
- name = mate_mixer_switch_get_name (MATE_MIXER_SWITCH (swtch));
-
stream->priv->switches =
g_list_append (stream->priv->switches, g_object_ref (swtch));
g_signal_emit_by_name (G_OBJECT (stream),
"switch-added",
- name);
+ MATE_MIXER_STREAM_SWITCH (swtch));
}
void
alsa_stream_add_toggle (AlsaStream *stream, AlsaToggle *toggle)
{
- const gchar *name;
-
g_return_if_fail (ALSA_IS_STREAM (stream));
g_return_if_fail (ALSA_IS_TOGGLE (toggle));
- name = mate_mixer_switch_get_name (MATE_MIXER_SWITCH (toggle));
-
/* Toggle is MateMixerSwitch, but not AlsaSwitch */
stream->priv->switches =
g_list_append (stream->priv->switches, g_object_ref (toggle));
g_signal_emit_by_name (G_OBJECT (stream),
"switch-added",
- name);
+ MATE_MIXER_STREAM_SWITCH (toggle));
}
gboolean
@@ -285,7 +273,7 @@ alsa_stream_remove_elements (AlsaStream *stream, const gchar *name)
g_signal_emit_by_name (G_OBJECT (stream),
"control-removed",
- mate_mixer_stream_control_get_name (control));
+ control);
g_object_unref (control);
removed = TRUE;
@@ -293,14 +281,14 @@ alsa_stream_remove_elements (AlsaStream *stream, const gchar *name)
item = g_list_find_custom (stream->priv->switches, name, compare_switch_name);
if (item != NULL) {
- MateMixerSwitch *swtch = MATE_MIXER_SWITCH (item->data);
+ MateMixerStreamSwitch *swtch = MATE_MIXER_STREAM_SWITCH (item->data);
alsa_element_close (ALSA_ELEMENT (swtch));
stream->priv->switches = g_list_delete_link (stream->priv->switches, item);
g_signal_emit_by_name (G_OBJECT (stream),
"switch-removed",
- mate_mixer_switch_get_name (swtch));
+ swtch);
g_object_unref (swtch);
removed = TRUE;
@@ -327,7 +315,7 @@ alsa_stream_remove_all (AlsaStream *stream)
stream->priv->controls = g_list_delete_link (stream->priv->controls, list);
g_signal_emit_by_name (G_OBJECT (stream),
"control-removed",
- mate_mixer_stream_control_get_name (control));
+ control);
g_object_unref (control);
list = next;
@@ -339,7 +327,7 @@ alsa_stream_remove_all (AlsaStream *stream)
/* Remove all stream switches */
list = stream->priv->switches;
while (list != NULL) {
- MateMixerSwitch *swtch = MATE_MIXER_SWITCH (list->data);
+ MateMixerStreamSwitch *swtch = MATE_MIXER_STREAM_SWITCH (list->data);
GList *next = list->next;
alsa_element_close (ALSA_ELEMENT (swtch));
@@ -347,7 +335,7 @@ alsa_stream_remove_all (AlsaStream *stream)
stream->priv->switches = g_list_delete_link (stream->priv->switches, list);
g_signal_emit_by_name (G_OBJECT (stream),
"switch-removed",
- mate_mixer_switch_get_name (swtch));
+ swtch);
g_object_unref (swtch);
list = next;
diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c
index 9726570..159107d 100644
--- a/backends/oss/oss-backend.c
+++ b/backends/oss/oss-backend.c
@@ -96,7 +96,7 @@ static void remove_device_by_list_item (OssBackend *oss,
GList *item);
static void remove_stream (OssBackend *oss,
- const gchar *name);
+ MateMixerStream *stream);
static void select_default_input_stream (OssBackend *oss);
static void select_default_output_stream (OssBackend *oss);
@@ -502,7 +502,7 @@ add_device (OssBackend *oss, OssDevice *device)
g_signal_emit_by_name (G_OBJECT (oss),
"device-added",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
+ MATE_MIXER_DEVICE (device));
/* Load the device elements after emitting device-added, because the load
* function will most likely emit stream-added on the device and backend */
@@ -558,29 +558,24 @@ remove_device_by_list_item (OssBackend *oss, GList *item)
oss->priv->default_device = NULL;
}
- /* The list may have been invalidated by device signals */
- free_stream_list (oss);
-
g_signal_emit_by_name (G_OBJECT (oss),
"device-removed",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
+ MATE_MIXER_DEVICE (device));
g_object_unref (device);
}
static void
-remove_stream (OssBackend *oss, const gchar *name)
+remove_stream (OssBackend *oss, MateMixerStream *stream)
{
- MateMixerStream *stream;
+ MateMixerStream *def;
- stream = mate_mixer_backend_get_default_input_stream (MATE_MIXER_BACKEND (oss));
-
- if (stream != NULL && strcmp (mate_mixer_stream_get_name (stream), name) == 0)
+ def = mate_mixer_backend_get_default_input_stream (MATE_MIXER_BACKEND (oss));
+ if (def == stream)
select_default_input_stream (oss);
- stream = mate_mixer_backend_get_default_output_stream (MATE_MIXER_BACKEND (oss));
-
- if (stream != NULL && strcmp (mate_mixer_stream_get_name (stream), name) == 0)
+ def = mate_mixer_backend_get_default_output_stream (MATE_MIXER_BACKEND (oss));
+ if (def == stream)
select_default_output_stream (oss);
}
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index 70f46e6..8398aed 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -362,29 +362,23 @@ oss_device_close (OssDevice *device)
/* Make each stream remove its controls and switch */
if (device->priv->input != NULL) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->input));
-
oss_stream_remove_all (device->priv->input);
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- name);
+ MATE_MIXER_STREAM (device->priv->input));
g_clear_object (&device->priv->input);
}
if (device->priv->output != NULL) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (device->priv->output));
-
oss_stream_remove_all (device->priv->output);
free_stream_list (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- name);
+ MATE_MIXER_STREAM (device->priv->output));
g_clear_object (&device->priv->output);
}
@@ -596,16 +590,13 @@ read_mixer_devices (OssDevice *device)
continue;
if (oss_stream_has_controls (stream) == FALSE) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
free_stream_list (device);
/* Pretend the stream has just been created now that we are adding
* the first control */
g_signal_emit_by_name (G_OBJECT (device),
"stream-added",
- name);
+ MATE_MIXER_STREAM (stream));
}
g_debug ("Adding device %s control %s",
diff --git a/backends/oss/oss-stream.c b/backends/oss/oss-stream.c
index f094537..7727dad 100644
--- a/backends/oss/oss-stream.c
+++ b/backends/oss/oss-stream.c
@@ -112,19 +112,15 @@ oss_stream_new (const gchar *name,
void
oss_stream_add_control (OssStream *stream, OssStreamControl *control)
{
- const gchar *name;
-
g_return_if_fail (OSS_IS_STREAM (stream));
g_return_if_fail (OSS_IS_STREAM_CONTROL (control));
- name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (control));
-
stream->priv->controls =
g_list_append (stream->priv->controls, g_object_ref (control));
g_signal_emit_by_name (G_OBJECT (stream),
"control-added",
- name);
+ MATE_MIXER_STREAM_CONTROL (control));
}
void
@@ -223,7 +219,7 @@ oss_stream_set_switch_data (OssStream *stream, gint fd, GList *options)
stream->priv->switches = g_list_prepend (NULL, g_object_ref (stream->priv->swtch));
g_signal_emit_by_name (G_OBJECT (stream),
"switch-added",
- OSS_STREAM_SWITCH_NAME);
+ MATE_MIXER_STREAM_SWITCH (stream->priv->swtch));
}
void
@@ -243,7 +239,7 @@ oss_stream_remove_all (OssStream *stream)
stream->priv->controls = g_list_delete_link (stream->priv->controls, list);
g_signal_emit_by_name (G_OBJECT (stream),
"control-removed",
- mate_mixer_stream_control_get_name (control));
+ control);
g_object_unref (control);
list = next;
@@ -260,7 +256,7 @@ oss_stream_remove_all (OssStream *stream)
g_signal_emit_by_name (G_OBJECT (stream),
"switch-removed",
- OSS_STREAM_SWITCH_NAME);
+ MATE_MIXER_STREAM_SWITCH (stream->priv->swtch));
g_clear_object (&stream->priv->swtch);
}
diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c
index 9b483b9..88926be 100644
--- a/backends/pulse/pulse-backend.c
+++ b/backends/pulse/pulse-backend.c
@@ -779,7 +779,7 @@ on_connection_card_info (PulseConnection *connection,
free_list_devices (pulse);
g_signal_emit_by_name (G_OBJECT (pulse),
"device-added",
- mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
+ MATE_MIXER_DEVICE (device));
} else
pulse_device_update (device, info);
}
@@ -790,21 +790,20 @@ on_connection_card_removed (PulseConnection *connection,
PulseBackend *pulse)
{
PulseDevice *device;
- gchar *name;
device = g_hash_table_lookup (pulse->priv->devices, GUINT_TO_POINTER (index));
if G_UNLIKELY (device == NULL)
return;
- name = g_strdup (mate_mixer_device_get_name (MATE_MIXER_DEVICE (device)));
-
+ g_object_ref (device);
g_hash_table_remove (pulse->priv->devices, GUINT_TO_POINTER (index));
free_list_devices (pulse);
g_signal_emit_by_name (G_OBJECT (pulse),
"device-removed",
- name);
- g_free (name);
+ MATE_MIXER_DEVICE (device));
+
+ g_object_unref (device);
}
static void
@@ -832,15 +831,13 @@ on_connection_sink_info (PulseConnection *connection,
if (device != NULL) {
pulse_device_add_stream (device, stream);
} else {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
- /* Only emit when not a part of the device, otherwise emitted by
+ /* Only emit when not a part of a device, otherwise emitted by
* the main library */
g_signal_emit_by_name (G_OBJECT (pulse),
"stream-added",
- name);
+ MATE_MIXER_STREAM (stream));
}
+
/* We might be waiting for this sink to set it as the default */
check_pending_sink (pulse, stream);
} else
@@ -860,17 +857,19 @@ on_connection_sink_removed (PulseConnection *connection,
return;
g_object_ref (stream);
-
g_hash_table_remove (pulse->priv->sinks, GUINT_TO_POINTER (idx));
+
free_list_streams (pulse);
device = pulse_stream_get_device (stream);
if (device != NULL) {
pulse_device_remove_stream (device, stream);
} else {
+ /* Only emit when not a part of a device, otherwise emitted by
+ * the main library */
g_signal_emit_by_name (G_OBJECT (pulse),
"stream-removed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
+ MATE_MIXER_STREAM (stream));
}
/* The removed stream might be one of the default streams, this happens
@@ -969,15 +968,13 @@ on_connection_source_info (PulseConnection *connection,
if (device != NULL) {
pulse_device_add_stream (device, stream);
} else {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
- /* Only emit when not a part of the device, otherwise emitted by
+ /* Only emit when not a part of a device, otherwise emitted by
* the main library */
g_signal_emit_by_name (G_OBJECT (pulse),
"stream-added",
- name);
+ MATE_MIXER_STREAM (stream));
}
+
/* We might be waiting for this source to set it as the default */
check_pending_source (pulse, stream);
} else
@@ -1005,9 +1002,11 @@ on_connection_source_removed (PulseConnection *connection,
if (device != NULL) {
pulse_device_remove_stream (device, stream);
} else {
+ /* Only emit when not a part of a device, otherwise emitted by
+ * the main library */
g_signal_emit_by_name (G_OBJECT (pulse),
"stream-removed",
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream)));
+ MATE_MIXER_STREAM (stream));
}
/* The removed stream might be one of the default streams, this happens
@@ -1110,7 +1109,7 @@ on_connection_ext_stream_info (PulseConnection *connection,
g_signal_emit_by_name (G_OBJECT (pulse),
"stored-control-added",
- mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (ext)));
+ MATE_MIXER_STORED_CONTROL (ext));
} else {
pulse_ext_stream_update (ext, info, parent);
@@ -1136,21 +1135,23 @@ static void
on_connection_ext_stream_loaded (PulseConnection *connection, PulseBackend *pulse)
{
GHashTableIter iter;
- gpointer name;
gpointer ext;
g_hash_table_iter_init (&iter, pulse->priv->ext_streams);
- while (g_hash_table_iter_next (&iter, &name, &ext) == TRUE) {
+ while (g_hash_table_iter_next (&iter, NULL, &ext) == TRUE) {
if (PULSE_GET_HANGING (ext) == FALSE)
continue;
+ g_object_ref (G_OBJECT (ext));
g_hash_table_iter_remove (&iter);
- free_list_ext_streams (pulse);
+ free_list_ext_streams (pulse);
g_signal_emit_by_name (G_OBJECT (pulse),
"stored-control-removed",
- name);
+ MATE_MIXER_STORED_CONTROL (ext));
+
+ g_object_unref (G_OBJECT (ext));
}
}
diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c
index 9b75ca4..c65f304 100644
--- a/backends/pulse/pulse-device.c
+++ b/backends/pulse/pulse-device.c
@@ -280,7 +280,6 @@ pulse_device_add_stream (PulseDevice *device, PulseStream *stream)
g_return_if_fail (PULSE_IS_STREAM (stream));
name = mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
g_hash_table_insert (device->priv->streams,
g_strdup (name),
g_object_ref (stream));
@@ -289,7 +288,7 @@ pulse_device_add_stream (PulseDevice *device, PulseStream *stream)
g_signal_emit_by_name (G_OBJECT (device),
"stream-added",
- name);
+ MATE_MIXER_STREAM (stream));
}
void
@@ -302,12 +301,15 @@ pulse_device_remove_stream (PulseDevice *device, PulseStream *stream)
name = mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
- free_list_streams (device);
-
+ g_object_ref (stream);
g_hash_table_remove (device->priv->streams, name);
+
+ free_list_streams (device);
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- name);
+ MATE_MIXER_STREAM (stream));
+
+ g_object_unref (stream);
}
guint32
diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c
index 3f9573d..9edf185 100644
--- a/backends/pulse/pulse-sink.c
+++ b/backends/pulse/pulse-sink.c
@@ -196,7 +196,6 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
/* This function is used for both creating and refreshing sink inputs */
input = g_hash_table_lookup (sink->priv->inputs, GUINT_TO_POINTER (info->index));
if (input == NULL) {
- const gchar *name;
PulseConnection *connection;
connection = pulse_stream_get_connection (PULSE_STREAM (sink));
@@ -210,10 +209,9 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
free_list_controls (sink);
- name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (input));
g_signal_emit_by_name (G_OBJECT (sink),
"control-added",
- name);
+ MATE_MIXER_STREAM_CONTROL (input));
return TRUE;
}
@@ -225,7 +223,6 @@ void
pulse_sink_remove_input (PulseSink *sink, guint32 index)
{
PulseSinkInput *input;
- gchar *name;
g_return_if_fail (PULSE_IS_SINK (sink));
@@ -233,15 +230,14 @@ pulse_sink_remove_input (PulseSink *sink, guint32 index)
if G_UNLIKELY (input == NULL)
return;
- name = g_strdup (mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (input)));
-
+ g_object_ref (input);
g_hash_table_remove (sink->priv->inputs, GUINT_TO_POINTER (index));
free_list_controls (sink);
g_signal_emit_by_name (G_OBJECT (sink),
"control-removed",
- name);
- g_free (name);
+ MATE_MIXER_STREAM_CONTROL (input));
+ g_object_unref (input);
}
void
diff --git a/backends/pulse/pulse-source.c b/backends/pulse/pulse-source.c
index b70cbe4..6393743 100644
--- a/backends/pulse/pulse-source.c
+++ b/backends/pulse/pulse-source.c
@@ -193,7 +193,6 @@ pulse_source_add_output (PulseSource *source, const pa_source_output_info *info)
/* This function is used for both creating and refreshing source outputs */
output = g_hash_table_lookup (source->priv->outputs, GUINT_TO_POINTER (info->index));
if (output == NULL) {
- const gchar *name;
PulseConnection *connection;
connection = pulse_stream_get_connection (PULSE_STREAM (source));
@@ -206,10 +205,9 @@ pulse_source_add_output (PulseSource *source, const pa_source_output_info *info)
free_list_controls (source);
- name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (output));
g_signal_emit_by_name (G_OBJECT (source),
"control-added",
- name);
+ MATE_MIXER_STREAM_CONTROL (output));
return TRUE;
}
@@ -221,7 +219,6 @@ void
pulse_source_remove_output (PulseSource *source, guint32 index)
{
PulseSourceOutput *output;
- gchar *name;
g_return_if_fail (PULSE_IS_SOURCE (source));
@@ -229,15 +226,14 @@ pulse_source_remove_output (PulseSource *source, guint32 index)
if G_UNLIKELY (output == NULL)
return;
- name = g_strdup (mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (output)));
-
+ g_object_ref (output);
g_hash_table_remove (source->priv->outputs, GUINT_TO_POINTER (index));
free_list_controls (source);
g_signal_emit_by_name (G_OBJECT (source),
"control-removed",
- name);
- g_free (name);
+ MATE_MIXER_STREAM_CONTROL (output));
+ g_object_unref (output);
}
void
diff --git a/examples/monitor.c b/examples/monitor.c
index 0c7155f..28288d3 100644
--- a/examples/monitor.c
+++ b/examples/monitor.c
@@ -327,27 +327,27 @@ on_context_state_notify (void)
}
static void
-on_context_device_added (MateMixerContext *context, const gchar *name)
+on_context_device_added (MateMixerContext *context, MateMixerDevice *device)
{
- g_print ("Device added: %s\n", name);
+ g_print ("Device added: %s\n", mate_mixer_device_get_name (device));
}
static void
-on_context_device_removed (MateMixerContext *context, const gchar *name)
+on_context_device_removed (MateMixerContext *context, MateMixerDevice *device)
{
- g_print ("Device removed: %s\n", name);
+ g_print ("Device removed: %s\n", mate_mixer_device_get_name (device));
}
static void
-on_context_stream_added (MateMixerContext *context, const gchar *name)
+on_context_stream_added (MateMixerContext *context, MateMixerStream *stream)
{
- g_print ("Stream added: %s\n", name);
+ g_print ("Stream added: %s\n", mate_mixer_stream_get_name (stream));
}
static void
-on_context_stream_removed (MateMixerContext *context, const gchar *name)
+on_context_stream_removed (MateMixerContext *context, MateMixerStream *stream)
{
- g_print ("Stream removed: %s\n", name);
+ g_print ("Stream removed: %s\n", mate_mixer_stream_get_name (stream));
}
#ifdef G_OS_UNIX
diff --git a/libmatemixer/matemixer-backend.c b/libmatemixer/matemixer-backend.c
index 682bf68..e199518 100644
--- a/libmatemixer/matemixer-backend.c
+++ b/libmatemixer/matemixer-backend.c
@@ -29,7 +29,6 @@
struct _MateMixerBackendPrivate
{
- GHashTable *devices;
MateMixerStream *default_input;
MateMixerStream *default_output;
MateMixerState state;
@@ -72,19 +71,18 @@ static void mate_mixer_backend_set_property (GObject *object,
GParamSpec *pspec);
static void mate_mixer_backend_dispose (GObject *object);
-static void mate_mixer_backend_finalize (GObject *object);
G_DEFINE_ABSTRACT_TYPE (MateMixerBackend, mate_mixer_backend, G_TYPE_OBJECT)
static void device_added (MateMixerBackend *backend,
- const gchar *name);
+ MateMixerDevice *device);
static void device_removed (MateMixerBackend *backend,
- const gchar *name);
+ MateMixerDevice *device);
static void device_stream_added (MateMixerBackend *backend,
- const gchar *name);
+ MateMixerStream *stream);
static void device_stream_removed (MateMixerBackend *backend,
- const gchar *name);
+ MateMixerStream *stream);
static void
mate_mixer_backend_class_init (MateMixerBackendClass *klass)
@@ -93,7 +91,6 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
object_class = G_OBJECT_CLASS (klass);
object_class->dispose = mate_mixer_backend_dispose;
- object_class->finalize = mate_mixer_backend_finalize;
object_class->get_property = mate_mixer_backend_get_property;
object_class->set_property = mate_mixer_backend_set_property;
@@ -131,10 +128,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, device_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE);
signals[DEVICE_REMOVED] =
g_signal_new ("device-removed",
@@ -143,10 +140,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, device_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE);
signals[STREAM_ADDED] =
g_signal_new ("stream-added",
@@ -155,10 +152,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, stream_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
signals[STREAM_REMOVED] =
g_signal_new ("stream-removed",
@@ -167,10 +164,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, stream_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
signals[STORED_CONTROL_ADDED] =
g_signal_new ("stored-control-added",
@@ -179,10 +176,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, stored_control_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STORED_CONTROL);
signals[STORED_CONTROL_REMOVED] =
g_signal_new ("stored-control-removed",
@@ -191,10 +188,10 @@ mate_mixer_backend_class_init (MateMixerBackendClass *klass)
G_STRUCT_OFFSET (MateMixerBackendClass, stored_control_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STORED_CONTROL);
g_type_class_add_private (object_class, sizeof (MateMixerBackendPrivate));
}
@@ -257,11 +254,6 @@ mate_mixer_backend_init (MateMixerBackend *backend)
MATE_MIXER_TYPE_BACKEND,
MateMixerBackendPrivate);
- backend->priv->devices = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_object_unref);
-
g_signal_connect (G_OBJECT (backend),
"device-added",
G_CALLBACK (device_added),
@@ -283,23 +275,9 @@ mate_mixer_backend_dispose (GObject *object)
g_clear_object (&backend->priv->default_input);
g_clear_object (&backend->priv->default_output);
- g_hash_table_remove_all (backend->priv->devices);
-
G_OBJECT_CLASS (mate_mixer_backend_parent_class)->dispose (object);
}
-static void
-mate_mixer_backend_finalize (GObject *object)
-{
- MateMixerBackend *backend;
-
- backend = MATE_MIXER_BACKEND (object);
-
- g_hash_table_unref (backend->priv->devices);
-
- G_OBJECT_CLASS (mate_mixer_backend_parent_class)->finalize (object);
-}
-
void
mate_mixer_backend_set_app_info (MateMixerBackend *backend, MateMixerAppInfo *info)
{
@@ -532,22 +510,8 @@ mate_mixer_backend_set_default_output_stream (MateMixerBackend *backend,
}
static void
-device_added (MateMixerBackend *backend, const gchar *name)
+device_added (MateMixerBackend *backend, MateMixerDevice *device)
{
- MateMixerDevice *device;
-
- device = mate_mixer_backend_get_device (backend, name);
- if G_UNLIKELY (device == NULL) {
- g_warn_if_reached ();
- return;
- }
-
- /* Keep the device in a hash table as it won't be possible to retrieve
- * it when the remove signal is received */
- g_hash_table_insert (backend->priv->devices,
- g_strdup (name),
- g_object_ref (device));
-
/* Connect to the stream signals from devices so we can forward them on
* the backend */
g_signal_connect_swapped (G_OBJECT (device),
@@ -561,42 +525,32 @@ device_added (MateMixerBackend *backend, const gchar *name)
}
static void
-device_removed (MateMixerBackend *backend, const gchar *name)
+device_removed (MateMixerBackend *backend, MateMixerDevice *device)
{
- MateMixerDevice *device;
-
- device = g_hash_table_lookup (backend->priv->devices, name);
- if G_UNLIKELY (device == NULL) {
- g_warn_if_reached ();
- return;
- }
-
g_signal_handlers_disconnect_by_func (G_OBJECT (device),
G_CALLBACK (device_stream_added),
backend);
g_signal_handlers_disconnect_by_func (G_OBJECT (device),
G_CALLBACK (device_stream_removed),
backend);
-
- g_hash_table_remove (backend->priv->devices, name);
}
static void
-device_stream_added (MateMixerBackend *backend, const gchar *name)
+device_stream_added (MateMixerBackend *backend, MateMixerStream *stream)
{
g_signal_emit (G_OBJECT (backend),
signals[STREAM_ADDED],
0,
- name);
+ stream);
}
static void
-device_stream_removed (MateMixerBackend *backend, const gchar *name)
+device_stream_removed (MateMixerBackend *backend, MateMixerStream *stream)
{
g_signal_emit (G_OBJECT (backend),
signals[STREAM_REMOVED],
0,
- name);
+ stream);
}
/* Protected functions */
diff --git a/libmatemixer/matemixer-backend.h b/libmatemixer/matemixer-backend.h
index 08dc92c..2d9dcda 100644
--- a/libmatemixer/matemixer-backend.h
+++ b/libmatemixer/matemixer-backend.h
@@ -74,18 +74,20 @@ struct _MateMixerBackendClass
MateMixerStream *stream);
/* Signals */
- void (*device_added) (MateMixerBackend *backend,
- const gchar *name);
- void (*device_removed) (MateMixerBackend *backend,
- const gchar *name);
- void (*stream_added) (MateMixerBackend *backend,
- const gchar *name);
- void (*stream_removed) (MateMixerBackend *backend,
- const gchar *name);
- void (*stored_control_added) (MateMixerBackend *backend,
- const gchar *name);
- void (*stored_control_removed) (MateMixerBackend *backend,
- const gchar *name);
+ void (*device_added) (MateMixerBackend *backend,
+ MateMixerDevice *device);
+ void (*device_removed) (MateMixerBackend *backend,
+ MateMixerDevice *device);
+
+ void (*stream_added) (MateMixerBackend *backend,
+ MateMixerStream *stream);
+ void (*stream_removed) (MateMixerBackend *backend,
+ MateMixerStream *stream);
+
+ void (*stored_control_added) (MateMixerBackend *backend,
+ MateMixerStoredControl *control);
+ void (*stored_control_removed) (MateMixerBackend *backend,
+ MateMixerStoredControl *control);
};
GType mate_mixer_backend_get_type (void) G_GNUC_CONST;
diff --git a/libmatemixer/matemixer-context.c b/libmatemixer/matemixer-context.c
index dacbc9a..a8099d2 100644
--- a/libmatemixer/matemixer-context.c
+++ b/libmatemixer/matemixer-context.c
@@ -22,9 +22,11 @@
#include "matemixer-backend.h"
#include "matemixer-backend-module.h"
#include "matemixer-context.h"
+#include "matemixer-device.h"
#include "matemixer-enums.h"
#include "matemixer-enum-types.h"
#include "matemixer-private.h"
+#include "matemixer-stored-control.h"
#include "matemixer-stream.h"
/**
@@ -125,44 +127,44 @@ static void mate_mixer_context_finalize (GObject *object);
G_DEFINE_TYPE (MateMixerContext, mate_mixer_context, G_TYPE_OBJECT);
-static void on_backend_state_notify (MateMixerBackend *backend,
- GParamSpec *pspec,
- MateMixerContext *context);
-
-static void on_backend_device_added (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-static void on_backend_device_removed (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-
-static void on_backend_stream_added (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-static void on_backend_stream_removed (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-
-static void on_backend_stored_control_added (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-static void on_backend_stored_control_removed (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context);
-
-static void on_backend_default_input_stream_notify (MateMixerBackend *backend,
- GParamSpec *pspec,
- MateMixerContext *context);
-static void on_backend_default_output_stream_notify (MateMixerBackend *backend,
- GParamSpec *pspec,
- MateMixerContext *context);
-
-static gboolean try_next_backend (MateMixerContext *context);
-
-static void change_state (MateMixerContext *context,
- MateMixerState state);
-
-static void close_context (MateMixerContext *context);
+static void on_backend_state_notify (MateMixerBackend *backend,
+ GParamSpec *pspec,
+ MateMixerContext *context);
+
+static void on_backend_device_added (MateMixerBackend *backend,
+ MateMixerDevice *device,
+ MateMixerContext *context);
+static void on_backend_device_removed (MateMixerBackend *backend,
+ MateMixerDevice *device,
+ MateMixerContext *context);
+
+static void on_backend_stream_added (MateMixerBackend *backend,
+ MateMixerStream *stream,
+ MateMixerContext *context);
+static void on_backend_stream_removed (MateMixerBackend *backend,
+ MateMixerStream *stream,
+ MateMixerContext *context);
+
+static void on_backend_stored_control_added (MateMixerBackend *backend,
+ MateMixerStoredControl *control,
+ MateMixerContext *context);
+static void on_backend_stored_control_removed (MateMixerBackend *backend,
+ MateMixerStoredControl *control,
+ MateMixerContext *context);
+
+static void on_backend_default_input_stream_notify (MateMixerBackend *backend,
+ GParamSpec *pspec,
+ MateMixerContext *context);
+static void on_backend_default_output_stream_notify (MateMixerBackend *backend,
+ GParamSpec *pspec,
+ MateMixerContext *context);
+
+static gboolean try_next_backend (MateMixerContext *context);
+
+static void change_state (MateMixerContext *context,
+ MateMixerState state);
+
+static void close_context (MateMixerContext *context);
static void
mate_mixer_context_class_init (MateMixerContextClass *klass)
@@ -303,10 +305,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, device_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE);
/**
* MateMixerContext::device-removed:
@@ -327,10 +329,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, device_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE);
/**
* MateMixerContext::stream-added:
@@ -353,10 +355,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, stream_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
/**
* MateMixerContext::stream-removed:
@@ -381,10 +383,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, stream_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
/**
* MateMixerContext::stored-control-added:
@@ -402,10 +404,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, stored_control_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STORED_CONTROL);
/**
* MateMixerContext::stored-control-removed:
@@ -426,10 +428,10 @@ mate_mixer_context_class_init (MateMixerContextClass *klass)
G_STRUCT_OFFSET (MateMixerContextClass, stored_control_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STORED_CONTROL);
g_type_class_add_private (object_class, sizeof (MateMixerContextPrivate));
}
@@ -1259,68 +1261,68 @@ on_backend_state_notify (MateMixerBackend *backend,
static void
on_backend_device_added (MateMixerBackend *backend,
- const gchar *name,
+ MateMixerDevice *device,
MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[DEVICE_ADDED],
0,
- name);
+ device);
}
static void
on_backend_device_removed (MateMixerBackend *backend,
- const gchar *name,
+ MateMixerDevice *device,
MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[DEVICE_REMOVED],
0,
- name);
+ device);
}
static void
on_backend_stream_added (MateMixerBackend *backend,
- const gchar *name,
+ MateMixerStream *stream,
MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[STREAM_ADDED],
0,
- name);
+ stream);
}
static void
on_backend_stream_removed (MateMixerBackend *backend,
- const gchar *name,
+ MateMixerStream *stream,
MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[STREAM_REMOVED],
0,
- name);
+ stream);
}
static void
-on_backend_stored_control_added (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context)
+on_backend_stored_control_added (MateMixerBackend *backend,
+ MateMixerStoredControl *control,
+ MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[STORED_CONTROL_ADDED],
0,
- name);
+ control);
}
static void
-on_backend_stored_control_removed (MateMixerBackend *backend,
- const gchar *name,
- MateMixerContext *context)
+on_backend_stored_control_removed (MateMixerBackend *backend,
+ MateMixerStoredControl *control,
+ MateMixerContext *context)
{
g_signal_emit (G_OBJECT (context),
signals[STORED_CONTROL_REMOVED],
0,
- name);
+ control);
}
static void
diff --git a/libmatemixer/matemixer-context.h b/libmatemixer/matemixer-context.h
index 19d153f..e544fe0 100644
--- a/libmatemixer/matemixer-context.h
+++ b/libmatemixer/matemixer-context.h
@@ -67,18 +67,20 @@ struct _MateMixerContextClass
GObjectClass parent_class;
/*< private >*/
- void (*device_added) (MateMixerContext *context,
- const gchar *name);
- void (*device_removed) (MateMixerContext *context,
- const gchar *name);
- void (*stream_added) (MateMixerContext *context,
- const gchar *name);
- void (*stream_removed) (MateMixerContext *context,
- const gchar *name);
- void (*stored_control_added) (MateMixerContext *context,
- const gchar *name);
- void (*stored_control_removed) (MateMixerContext *context,
- const gchar *name);
+ void (*device_added) (MateMixerContext *context,
+ MateMixerDevice *device);
+ void (*device_removed) (MateMixerContext *context,
+ MateMixerDevice *device);
+
+ void (*stream_added) (MateMixerContext *context,
+ MateMixerStream *stream);
+ void (*stream_removed) (MateMixerContext *context,
+ MateMixerStream *stream);
+
+ void (*stored_control_added) (MateMixerContext *context,
+ MateMixerStoredControl *control);
+ void (*stored_control_removed) (MateMixerContext *context,
+ MateMixerStoredControl *control);
};
GType mate_mixer_context_get_type (void) G_GNUC_CONST;
diff --git a/libmatemixer/matemixer-device.c b/libmatemixer/matemixer-device.c
index 7cf417b..6303cd6 100644
--- a/libmatemixer/matemixer-device.c
+++ b/libmatemixer/matemixer-device.c
@@ -158,10 +158,10 @@ mate_mixer_device_class_init (MateMixerDeviceClass *klass)
G_STRUCT_OFFSET (MateMixerDeviceClass, stream_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
/**
* MateMixerDevice::stream-removed:
@@ -182,10 +182,10 @@ mate_mixer_device_class_init (MateMixerDeviceClass *klass)
G_STRUCT_OFFSET (MateMixerDeviceClass, stream_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM);
/**
* MateMixerDevice::switch-added:
@@ -201,10 +201,10 @@ mate_mixer_device_class_init (MateMixerDeviceClass *klass)
G_STRUCT_OFFSET (MateMixerDeviceClass, switch_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE_SWITCH);
/**
* MateMixerDevice::switch-removed:
@@ -225,10 +225,10 @@ mate_mixer_device_class_init (MateMixerDeviceClass *klass)
G_STRUCT_OFFSET (MateMixerDeviceClass, switch_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_DEVICE_SWITCH);
g_type_class_add_private (object_class, sizeof (MateMixerDevicePrivate));
}
diff --git a/libmatemixer/matemixer-device.h b/libmatemixer/matemixer-device.h
index 2ab4c06..9829181 100644
--- a/libmatemixer/matemixer-device.h
+++ b/libmatemixer/matemixer-device.h
@@ -75,14 +75,15 @@ struct _MateMixerDeviceClass
const GList *(*list_switches) (MateMixerDevice *device);
/* Signals */
- void (*stream_added) (MateMixerDevice *device,
- const gchar *name);
- void (*stream_removed) (MateMixerDevice *device,
- const gchar *name);
- void (*switch_added) (MateMixerDevice *device,
- const gchar *name);
- void (*switch_removed) (MateMixerDevice *device,
- const gchar *name);
+ void (*stream_added) (MateMixerDevice *device,
+ MateMixerStream *stream);
+ void (*stream_removed) (MateMixerDevice *device,
+ MateMixerStream *stream);
+
+ void (*switch_added) (MateMixerDevice *device,
+ MateMixerDeviceSwitch *swtch);
+ void (*switch_removed) (MateMixerDevice *device,
+ MateMixerDeviceSwitch *swtch);
};
GType mate_mixer_device_get_type (void) G_GNUC_CONST;
diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c
index 9110e22..84a522f 100644
--- a/libmatemixer/matemixer-stream.c
+++ b/libmatemixer/matemixer-stream.c
@@ -155,10 +155,10 @@ mate_mixer_stream_class_init (MateMixerStreamClass *klass)
G_STRUCT_OFFSET (MateMixerStreamClass, control_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM_CONTROL);
signals[CONTROL_REMOVED] =
g_signal_new ("control-removed",
@@ -167,10 +167,10 @@ mate_mixer_stream_class_init (MateMixerStreamClass *klass)
G_STRUCT_OFFSET (MateMixerStreamClass, control_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM_CONTROL);
signals[SWITCH_ADDED] =
g_signal_new ("switch-added",
@@ -179,10 +179,10 @@ mate_mixer_stream_class_init (MateMixerStreamClass *klass)
G_STRUCT_OFFSET (MateMixerStreamClass, switch_added),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM_SWITCH);
signals[SWITCH_REMOVED] =
g_signal_new ("switch-removed",
@@ -191,10 +191,10 @@ mate_mixer_stream_class_init (MateMixerStreamClass *klass)
G_STRUCT_OFFSET (MateMixerStreamClass, switch_removed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ MATE_MIXER_TYPE_STREAM_SWITCH);
g_type_class_add_private (object_class, sizeof (MateMixerStreamPrivate));
}
diff --git a/libmatemixer/matemixer-stream.h b/libmatemixer/matemixer-stream.h
index 5744c04..d8c3b0f 100644
--- a/libmatemixer/matemixer-stream.h
+++ b/libmatemixer/matemixer-stream.h
@@ -76,15 +76,15 @@ struct _MateMixerStreamClass
const GList *(*list_switches) (MateMixerStream *stream);
/* Signals */
- void (*control_added) (MateMixerStream *stream,
- const gchar *name);
- void (*control_removed) (MateMixerStream *stream,
- const gchar *name);
-
- void (*switch_added) (MateMixerStream *stream,
- const gchar *name);
- void (*switch_removed) (MateMixerStream *stream,
- const gchar *name);
+ void (*control_added) (MateMixerStream *stream,
+ MateMixerStreamControl *control);
+ void (*control_removed) (MateMixerStream *stream,
+ MateMixerStreamControl *control);
+
+ void (*switch_added) (MateMixerStream *stream,
+ MateMixerStreamSwitch *swtch);
+ void (*switch_removed) (MateMixerStream *stream,
+ MateMixerStreamSwitch *swtch);
};
GType mate_mixer_stream_get_type (void) G_GNUC_CONST;