diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-09-06 11:48:50 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-09-06 11:48:50 +0100 |
commit | d029feb874b01c3d5bb4465cde13b949bca84d73 (patch) | |
tree | 517bb8710d32cb3bca042cef378c58203d66c348 /src | |
parent | 610f7ed87e0b95dd16ff75024672dba36028b745 (diff) | |
parent | a9a0b28e5f0410bc1172a21ea7e40bb3c76ece8c (diff) | |
download | ayatana-indicator-sound-d029feb874b01c3d5bb4465cde13b949bca84d73.tar.gz ayatana-indicator-sound-d029feb874b01c3d5bb4465cde13b949bca84d73.tar.bz2 ayatana-indicator-sound-d029feb874b01c3d5bb4465cde13b949bca84d73.zip |
scroll fix merged
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-sound.c | 29 | ||||
-rw-r--r-- | src/sound-service.c | 4 | ||||
-rw-r--r-- | src/volume-widget.c | 4 |
3 files changed, 33 insertions, 4 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/sound-service.c b/src/sound-service.c index 12f067e..42ce116 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); // TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } 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 |