aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libindicator/indicator-ng.c8
-rw-r--r--tools/indicator-loader.c47
2 files changed, 53 insertions, 2 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c
index d83a2b5..d1d2854 100644
--- a/libindicator/indicator-ng.c
+++ b/libindicator/indicator-ng.c
@@ -194,8 +194,12 @@ indicator_ng_entry_scrolled (IndicatorObject *io,
if (self->actions && self->scroll_action)
{
- if (direction == INDICATOR_OBJECT_SCROLL_DOWN)
- delta *= -1;
+ if (direction == INDICATOR_OBJECT_SCROLL_DOWN ||
+ direction == INDICATOR_OBJECT_SCROLL_LEFT)
+ {
+ delta *= -1;
+ }
+
g_action_group_activate_action (self->actions, self->scroll_action,
g_variant_new_int32 (delta));
}
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);
}