ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02199
[Merge] lp:~cjcurran/indicator-sound/scroll-regression-fix into lp:indicator-sound
Conor Curran has proposed merging lp:~cjcurran/indicator-sound/scroll-regression-fix into lp:indicator-sound.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
The ability to scroll on the indicator icon on the panel was accidentally removed in a big refactor earlier in this cycle. This branch just re-enables the feature.
--
https://code.launchpad.net/~cjcurran/indicator-sound/scroll-regression-fix/+merge/34183
Your team ayatana-commits is subscribed to branch lp:indicator-sound.
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2010-08-19 17:20:27 +0000
+++ src/indicator-sound.c 2010-08-31 11:15:53 +0000
@@ -67,6 +67,8 @@
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 @@
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 @@
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
=== modified file 'src/volume-widget.c'
--- src/volume-widget.c 2010-08-06 12:20:03 +0000
+++ src/volume-widget.c 2010-08-31 11:15:53 +0000
@@ -1,3 +1,4 @@
+
/*
Copyright 2010 Canonical Ltd.
@@ -48,6 +49,7 @@
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 @@
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
Follow ups