[gnome-media/gnome-2-32] Handle side-scrolling on scales



commit 25bda6773864a4cdbbdc385e1731ffcf2c8694a7
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 8 14:00:53 2010 +0100

    Handle side-scrolling on scales

 gnome-volume-control/src/gvc-channel-bar.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gnome-volume-control/src/gvc-channel-bar.c b/gnome-volume-control/src/gvc-channel-bar.c
index 74aefe1..66b8bc8 100644
--- a/gnome-volume-control/src/gvc-channel-bar.c
+++ b/gnome-volume-control/src/gvc-channel-bar.c
@@ -435,9 +435,23 @@ gvc_channel_bar_scroll (GvcChannelBar *bar, GdkScrollDirection direction)
         g_return_val_if_fail (bar != NULL, FALSE);
         g_return_val_if_fail (GVC_IS_CHANNEL_BAR (bar), FALSE);
 
-        /* FIXME we should handle left/right for horizontal bars */
-        if (direction != GDK_SCROLL_UP && direction != GDK_SCROLL_DOWN)
-                return FALSE;
+        if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
+                if (direction != GDK_SCROLL_UP && direction != GDK_SCROLL_DOWN)
+                        return FALSE;
+        } else {
+                /* Switch direction for RTL */
+                if (gtk_widget_get_direction (GTK_WIDGET (bar)) == GTK_TEXT_DIR_RTL) {
+                        if (direction == GDK_SCROLL_RIGHT)
+                                direction = GDK_SCROLL_LEFT;
+                        else if (direction == GDK_SCROLL_LEFT)
+                                direction = GDK_SCROLL_RIGHT;
+                }
+                /* Switch side scroll to vertical */
+                if (direction == GDK_SCROLL_RIGHT)
+                        direction = GDK_SCROLL_UP;
+                else if (GDK_SCROLL_LEFT)
+                        direction = GDK_SCROLL_DOWN;
+        }
 
         adj = gtk_range_get_adjustment (GTK_RANGE (bar->priv->scale));
         if (adj == bar->priv->zero_adjustment) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]