diff options
-rw-r--r-- | src/indicator-sound.c | 29 | ||||
-rw-r--r-- | src/volume-widget.c | 4 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 63ad72d..a454600 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -67,6 +67,8 @@ G_DEFINE_TYPE (IndicatorSound, indicator_sound, INDICATOR_OBJECT_TYPE); static GtkLabel * get_label (IndicatorObject * io); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); +static void indicator_sound_scroll (IndicatorObject* io, gint delta, IndicatorScrollDirection direction); + //Slider related static gboolean new_volume_slider_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); @@ -135,7 +137,7 @@ indicator_sound_class_init (IndicatorSoundClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; - + io_class->scroll = indicator_sound_scroll; design_team_size = gtk_icon_size_register("design-team-size", 22, 22); return; @@ -710,3 +712,28 @@ style_changed_cb(GtkWidget *widget, gpointer user_data) free_the_animation_list(); prepare_blocked_animation(); } + +static void +indicator_sound_scroll (IndicatorObject *io, gint delta, IndicatorScrollDirection direction) +{ + g_debug("indicator-sound-scroll - current slider value"); + + if (device_available == FALSE || current_state == STATE_MUTED) + return; + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); + GtkRange* range = (GtkRange*)slider; + gdouble value = gtk_range_get_value(range); + GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (slider)); + g_debug("indicator-sound-scroll - current slider value %f", value); + if (direction == INDICATOR_OBJECT_SCROLL_UP) { + value += adj->step_increment; + } else { + value -= adj->step_increment; + } + g_debug("indicator-sound-scroll - update slider with value %f", value); + volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value); +}
\ No newline at end of file diff --git a/src/volume-widget.c b/src/volume-widget.c index bf1ddb9..5e7cf9f 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -1,3 +1,4 @@ + /* Copyright 2010 Canonical Ltd. @@ -48,6 +49,7 @@ static void volume_widget_set_twin_item( VolumeWidget* self, DbusmenuMenuitem* twin_item); static void volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata); + static gboolean volume_widget_change_value_cb (GtkRange *range, GtkScrollType scroll, gdouble value, @@ -103,7 +105,7 @@ volume_widget_init (VolumeWidget *self) g_object_unref(secondary_gicon); GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (volume_widget)); - gtk_adjustment_set_step_increment(adj, 3); + gtk_adjustment_set_step_increment(adj, 4); } static void |