[gimp] app: don't duplicate code when setting GimpSpinScale's cursor



commit 27179d62197eb71744c0610036ce13d873a8a1e3
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jan 21 18:18:44 2011 +0100

    app: don't duplicate code when setting GimpSpinScale's cursor

 app/widgets/gimpspinscale.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/app/widgets/gimpspinscale.c b/app/widgets/gimpspinscale.c
index b88b331..d1b1368 100644
--- a/app/widgets/gimpspinscale.c
+++ b/app/widgets/gimpspinscale.c
@@ -383,24 +383,16 @@ gimp_spin_scale_button_motion (GtkWidget      *widget,
          (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
       event->window == gtk_entry_get_text_window (GTK_ENTRY (widget)))
     {
-      if (gimp_spin_scale_on_number (widget, event->x, event->y))
-        {
-          GdkDisplay *display = gtk_widget_get_display (widget);
-          GdkCursor  *cursor;
+      GdkDisplay *display = gtk_widget_get_display (widget);
+      GdkCursor  *cursor;
 
-          cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
-          gdk_window_set_cursor (event->window, cursor);
-          gdk_cursor_unref (cursor);
-        }
+      if (gimp_spin_scale_on_number (widget, event->x, event->y))
+        cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
       else
-        {
-          GdkDisplay *display = gtk_widget_get_display (widget);
-          GdkCursor  *cursor;
+        cursor = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
 
-          cursor = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
-          gdk_window_set_cursor (event->window, cursor);
-          gdk_cursor_unref (cursor);
-        }
+      gdk_window_set_cursor (event->window, cursor);
+      gdk_cursor_unref (cursor);
     }
 
   return FALSE;



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