aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-02-13 00:43:20 -0600
committerCody Russell <crussell@canonical.com>2010-02-13 00:43:20 -0600
commitfc660fc42064603b811909ce5be7f7dd0b5efdfe (patch)
tree323e55f106c1d874fdbf688ece5f4513b62f8e4f
parentad50ecd5bb91cb6cb0c45e82fd1d88e3ab233a36 (diff)
downloadayatana-ido-fc660fc42064603b811909ce5be7f7dd0b5efdfe.tar.gz
ayatana-ido-fc660fc42064603b811909ce5be7f7dd0b5efdfe.tar.bz2
ayatana-ido-fc660fc42064603b811909ce5be7f7dd0b5efdfe.zip
Support reversing scroll events
-rw-r--r--src/idoscalemenuitem.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c
index 668a8b1..190556c 100644
--- a/src/idoscalemenuitem.c
+++ b/src/idoscalemenuitem.c
@@ -66,11 +66,13 @@ struct _IdoScaleMenuItemPrivate {
GtkAllocation child_allocation;
gdouble left_padding;
gdouble right_padding;
+ gboolean reverse_scroll;
};
enum {
PROP_0,
- PROP_ADJUSTMENT
+ PROP_ADJUSTMENT,
+ PROP_REVERSE_SCROLL_EVENTS
};
G_DEFINE_TYPE (IdoScaleMenuItem, ido_scale_menu_item, GTK_TYPE_MENU_ITEM)
@@ -88,7 +90,13 @@ static gboolean
ido_scale_menu_item_scroll_event (GtkWidget *menuitem,
GdkEventScroll *event)
{
- GtkWidget *scale = GET_PRIVATE (IDO_SCALE_MENU_ITEM (menuitem))->scale;
+ IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+ GtkWidget *scale = priv->scale;
+
+ if (priv->reverse_scroll)
+ {
+ event->direction = !event->direction;
+ }
gtk_widget_event (scale,
((GdkEvent *)(void*)(event)));
@@ -174,6 +182,14 @@ ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class)
GTK_TYPE_ADJUSTMENT,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_REVERSE_SCROLL_EVENTS,
+ g_param_spec_boolean ("reverse-scroll-events",
+ "Reverse scroll events",
+ "Reverses how scroll events are interpreted",
+ FALSE,
+ G_PARAM_READWRITE));
+
g_type_class_add_private (object_class, sizeof (IdoScaleMenuItemPrivate));
}
@@ -199,7 +215,10 @@ ido_scale_menu_item_set_property (GObject *object,
{
case PROP_ADJUSTMENT:
gtk_range_set_adjustment (GTK_RANGE (priv->scale), g_value_get_object (value));
+ break;
+ case PROP_REVERSE_SCROLL_EVENTS:
+ priv->reverse_scroll = g_value_get_boolean (value);
break;
default:
@@ -224,6 +243,10 @@ ido_scale_menu_item_get_property (GObject *object,
g_value_set_object (value, adjustment);
break;
+ case PROP_REVERSE_SCROLL_EVENTS:
+ g_value_set_boolean (value, priv->reverse_scroll);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;