[gnome-control-center] sound: Export sysfs path in stream properties
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sound: Export sysfs path in stream properties
- Date: Thu, 3 Nov 2011 17:58:41 +0000 (UTC)
commit b202b0a9b3f60482805110a0a4981e949fe1ceb2
Author: Bastien Nocera <hadess hadess net>
Date: Fri Oct 28 16:54:49 2011 +0100
sound: Export sysfs path in stream properties
Which makes it easier to locate devices in the UDev tree.
panels/sound/gvc-mixer-control.c | 1 +
panels/sound/gvc-mixer-stream.c | 38 ++++++++++++++++++++++++++++++++++++++
panels/sound/gvc-mixer-stream.h | 3 +++
3 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/panels/sound/gvc-mixer-control.c b/panels/sound/gvc-mixer-control.c
index 2fe4286..3568386 100644
--- a/panels/sound/gvc-mixer-control.c
+++ b/panels/sound/gvc-mixer-control.c
@@ -820,6 +820,7 @@ update_sink (GvcMixerControl *control,
gvc_mixer_stream_set_card_index (stream, info->card);
gvc_mixer_stream_set_description (stream, info->description);
set_icon_name_from_proplist (stream, info->proplist, "audio-card");
+ gvc_mixer_stream_set_sysfs_path (stream, pa_proplist_gets (info->proplist, "sysfs.path"));
gvc_mixer_stream_set_volume (stream, (guint)max_volume);
gvc_mixer_stream_set_is_muted (stream, info->mute);
gvc_mixer_stream_set_can_decibel (stream, !!(info->flags & PA_SINK_DECIBEL_VOLUME));
diff --git a/panels/sound/gvc-mixer-stream.c b/panels/sound/gvc-mixer-stream.c
index f35954a..0a5663e 100644
--- a/panels/sound/gvc-mixer-stream.c
+++ b/panels/sound/gvc-mixer-stream.c
@@ -48,6 +48,7 @@ struct GvcMixerStreamPrivate
char *description;
char *application_id;
char *icon_name;
+ char *sysfs_path;
gboolean is_muted;
gboolean can_decibel;
gboolean is_event_stream;
@@ -70,6 +71,7 @@ enum
PROP_DESCRIPTION,
PROP_APPLICATION_ID,
PROP_ICON_NAME,
+ PROP_SYSFS_PATH,
PROP_VOLUME,
PROP_DECIBEL,
PROP_IS_MUTED,
@@ -390,6 +392,13 @@ gvc_mixer_stream_get_icon_name (GvcMixerStream *stream)
return stream->priv->icon_name;
}
+const char *
+gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL);
+ return stream->priv->sysfs_path;
+}
+
/**
* gvc_mixer_stream_get_gicon:
* @stream: a #GvcMixerStream
@@ -418,6 +427,19 @@ gvc_mixer_stream_set_icon_name (GvcMixerStream *stream,
return TRUE;
}
+gboolean
+gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream,
+ const char *sysfs_path)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE);
+
+ g_free (stream->priv->sysfs_path);
+ stream->priv->sysfs_path = g_strdup (sysfs_path);
+ g_object_notify (G_OBJECT (stream), "sysfs-path");
+
+ return TRUE;
+}
+
/**
* gvc_mixer_stream_get_base_volume:
*
@@ -599,6 +621,9 @@ gvc_mixer_stream_set_property (GObject *object,
case PROP_ICON_NAME:
gvc_mixer_stream_set_icon_name (self, g_value_get_string (value));
break;
+ case PROP_SYSFS_PATH:
+ gvc_mixer_stream_set_sysfs_path (self, g_value_get_string (value));
+ break;
case PROP_VOLUME:
gvc_mixer_stream_set_volume (self, g_value_get_ulong (value));
break;
@@ -662,6 +687,9 @@ gvc_mixer_stream_get_property (GObject *object,
case PROP_ICON_NAME:
g_value_set_string (value, self->priv->icon_name);
break;
+ case PROP_SYSFS_PATH:
+ g_value_set_string (value, self->priv->sysfs_path);
+ break;
case PROP_VOLUME:
g_value_set_ulong (value,
pa_cvolume_max(gvc_channel_map_get_cvolume(self->priv->channel_map)));
@@ -864,6 +892,13 @@ gvc_mixer_stream_class_init (GvcMixerStreamClass *klass)
NULL,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
g_object_class_install_property (gobject_class,
+ PROP_SYSFS_PATH,
+ g_param_spec_string ("sysfs-path",
+ "Sysfs path",
+ "Sysfs path for the device associated with this stream",
+ NULL,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ g_object_class_install_property (gobject_class,
PROP_IS_MUTED,
g_param_spec_boolean ("is-muted",
"is muted",
@@ -949,6 +984,9 @@ gvc_mixer_stream_finalize (GObject *object)
g_free (mixer_stream->priv->icon_name);
mixer_stream->priv->icon_name = NULL;
+ g_free (mixer_stream->priv->sysfs_path);
+ mixer_stream->priv->sysfs_path = NULL;
+
g_free (mixer_stream->priv->port);
mixer_stream->priv->port = NULL;
diff --git a/panels/sound/gvc-mixer-stream.h b/panels/sound/gvc-mixer-stream.h
index 1c38e6b..ad79024 100644
--- a/panels/sound/gvc-mixer-stream.h
+++ b/panels/sound/gvc-mixer-stream.h
@@ -85,6 +85,7 @@ gboolean gvc_mixer_stream_change_is_muted (GvcMixerStream *stream,
gboolean gvc_mixer_stream_is_running (GvcMixerStream *stream);
const char * gvc_mixer_stream_get_name (GvcMixerStream *stream);
const char * gvc_mixer_stream_get_icon_name (GvcMixerStream *stream);
+const char * gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream);
GIcon * gvc_mixer_stream_get_gicon (GvcMixerStream *stream);
const char * gvc_mixer_stream_get_description (GvcMixerStream *stream);
const char * gvc_mixer_stream_get_application_id (GvcMixerStream *stream);
@@ -107,6 +108,8 @@ gboolean gvc_mixer_stream_set_description (GvcMixerStream *stream,
const char *description);
gboolean gvc_mixer_stream_set_icon_name (GvcMixerStream *stream,
const char *name);
+gboolean gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream,
+ const char *sysfs_path);
gboolean gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream,
gboolean is_event_stream);
gboolean gvc_mixer_stream_set_is_virtual (GvcMixerStream *stream,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]