summaryrefslogtreecommitdiff
path: root/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-12-05 00:47:54 +0200
committerJasmine Hassan <[email protected]>2012-12-06 18:48:25 +0200
commit75e8a3f7a9322bba1cff478e35b6e15203d78aa8 (patch)
treef882ec7d45b065914966523b15b0a1c38f246d67 /plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
parent6e182dc5cdb3451a4ec4bd443b1159df318541c8 (diff)
downloadmate-settings-daemon-75e8a3f7a9322bba1cff478e35b6e15203d78aa8.tar.bz2
mate-settings-daemon-75e8a3f7a9322bba1cff478e35b6e15203d78aa8.tar.xz
[media-keys] Update volume code (should be copy-paste from mate-media)
Updates volume code from gnome-media http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=5f4b71733713741ec6c48480e3ddc73bf72eb290 referenced bug also says fixes a memory leak https://bugzilla.gnome.org/show_bug.cgi?id=612024
Diffstat (limited to 'plugins/media-keys/cut-n-paste/gvc-mixer-stream.c')
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-mixer-stream.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
index 7b08828..7b1e0ec 100644
--- a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
+++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <pulse/pulseaudio.h>
@@ -40,6 +40,7 @@ struct GvcMixerStreamPrivate
pa_context *pa_context;
guint id;
guint index;
+ gint card_index;
GvcChannelMap *channel_map;
char *name;
char *description;
@@ -73,6 +74,7 @@ enum
PROP_CAN_DECIBEL,
PROP_IS_EVENT_STREAM,
PROP_IS_VIRTUAL,
+ PROP_CARD_INDEX,
PROP_PORT,
};
@@ -117,7 +119,7 @@ gvc_mixer_stream_get_id (GvcMixerStream *stream)
return stream->priv->id;
}
-GvcChannelMap *
+const GvcChannelMap *
gvc_mixer_stream_get_channel_map (GvcMixerStream *stream)
{
g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL);
@@ -403,7 +405,7 @@ gvc_mixer_stream_set_base_volume (GvcMixerStream *stream,
return TRUE;
}
-GvcMixerStreamPort *
+const GvcMixerStreamPort *
gvc_mixer_stream_get_port (GvcMixerStream *stream)
{
GList *l;
@@ -489,6 +491,25 @@ gvc_mixer_stream_set_ports (GvcMixerStream *stream,
return TRUE;
}
+gint
+gvc_mixer_stream_get_card_index (GvcMixerStream *stream)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), PA_INVALID_INDEX);
+ return stream->priv->card_index;
+}
+
+gboolean
+gvc_mixer_stream_set_card_index (GvcMixerStream *stream,
+ gint card_index)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE);
+
+ stream->priv->card_index = card_index;
+ g_object_notify (G_OBJECT (stream), "card-index");
+
+ return TRUE;
+}
+
static void
gvc_mixer_stream_set_property (GObject *object,
guint prop_id,
@@ -543,6 +564,9 @@ gvc_mixer_stream_set_property (GObject *object,
case PROP_PORT:
gvc_mixer_stream_set_port (self, g_value_get_string (value));
break;
+ case PROP_CARD_INDEX:
+ self->priv->card_index = g_value_get_long (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -605,6 +629,9 @@ gvc_mixer_stream_get_property (GObject *object,
case PROP_PORT:
g_value_set_string (value, self->priv->port);
break;
+ case PROP_CARD_INDEX:
+ g_value_set_long (value, self->priv->card_index);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -815,6 +842,13 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
"The name of the current port for this stream",
NULL,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_CARD_INDEX,
+ g_param_spec_long ("card-index",
+ "Card index",
+ "The index of the card for this stream",
+ PA_INVALID_INDEX, G_MAXLONG, PA_INVALID_INDEX,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GvcMixerStreamPrivate));
}
@@ -844,6 +878,9 @@ gvc_mixer_stream_finalize (GObject *object)
g_return_if_fail (mixer_stream->priv != NULL);
+ g_object_unref (mixer_stream->priv->channel_map);
+ mixer_stream->priv->channel_map = NULL;
+
g_free (mixer_stream->priv->name);
mixer_stream->priv->name = NULL;