aboutsummaryrefslogtreecommitdiff
path: root/src/slider-menu-item.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-21 13:04:13 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-21 13:04:13 +0000
commitd84e5d382f2f62e4af5d0e9f8ed993b671acc15a (patch)
treeb94727653de339ed7eae81f17b2cf9987971e012 /src/slider-menu-item.c
parent8418707f9e99f08b44e8cb7641ba50a110003784 (diff)
downloadayatana-indicator-sound-d84e5d382f2f62e4af5d0e9f8ed993b671acc15a.tar.gz
ayatana-indicator-sound-d84e5d382f2f62e4af5d0e9f8ed993b671acc15a.tar.bz2
ayatana-indicator-sound-d84e5d382f2f62e4af5d0e9f8ed993b671acc15a.zip
some extra trace around sliders to track the volume zero app start madness
Diffstat (limited to 'src/slider-menu-item.c')
-rw-r--r--src/slider-menu-item.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index 974749f..d7d08fb 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -69,7 +69,9 @@ 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 );
@@ -101,21 +103,18 @@ handle_event (DbusmenuMenuitem * mi,
GVariant * value,
guint timestamp)
{
- GVariant* input = NULL;
- input = value;
- if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) {
- input = g_variant_get_variant(value);
- }
+ g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
+ g_return_if_fail (IS_SLIDER_MENU_ITEM (mi));
- if (value != NULL){
- if (IS_SLIDER_MENU_ITEM (mi)) {
- SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi));
- gdouble volume_input = g_variant_get_double(input);
- //g_debug ("slider menu item about to update volume %f", volume_input);
- slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input);
- device_ensure_sink_is_unmuted (priv->a_sink);
- }
- }
+ 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);
}
@@ -148,6 +147,10 @@ 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);
+*/
+
pa_cvolume new_volume;
pa_cvolume_init(&new_volume);
new_volume.channels = 1;
@@ -174,12 +177,17 @@ 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 = %i", update->mute);
+/*
+ g_debug ("volume menu item - update - mute on ui = %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,