diff options
Diffstat (limited to 'src/slider-menu-item.c')
-rw-r--r-- | src/slider-menu-item.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index d7d08fb..8186fa3 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -69,9 +69,6 @@ slider_menu_item_class_init (SliderMenuItemClass *klass) static void slider_menu_item_init (SliderMenuItem *self) { -/* - g_debug("Building new Slider Menu Item"); -*/ dbusmenu_menuitem_property_set( DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_VOLUME_MENUITEM_TYPE ); @@ -108,11 +105,13 @@ handle_event (DbusmenuMenuitem * mi, SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi)); gdouble volume_input = g_variant_get_double (value); + /* g_debug ("slider menu item handle event with value %f on name %s", volume_input, name); */ + slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input); device_ensure_sink_is_unmuted (priv->a_sink); } @@ -135,7 +134,7 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update) dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self), DBUSMENU_VOLUME_MENUITEM_LEVEL, new_volume); - GVariant* new_mute_update = g_variant_new_int32 (update->mute); + GVariant* new_mute_update = g_variant_new_boolean (update->mute == 1); dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self), DBUSMENU_VOLUME_MENUITEM_MUTE, new_mute_update); @@ -147,6 +146,7 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update) static void slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent) { + /* g_debug ("slider menu item update volume - about to set the volume to %f", percent); */ @@ -177,18 +177,21 @@ slider_menu_item_update (SliderMenuItem* self, const pa_sink_info* update) gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; GVariant* new_volume = g_variant_new_double (volume_percent); + /* g_debug ("slider menu item update - volume update to ui to %f", volume_percent); */ + 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 on ui = %i", update->mute); */ - GVariant* new_mute_update = g_variant_new_int32 (update->mute); + GVariant* new_mute_update = g_variant_new_boolean (update->mute == 1); dbusmenu_menuitem_property_set_variant (DBUSMENU_MENUITEM(self), DBUSMENU_VOLUME_MENUITEM_MUTE, new_mute_update); @@ -241,4 +244,4 @@ slider_menu_item_new (Device* sink) SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (self); priv->a_sink = sink; return self; -}
\ No newline at end of file +} |