aboutsummaryrefslogtreecommitdiff
path: root/src/volume-widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/volume-widget.c')
-rw-r--r--src/volume-widget.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/volume-widget.c b/src/volume-widget.c
index 5c842dc..c947669 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -128,11 +128,11 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
GVariant* value, gpointer userdata)
{
g_return_if_fail (IS_VOLUME_WIDGET (userdata));
- g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
VolumeWidget* mitem = VOLUME_WIDGET(userdata);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- //g_debug("scrub-widget::property_update for prop %s", property);
+
if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
+ g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
if(priv->grabbed == FALSE){
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
@@ -141,6 +141,27 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
update_accessible_desc(priv->indicator);
}
}
+ if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){
+ g_debug ("volume widget - mute update ");
+ if(priv->grabbed == FALSE){
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ GtkRange *range = (GtkRange*)slider;
+ gint update = g_variant_get_int32 (value);
+ gdouble level;
+
+ g_debug ("volume widget - mute update %i", update);
+
+ if (update == 1){
+ level = 0;
+ }
+ else{
+ level = g_variant_get_double (dbusmenu_menuitem_property_get_variant (priv->twin_item,
+ DBUSMENU_VOLUME_MENUITEM_LEVEL));
+ }
+ gtk_range_set_value(range, level);
+ g_debug ("volume-widget - update mute with value %i", update);
+ }
+ }
}
static void
@@ -188,7 +209,10 @@ volume_widget_value_changed_cb (GtkRange *range, gpointer user_data)
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);
//g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider)));
- if(current_value == 0 || current_value == 100){
+ gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item,
+ DBUSMENU_VOLUME_MENUITEM_MUTE));
+
+ if((current_value == 0 && mute != 1) || current_value == 100){
volume_widget_update(mitem, current_value);
}