gnome-media r4031 - in trunk/gnome-volume-control: . src
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-media r4031 - in trunk/gnome-volume-control: . src
- Date: Thu, 6 Nov 2008 03:48:13 +0000 (UTC)
Author: mccann
Date: Thu Nov 6 03:48:13 2008
New Revision: 4031
URL: http://svn.gnome.org/viewvc/gnome-media?rev=4031&view=rev
Log:
2008-11-05 William Jon McCann <jmccann redhat com>
* src/gvc-applet.c (popup_dock), (on_bar_is_muted_notify),
(gvc_applet_init):
* src/gvc-channel-bar.c (on_zero_adjustment_value_changed),
(update_mute_button), (gvc_channel_bar_init):
Fix initial mute setting for applet. When mute button
is not displayed use the "zero" position to indicate
muted state.
Modified:
trunk/gnome-volume-control/ChangeLog
trunk/gnome-volume-control/src/gvc-applet.c
trunk/gnome-volume-control/src/gvc-channel-bar.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 Thu Nov 6 03:48:13 2008
@@ -154,12 +154,15 @@
GtkOrientation orientation;
GdkDisplay *display;
GdkScreen *screen;
+ gboolean is_muted;
gboolean res;
int x, y;
adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (applet->priv->bar)));
gtk_adjustment_set_value (adj,
gvc_mixer_stream_get_volume (applet->priv->sink_stream));
+ is_muted = gvc_mixer_stream_get_is_muted (applet->priv->sink_stream);
+ gvc_channel_bar_set_is_muted (GVC_CHANNEL_BAR (applet->priv->bar), is_muted);
screen = gtk_status_icon_get_screen (applet->priv->status_icon);
res = gtk_status_icon_get_geometry (applet->priv->status_icon,
@@ -606,7 +609,8 @@
gtk_container_add (GTK_CONTAINER (frame), box);
applet->priv->bar = gvc_channel_bar_new ();
- gvc_channel_bar_set_orientation (applet->priv->bar, GTK_ORIENTATION_VERTICAL);
+ gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (applet->priv->bar),
+ GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (box), applet->priv->bar, TRUE, FALSE, 0);
g_signal_connect (applet->priv->bar,
Modified: trunk/gnome-volume-control/src/gvc-channel-bar.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-channel-bar.c (original)
+++ trunk/gnome-volume-control/src/gvc-channel-bar.c Thu Nov 6 03:48:13 2008
@@ -46,6 +46,7 @@
GtkWidget *mute_box;
GtkWidget *mute_button;
GtkAdjustment *adjustment;
+ GtkAdjustment *zero_adjustment;
gboolean show_mute;
gboolean is_muted;
char *name;
@@ -174,8 +175,6 @@
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
- g_debug ("setting orientation");
-
if (orientation != bar->priv->orientation) {
bar->priv->orientation = orientation;
@@ -183,8 +182,6 @@
GtkWidget *box;
GtkWidget *frame;
- g_debug ("recreating scale");
-
box = bar->priv->scale_box;
frame = box->parent;
@@ -246,6 +243,21 @@
}
static void
+on_zero_adjustment_value_changed (GtkAdjustment *adjustment,
+ GvcChannelBar *bar)
+{
+ gdouble value;
+
+ value = gtk_adjustment_get_value (bar->priv->zero_adjustment);
+ gtk_adjustment_set_value (bar->priv->adjustment, value);
+
+ /* this means the adjustment moved away from zero and
+ therefore we should unmute and set the volume. */
+
+ gvc_channel_bar_set_is_muted (bar, FALSE);
+}
+
+static void
update_mute_button (GvcChannelBar *bar)
{
if (bar->priv->show_mute) {
@@ -254,6 +266,25 @@
bar->priv->is_muted);
} else {
gtk_widget_hide (bar->priv->mute_button);
+
+ if (bar->priv->is_muted) {
+ /* If we aren't showing the mute button then
+ * move slider to the zero. But we don't want to
+ * change the adjustment. */
+ g_signal_handlers_block_by_func (bar->priv->zero_adjustment,
+ on_zero_adjustment_value_changed,
+ bar);
+ gtk_adjustment_set_value (bar->priv->zero_adjustment, 0);
+ g_signal_handlers_unblock_by_func (bar->priv->zero_adjustment,
+ on_zero_adjustment_value_changed,
+ bar);
+ gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
+ bar->priv->zero_adjustment);
+ } else {
+ /* no longer muted so restore the original adjustment */
+ gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
+ bar->priv->adjustment);
+ }
}
}
@@ -474,6 +505,19 @@
0.0));
g_object_ref_sink (bar->priv->adjustment);
+ bar->priv->zero_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,
+ 0.0,
+ 65536.0,
+ 65536.0/100.0,
+ 65536.0/10.0,
+ 0.0));
+ g_object_ref_sink (bar->priv->zero_adjustment);
+
+ g_signal_connect (bar->priv->zero_adjustment,
+ "value-changed",
+ G_CALLBACK (on_zero_adjustment_value_changed),
+ bar);
+
bar->priv->mute_button = gtk_check_button_new_with_label (_("Mute"));
gtk_widget_set_no_show_all (bar->priv->mute_button, TRUE);
g_signal_connect (bar->priv->mute_button,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]