[Goodies-commits] r4789 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Mon May 12 09:31:08 CEST 2008


Author: stephan
Date: 2008-05-12 07:31:07 +0000 (Mon, 12 May 2008)
New Revision: 4789

Modified:
   ristretto/trunk/src/thumbnail_bar.c
Log:
Limit thumbnail scrolling in the right direction



Modified: ristretto/trunk/src/thumbnail_bar.c
===================================================================
--- ristretto/trunk/src/thumbnail_bar.c	2008-05-12 07:05:40 UTC (rev 4788)
+++ ristretto/trunk/src/thumbnail_bar.c	2008-05-12 07:31:07 UTC (rev 4789)
@@ -823,8 +823,28 @@
     {
         case GDK_SCROLL_UP:
         case GDK_SCROLL_LEFT:
-            bar->priv->auto_center = FALSE;
-            bar->priv->offset -= 30;
+            if (bar->priv->thumbs)
+            {   
+                gint thumb_width;
+                gint thumb_height;
+                switch(bar->priv->orientation)
+                {
+                    case GTK_ORIENTATION_HORIZONTAL:
+                        thumb_width = GTK_WIDGET(bar->priv->thumbs->data)->allocation.width;
+                        bar->priv->auto_center = FALSE;
+                        bar->priv->offset -= 30;
+                        if ((thumb_width - GTK_WIDGET(bar)->allocation.width) >= bar->priv->offset)
+                            bar->priv->offset = thumb_width - GTK_WIDGET(bar)->allocation.width;
+                        break;
+                    case GTK_ORIENTATION_VERTICAL:
+                        thumb_height = GTK_WIDGET(bar->priv->thumbs->data)->allocation.height;
+                        bar->priv->auto_center = FALSE;
+                        bar->priv->offset -= 30;
+                        if ((thumb_height - GTK_WIDGET(bar)->allocation.height) >= bar->priv->offset)
+                            bar->priv->offset = thumb_height - GTK_WIDGET(bar)->allocation.height;
+                        break;
+                }
+            }
             break;
         case GDK_SCROLL_DOWN:
         case GDK_SCROLL_RIGHT:




More information about the Goodies-commits mailing list