gnome-media r4176 - in trunk/gnome-volume-control: . src
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-media r4176 - in trunk/gnome-volume-control: . src
- Date: Tue, 10 Feb 2009 15:19:40 +0000 (UTC)
Author: hadess
Date: Tue Feb 10 15:19:40 2009
New Revision: 4176
URL: http://svn.gnome.org/viewvc/gnome-media?rev=4176&view=rev
Log:
2009-02-10 Bastien Nocera <hadess hadess net>
* src/gvc-applet.c (maybe_show_status_icons):
* src/gvc-mixer-control.c (set_application_id_from_proplist),
(update_sink_input), (update_source_output):
* src/gvc-mixer-dialog.c (create_monitor_stream_for_source):
* src/gvc-mixer-stream.c (gvc_mixer_stream_get_application_id),
(gvc_mixer_stream_set_application_id),
(gvc_mixer_stream_set_property), (gvc_mixer_stream_get_property),
(gvc_mixer_stream_class_init), (gvc_mixer_stream_finalize):
* src/gvc-mixer-stream.h: Set the org.gnome.VolumeControl application
ID for the input peak monitor, and ignore it when checking whether
an application is using the input. Also ignore Pavucontrol.
Stops the microphone showing up in the applet when the capplet is
running (Closes: #565146)
Modified:
trunk/gnome-volume-control/ChangeLog
trunk/gnome-volume-control/src/gvc-applet.c
trunk/gnome-volume-control/src/gvc-mixer-control.c
trunk/gnome-volume-control/src/gvc-mixer-dialog.c
trunk/gnome-volume-control/src/gvc-mixer-stream.c
trunk/gnome-volume-control/src/gvc-mixer-stream.h
Modified: trunk/gnome-volume-control/src/gvc-applet.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-applet.c (original)
+++ trunk/gnome-volume-control/src/gvc-applet.c Tue Feb 10 15:19:40 2009
@@ -73,7 +73,7 @@
{
gboolean show;
GvcMixerStream *stream;
- GSList *source_outputs;
+ GSList *source_outputs, *l;
show = TRUE;
stream = gvc_mixer_control_get_default_sink (applet->priv->control);
@@ -87,7 +87,22 @@
stream = gvc_mixer_control_get_default_source (applet->priv->control);
source_outputs = gvc_mixer_control_get_source_outputs (applet->priv->control);
if (stream != NULL && source_outputs != NULL) {
- show = TRUE;
+ /* Check that we're not trying to add the peak detector
+ * as an application doing recording */
+ for (l = source_outputs ; l ; l = l->next) {
+ GvcMixerStream *s = l->data;
+ const char *id;
+
+ id = gvc_mixer_stream_get_application_id (s);
+ if (id == NULL)
+ continue;
+
+ if (!g_str_equal (id, "org.gnome.VolumeControl") &&
+ !g_str_equal (id, "org.PulseAudio.pavucontrol")) {
+ show = TRUE;
+ break;
+ }
+ }
}
gtk_status_icon_set_visible (GTK_STATUS_ICON (applet->priv->input_status_icon), show);
Modified: trunk/gnome-volume-control/src/gvc-mixer-control.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-mixer-control.c (original)
+++ trunk/gnome-volume-control/src/gvc-mixer-control.c Tue Feb 10 15:19:40 2009
@@ -679,6 +679,17 @@
}
static void
+set_application_id_from_proplist (GvcMixerStream *stream,
+ pa_proplist *l)
+{
+ const char *t;
+
+ if ((t = pa_proplist_gets (l, PA_PROP_APPLICATION_ID))) {
+ gvc_mixer_stream_set_application_id (stream, t);
+ }
+}
+
+static void
update_sink_input (GvcMixerControl *control,
const pa_sink_input_info *info)
{
@@ -716,6 +727,7 @@
gvc_mixer_stream_set_name (stream, name);
gvc_mixer_stream_set_description (stream, info->name);
+ set_application_id_from_proplist (stream, info->proplist);
set_is_event_stream_from_proplist (stream, info->proplist);
set_icon_name_from_proplist (stream, info->proplist, "applications-multimedia");
gvc_mixer_stream_set_volume (stream, (guint)max_volume);
@@ -763,6 +775,8 @@
gvc_mixer_stream_set_name (stream, name);
gvc_mixer_stream_set_description (stream, info->name);
+ set_application_id_from_proplist (stream, info->proplist);
+ set_is_event_stream_from_proplist (stream, info->proplist);
set_icon_name_from_proplist (stream, info->proplist, "applications-multimedia");
if (is_new) {
Modified: trunk/gnome-volume-control/src/gvc-mixer-dialog.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-mixer-dialog.c (original)
+++ trunk/gnome-volume-control/src/gvc-mixer-dialog.c Tue Feb 10 15:19:40 2009
@@ -323,6 +323,7 @@
pa_sample_spec ss;
pa_context *context;
int res;
+ pa_proplist *proplist;
if (stream == NULL) {
return;
@@ -347,7 +348,10 @@
snprintf (t, sizeof (t), "%u", gvc_mixer_stream_get_index (stream));
- s = pa_stream_new (context, _("Peak detect"), &ss, NULL);
+ proplist = pa_proplist_new ();
+ pa_proplist_sets (proplist, PA_PROP_APPLICATION_ID, "org.gnome.VolumeControl");
+ s = pa_stream_new_with_proplist (context, _("Peak detect"), &ss, NULL, proplist);
+ pa_proplist_free (proplist);
if (s == NULL) {
g_warning ("Failed to create monitoring stream");
return;
Modified: trunk/gnome-volume-control/src/gvc-mixer-stream.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-mixer-stream.c (original)
+++ trunk/gnome-volume-control/src/gvc-mixer-stream.c Tue Feb 10 15:19:40 2009
@@ -45,6 +45,7 @@
gdouble decibel;
char *name;
char *description;
+ char *application_id;
char *icon_name;
gboolean is_muted;
gboolean can_decibel;
@@ -60,6 +61,7 @@
PROP_INDEX,
PROP_NAME,
PROP_DESCRIPTION,
+ PROP_APPLICATION_ID,
PROP_ICON_NAME,
PROP_VOLUME,
PROP_DECIBEL,
@@ -260,6 +262,26 @@
return TRUE;
}
+const char *
+gvc_mixer_stream_get_application_id (GvcMixerStream *stream)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL);
+ return stream->priv->application_id;
+}
+
+gboolean
+gvc_mixer_stream_set_application_id (GvcMixerStream *stream,
+ const char *application_id)
+{
+ g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE);
+
+ g_free (stream->priv->application_id);
+ stream->priv->application_id = g_strdup (application_id);
+ g_object_notify (G_OBJECT (stream), "application-id");
+
+ return TRUE;
+}
+
static void
on_channel_map_gains_changed (GvcChannelMap *channel_map,
GvcMixerStream *stream)
@@ -346,6 +368,9 @@
case PROP_DESCRIPTION:
gvc_mixer_stream_set_description (self, g_value_get_string (value));
break;
+ case PROP_APPLICATION_ID:
+ gvc_mixer_stream_set_application_id (self, g_value_get_string (value));
+ break;
case PROP_ICON_NAME:
gvc_mixer_stream_set_icon_name (self, g_value_get_string (value));
break;
@@ -397,6 +422,9 @@
case PROP_DESCRIPTION:
g_value_set_string (value, self->priv->description);
break;
+ case PROP_APPLICATION_ID:
+ g_value_set_string (value, self->priv->application_id);
+ break;
case PROP_ICON_NAME:
g_value_set_string (value, self->priv->icon_name);
break;
@@ -542,6 +570,13 @@
NULL,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
g_object_class_install_property (gobject_class,
+ PROP_APPLICATION_ID,
+ g_param_spec_string ("application-id",
+ "Application identifier",
+ "Application identifier for this stream",
+ NULL,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+ g_object_class_install_property (gobject_class,
PROP_ICON_NAME,
g_param_spec_string ("icon-name",
"Icon Name",
@@ -597,6 +632,9 @@
g_free (mixer_stream->priv->description);
mixer_stream->priv->description = NULL;
+ g_free (mixer_stream->priv->application_id);
+ mixer_stream->priv->application_id = NULL;
+
g_free (mixer_stream->priv->icon_name);
mixer_stream->priv->icon_name = NULL;
Modified: trunk/gnome-volume-control/src/gvc-mixer-stream.h
==============================================================================
--- trunk/gnome-volume-control/src/gvc-mixer-stream.h (original)
+++ trunk/gnome-volume-control/src/gvc-mixer-stream.h Tue Feb 10 15:19:40 2009
@@ -73,6 +73,7 @@
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_description (GvcMixerStream *stream);
+const char * gvc_mixer_stream_get_application_id (GvcMixerStream *stream);
gboolean gvc_mixer_stream_is_event_stream (GvcMixerStream *stream);
/* private */
@@ -92,6 +93,8 @@
const char *name);
gboolean gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream,
gboolean is_event_stream);
+gboolean gvc_mixer_stream_set_application_id (GvcMixerStream *stream,
+ const char *application_id);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]