summaryrefslogtreecommitdiff
path: root/backends/pulse/pulse-sink.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-09 20:25:33 +0100
committerraveit65 <[email protected]>2017-02-21 11:55:59 +0100
commit9cbe39ab7c55bcad401de32716c5c8106f166291 (patch)
tree42fb4f92923890f6c3070e95f5ff0ba88358da46 /backends/pulse/pulse-sink.c
parentd1deea43570dfd5bd32b7040f89cf3c971df3b9a (diff)
downloadlibmatemixer-9cbe39ab7c55bcad401de32716c5c8106f166291.tar.bz2
libmatemixer-9cbe39ab7c55bcad401de32716c5c8106f166291.tar.xz
Provide and use convenience functions to remove some copy-pasted code
Diffstat (limited to 'backends/pulse/pulse-sink.c')
-rw-r--r--backends/pulse/pulse-sink.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c
index 9edf185..c698d02 100644
--- a/backends/pulse/pulse-sink.c
+++ b/backends/pulse/pulse-sink.c
@@ -54,8 +54,6 @@ G_DEFINE_TYPE (PulseSink, pulse_sink, PULSE_TYPE_STREAM);
static const GList *pulse_sink_list_controls (MateMixerStream *mms);
static const GList *pulse_sink_list_switches (MateMixerStream *mms);
-static void free_list_controls (PulseSink *sink);
-
static void
pulse_sink_class_init (PulseSinkClass *klass)
{
@@ -99,13 +97,10 @@ pulse_sink_dispose (GObject *object)
g_clear_object (&sink->priv->control);
g_clear_object (&sink->priv->pswitch);
+ g_clear_pointer (&sink->priv->pswitch_list, g_list_free);
- free_list_controls (sink);
+ _mate_mixer_clear_object_list (&sink->priv->inputs_list);
- if (sink->priv->pswitch_list != NULL) {
- g_list_free (sink->priv->pswitch_list);
- sink->priv->pswitch_list = NULL;
- }
G_OBJECT_CLASS (pulse_sink_parent_class)->dispose (object);
}
@@ -207,7 +202,7 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
GUINT_TO_POINTER (info->index),
input);
- free_list_controls (sink);
+ _mate_mixer_clear_object_list (&sink->priv->inputs_list);
g_signal_emit_by_name (G_OBJECT (sink),
"control-added",
@@ -233,7 +228,7 @@ pulse_sink_remove_input (PulseSink *sink, guint32 index)
g_object_ref (input);
g_hash_table_remove (sink->priv->inputs, GUINT_TO_POINTER (index));
- free_list_controls (sink);
+ _mate_mixer_clear_object_list (&sink->priv->inputs_list);
g_signal_emit_by_name (G_OBJECT (sink),
"control-removed",
MATE_MIXER_STREAM_CONTROL (input));
@@ -292,14 +287,3 @@ pulse_sink_list_switches (MateMixerStream *mms)
return PULSE_SINK (mms)->priv->pswitch_list;
}
-
-static void
-free_list_controls (PulseSink *sink)
-{
- if (sink->priv->inputs_list == NULL)
- return;
-
- g_list_free_full (sink->priv->inputs_list, g_object_unref);
-
- sink->priv->inputs_list = NULL;
-}