aboutsummaryrefslogtreecommitdiff
path: root/src/slider-menu-item.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-15 12:22:21 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-15 12:22:21 +0000
commit57e21d3708ad855333de53f31a3e1b0f93081dc2 (patch)
treefcfcaa1fff741871213e88cb9c0906234878d175 /src/slider-menu-item.c
parent661b34c4f8175efbd51a4471c01e96a370806228 (diff)
downloadayatana-indicator-sound-57e21d3708ad855333de53f31a3e1b0f93081dc2.tar.gz
ayatana-indicator-sound-57e21d3708ad855333de53f31a3e1b0f93081dc2.tar.bz2
ayatana-indicator-sound-57e21d3708ad855333de53f31a3e1b0f93081dc2.zip
mute behaviour consistent over both sliders => go to 0 on mute and return to previous volume on unmute
Diffstat (limited to 'src/slider-menu-item.c')
-rw-r--r--src/slider-menu-item.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index fb66563..9551b4b 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -28,9 +28,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef struct _SliderMenuItemPrivate SliderMenuItemPrivate;
struct _SliderMenuItemPrivate {
- Device* a_sink;
+ Device* a_sink;
gint index;
gchar* name;
+ gboolean mute;
pa_cvolume volume;
pa_channel_map channel_map;
pa_volume_t base_volume;
@@ -127,6 +128,7 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update)
priv->volume = slider_menu_item_construct_mono_volume (&update->volume);
priv->base_volume = update->base_volume;
priv->channel_map = update->channel_map;
+ priv->mute = update->mute;
pa_volume_t vol = pa_cvolume_max (&update->volume);
gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
@@ -170,6 +172,14 @@ slider_menu_item_update (SliderMenuItem* self, const pa_sink_info* update)
dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
DBUSMENU_VOLUME_MENUITEM_LEVEL,
new_volume);
+ if (priv->mute != update->mute){
+ priv->mute = update->mute;
+ g_debug ("volume menu item - update - mute = %i", update->mute);
+ GVariant* new_mute_update = g_variant_new_int32 (update->mute);
+ dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self),
+ DBUSMENU_VOLUME_MENUITEM_MUTE,
+ new_mute_update);
+ }
}
/*