aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/indicator-loader.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c
index 153cca7..a734b8a 100644
--- a/tools/indicator-loader.c
+++ b/tools/indicator-loader.c
@@ -55,6 +55,50 @@ activate_entry (GtkWidget * widget, gpointer user_data)
}
}
+static void
+scroll_entry (GtkWidget *widget, GdkEventScroll* event, gpointer user_data)
+{
+ gpointer entry;
+
+ 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, direction);
+ }
+}
+
static GtkWidget*
create_menu_item (IndicatorObjectEntry * entry)
{
@@ -106,6 +150,9 @@ entry_added (IndicatorObject * io,
g_object_set_qdata (G_OBJECT(menu_item), entry_data_quark(), entry);
g_signal_connect (menu_item, "activate", G_CALLBACK(activate_entry), io);
+ gtk_widget_set_events (menu_item, gtk_widget_get_events (menu_item) | GDK_SCROLL_MASK);
+ g_signal_connect (menu_item, "scroll-event", G_CALLBACK(scroll_entry), io);
+
gtk_menu_shell_append (GTK_MENU_SHELL(user_data), menu_item);
}