commit d32e823aa730a91f3555a1d5ea0821eae52e991b Author: Leonid Evdokimov Date: Sun Jul 19 18:24:59 2009 +0700 Mouse scroll shows next label of the scroll box. diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c index 7a36cd7..752ccf5 100644 --- a/panel-plugin/weather-scrollbox.c +++ b/panel-plugin/weather-scrollbox.c @@ -445,6 +445,12 @@ gtk_scrollbox_expose (GtkWidget *widget, } +void +gtk_scrollbox_next_label(GtkScrollbox *self) +{ + stop_callback (self); + start_draw_down (self); +} void gtk_scrollbox_enablecb (GtkScrollbox *self, diff --git a/panel-plugin/weather-scrollbox.h b/panel-plugin/weather-scrollbox.h index 78a3a7c..c4a1197 100644 --- a/panel-plugin/weather-scrollbox.h +++ b/panel-plugin/weather-scrollbox.h @@ -64,6 +64,8 @@ void gtk_scrollbox_clear (GtkScrollbox * self); void gtk_scrollbox_set_animate(GtkScrollbox *self, gboolean animate); +void gtk_scrollbox_next_label(GtkScrollbox *self); + G_END_DECLS #endif diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c index d26ea52..1a9f778 100644 --- a/panel-plugin/weather.c +++ b/panel-plugin/weather.c @@ -655,6 +655,22 @@ cb_click (GtkWidget *widget, return FALSE; } +static gboolean +cb_scroll (GtkWidget *widget, + GdkEventScroll *event, + gpointer user_data) +{ + xfceweather_data *data = (xfceweather_data *) user_data; + + if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN) + { + gtk_scrollbox_next_label(GTK_SCROLLBOX(data->scrollbox)); + } + + return FALSE; +} + + static void mi_click (GtkWidget *widget, gpointer user_data) @@ -816,6 +832,8 @@ xfceweather_create_control (XfcePanelPlugin *plugin) g_signal_connect (G_OBJECT (data->tooltipbox), "button-press-event", G_CALLBACK (cb_click), data); + g_signal_connect (G_OBJECT (data->tooltipbox), "scroll-event", + G_CALLBACK (cb_scroll), data); gtk_widget_add_events(data->scrollbox, GDK_BUTTON_PRESS_MASK); /* add refresh button to right click menu, for people who missed the middle mouse click feature */