From 1a211d63c3c6282a03274d600f12292939fa57ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 16 Jul 2014 15:40:42 +0200 Subject: IndicatorLoader: convert gtk scroll events to indicator object events They actually match, but just for safety... --- tools/indicator-loader.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 8fee29b..a734b8a 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -63,16 +63,39 @@ scroll_entry (GtkWidget *widget, GdkEventScroll* event, gpointer user_data) g_return_if_fail (INDICATOR_IS_OBJECT(user_data)); entry = g_object_get_qdata (G_OBJECT(widget), entry_data_quark()); + IndicatorScrollDirection direction = G_MAXINT; + + switch (event->direction) + { + case GDK_SCROLL_UP: + direction = INDICATOR_OBJECT_SCROLL_UP; + break; + case GDK_SCROLL_DOWN: + direction = INDICATOR_OBJECT_SCROLL_DOWN; + break; + case GDK_SCROLL_LEFT: + direction = INDICATOR_OBJECT_SCROLL_LEFT; + break; + case GDK_SCROLL_RIGHT: + direction = INDICATOR_OBJECT_SCROLL_RIGHT; + break; + default: + break; + } if (entry == NULL) { g_debug("Scroll on: (null)"); } + else if (direction == G_MAXINT) + { + g_debug("Scroll direction not supported"); + } else { g_signal_emit_by_name(INDICATOR_OBJECT(user_data), INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, - entry, 1, event->direction); + entry, 1, direction); } } -- cgit v1.2.3