diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2011-03-11 12:47:25 -0500 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2011-03-11 12:47:25 -0500 |
commit | a65cff5ec2d7625408d58fe6b23ddb40d7f63ee2 (patch) | |
tree | e745cb3cd2db766aa66b481accda28221f933d75 /src/volume-widget.c | |
parent | 73772e6ea7f0ca55bd3df65a031ddb48fba66104 (diff) | |
parent | 014ef9d63fdf4d7213f1a9481d0566a63daa7543 (diff) | |
download | ayatana-indicator-sound-a65cff5ec2d7625408d58fe6b23ddb40d7f63ee2.tar.gz ayatana-indicator-sound-a65cff5ec2d7625408d58fe6b23ddb40d7f63ee2.tar.bz2 ayatana-indicator-sound-a65cff5ec2d7625408d58fe6b23ddb40d7f63ee2.zip |
Import upstream version 0.6.3
Diffstat (limited to 'src/volume-widget.c')
-rw-r--r-- | src/volume-widget.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/volume-widget.c b/src/volume-widget.c index be97994..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,16 +137,8 @@ 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); - - GList *entry = indicator_object_get_entries(priv->indicator); - g_signal_emit(G_OBJECT(priv->indicator), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_desc(priv->indicator); } } } @@ -165,25 +158,19 @@ volume_widget_set_twin_item(VolumeWidget* self, GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); GtkRange *range = (GtkRange*)slider; gtk_range_set_value(range, initial_level); - - GList *entry = indicator_object_get_entries(priv->indicator); - g_signal_emit(G_OBJECT(priv->indicator), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_desc(priv->indicator); } 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; } @@ -192,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; } |