aboutsummaryrefslogtreecommitdiff
path: root/src/volume-widget.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-10 19:48:26 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-10 19:48:26 +0000
commitf6fd2dc4c5c1fb31f9175ddded990264cf939c77 (patch)
treefb2f6884429eb982ffb9c9feb57dffdbdafb342a /src/volume-widget.c
parent01b69bd1d0979f27f003f06151fcda72102f2067 (diff)
downloadayatana-indicator-sound-f6fd2dc4c5c1fb31f9175ddded990264cf939c77.tar.gz
ayatana-indicator-sound-f6fd2dc4c5c1fb31f9175ddded990264cf939c77.tar.bz2
ayatana-indicator-sound-f6fd2dc4c5c1fb31f9175ddded990264cf939c77.zip
fixes bug around volume going to zero on client start up
Diffstat (limited to 'src/volume-widget.c')
-rw-r--r--src/volume-widget.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/volume-widget.c b/src/volume-widget.c
index c45e93c..5c842dc 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -128,6 +128,7 @@ 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);
@@ -136,7 +137,6 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
gdouble update = g_variant_get_double (value);
- //g_debug("volume-widget - update level with value %f", update);
gtk_range_set_value(range, update);
update_accessible_desc(priv->indicator);
}
@@ -163,13 +163,14 @@ volume_widget_set_twin_item(VolumeWidget* self,
static gboolean
volume_widget_change_value_cb (GtkRange *range,
- GtkScrollType scroll,
- gdouble new_value,
- gpointer user_data)
+ GtkScrollType scroll,
+ gdouble new_value,
+ gpointer user_data)
{
g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- volume_widget_update(mitem, new_value);
+ //g_debug ("changed value %f", new_value);
+ volume_widget_update(mitem, new_value);
return FALSE;
}
@@ -178,17 +179,19 @@ volume_widget_change_value_cb (GtkRange *range,
which set the slider to 0 or 100. Ignore all other events.
*/
static gboolean
-volume_widget_value_changed_cb(GtkRange *range, gpointer user_data)
+volume_widget_value_changed_cb (GtkRange *range, gpointer user_data)
{
+
g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
VolumeWidget* mitem = VOLUME_WIDGET(user_data);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ 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){
volume_widget_update(mitem, current_value);
}
+
return FALSE;
}