gnome-media r4064 - in trunk/gnome-volume-control: . src
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-media r4064 - in trunk/gnome-volume-control: . src
- Date: Tue, 18 Nov 2008 20:53:51 +0000 (UTC)
Author: mccann
Date: Tue Nov 18 20:53:51 2008
New Revision: 4064
URL: http://svn.gnome.org/viewvc/gnome-media?rev=4064&view=rev
Log:
2008-11-18 William Jon McCann <jmccann redhat com>
* src/gvc-applet.c (maybe_show_status_icon), (update_icon),
(update_default_sink), (on_control_ready),
(on_control_default_sink_changed), (gvc_applet_init):
* src/gvc-mixer-control.c (remove_stream):
Hide the status icon when there is no output device.
Modified:
trunk/gnome-volume-control/ChangeLog
trunk/gnome-volume-control/src/gvc-applet.c
trunk/gnome-volume-control/src/gvc-mixer-control.c
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 Nov 18 20:53:51 2008
@@ -71,6 +71,14 @@
show = TRUE;
+ if (applet->priv->sink_stream == NULL) {
+ show = FALSE;
+ }
+
+ if (applet->priv->dock != NULL) {
+ gtk_widget_hide (applet->priv->dock);
+ }
+
gtk_status_icon_set_visible (applet->priv->status_icon, show);
}
@@ -435,6 +443,12 @@
gboolean is_muted;
guint n;
+ maybe_show_status_icon (applet);
+
+ if (applet->priv->sink_stream == NULL) {
+ return;
+ }
+
volume = gvc_mixer_stream_get_volume (applet->priv->sink_stream);
is_muted = gvc_mixer_stream_get_is_muted (applet->priv->sink_stream);
@@ -477,10 +491,20 @@
}
static void
-on_control_ready (GvcMixerControl *control,
- GvcApplet *applet)
+update_default_sink (GvcApplet *applet)
{
- applet->priv->sink_stream = gvc_mixer_control_get_default_sink (control);
+ if (applet->priv->sink_stream != NULL) {
+ g_signal_handlers_disconnect_by_func (applet->priv->sink_stream,
+ G_CALLBACK (on_stream_volume_notify),
+ applet);
+ g_signal_handlers_disconnect_by_func (applet->priv->sink_stream,
+ G_CALLBACK (on_stream_is_muted_notify),
+ applet);
+ g_object_unref (applet->priv->sink_stream);
+ applet->priv->sink_stream = NULL;
+ }
+
+ applet->priv->sink_stream = gvc_mixer_control_get_default_sink (applet->priv->control);
if (applet->priv->sink_stream != NULL) {
GtkAdjustment *adj;
@@ -498,10 +522,17 @@
"notify::is-muted",
G_CALLBACK (on_stream_is_muted_notify),
applet);
- update_icon (applet);
} else {
g_warning ("Unable to get default sink");
}
+ update_icon (applet);
+}
+
+static void
+on_control_ready (GvcMixerControl *control,
+ GvcApplet *applet)
+{
+ update_default_sink (applet);
}
static void
@@ -517,6 +548,14 @@
}
static void
+on_control_default_sink_changed (GvcMixerControl *control,
+ guint id,
+ GvcApplet *applet)
+{
+ update_default_sink (applet);
+}
+
+static void
gvc_applet_init (GvcApplet *applet)
{
GtkWidget *frame;
@@ -587,6 +626,10 @@
"ready",
G_CALLBACK (on_control_ready),
applet);
+ g_signal_connect (applet->priv->control,
+ "default-sink-changed",
+ G_CALLBACK (on_control_default_sink_changed),
+ applet);
adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (applet->priv->bar)));
g_signal_connect (adj,
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 Nov 18 20:53:51 2008
@@ -443,9 +443,20 @@
remove_stream (GvcMixerControl *control,
GvcMixerStream *stream)
{
+ guint id;
+
g_object_ref (stream);
+
+ id = gvc_mixer_stream_get_id (stream);
+
+ if (id == control->priv->default_sink_id) {
+ _set_default_sink (control, NULL);
+ } else if (id == control->priv->default_source_id) {
+ _set_default_source (control, NULL);
+ }
+
g_hash_table_remove (control->priv->all_streams,
- GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)));
+ GUINT_TO_POINTER (id));
g_signal_emit (G_OBJECT (control),
signals[STREAM_REMOVED],
0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]