aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-sound.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-08-31 12:08:03 +0100
committerConor Curran <conor.curran@canonical.com>2010-08-31 12:08:03 +0100
commita9a0b28e5f0410bc1172a21ea7e40bb3c76ece8c (patch)
tree99d7f56fc0d1df5efbdc78c2d5cf972d880d50d3 /src/indicator-sound.c
parent27cffeb0da739fa484ea22e6dbad26fe2978f451 (diff)
downloadayatana-indicator-sound-a9a0b28e5f0410bc1172a21ea7e40bb3c76ece8c.tar.gz
ayatana-indicator-sound-a9a0b28e5f0410bc1172a21ea7e40bb3c76ece8c.tar.bz2
ayatana-indicator-sound-a9a0b28e5f0410bc1172a21ea7e40bb3c76ece8c.zip
fixed the scrolling regression
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r--src/indicator-sound.c29
1 files changed, 28 insertions, 1 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