summaryrefslogtreecommitdiff
path: root/backends/pulse
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-07 01:00:27 +0100
committerraveit65 <[email protected]>2017-02-21 11:55:59 +0100
commit7666c62a307e3cb23994add9f58c8d03478f152f (patch)
treeccf74e05c8f3fdc7225a353462da782da0f00349 /backends/pulse
parentdd5f0d6489ce7a2b4156b3a6b44da09eb1336611 (diff)
downloadlibmatemixer-7666c62a307e3cb23994add9f58c8d03478f152f.tar.bz2
libmatemixer-7666c62a307e3cb23994add9f58c8d03478f152f.tar.xz
Change added/removed signal argument from name to object
Diffstat (limited to 'backends/pulse')
-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
4 files changed, 40 insertions, 45 deletions
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