[gimp] Use accessors instead of widget->window and adjustment->value



commit 0458da1832c1a9fb50f81f5a9dc0fa5c74a4ef80
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 10 11:32:29 2009 +0200

    Use accessors instead of widget->window and adjustment->value

 plug-ins/common/cml-explorer.c   |    6 +++---
 plug-ins/common/color-exchange.c |    6 +++++-
 plug-ins/common/curve-bend.c     |   27 +++++++++++++++------------
 3 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/plug-ins/common/cml-explorer.c b/plug-ins/common/cml-explorer.c
index e3f0713..7be1d6f 100644
--- a/plug-ins/common/cml-explorer.c
+++ b/plug-ins/common/cml-explorer.c
@@ -1783,7 +1783,7 @@ function_graph_expose (GtkWidget      *widget,
       }
     }
 
-  gdk_draw_rgb_image (widget->window, style->black_gc,
+  gdk_draw_rgb_image (gtk_widget_get_window (widget), style->black_gc,
                       0, 0, 256, 256,
                       GDK_RGB_DITHER_NORMAL,
                       buffer,
@@ -1791,7 +1791,7 @@ function_graph_expose (GtkWidget      *widget,
 
   g_free (buffer);
 
-  gdk_draw_line (widget->window, style->white_gc, 0,255, 255, 0);
+  gdk_draw_line (gtk_widget_get_window (widget), style->white_gc, 0,255, 255, 0);
 
   y = 255 * CLAMP (logistic_function (param, 0, param->power),
                      0, 1.0);
@@ -1801,7 +1801,7 @@ function_graph_expose (GtkWidget      *widget,
       /* curve */
       y = 255 * CLAMP (logistic_function (param, x/(gdouble)255, param->power),
                        0, 1.0);
-      gdk_draw_line (widget->window, style->black_gc,
+      gdk_draw_line (gtk_widget_get_window (widget), style->black_gc,
                      x, 255-last_y, x, 255-y);
     }
   return TRUE;
diff --git a/plug-ins/common/color-exchange.c b/plug-ins/common/color-exchange.c
index 07f39ed..96a630a 100644
--- a/plug-ins/common/color-exchange.c
+++ b/plug-ins/common/color-exchange.c
@@ -635,7 +635,11 @@ scale_callback (GtkAdjustment *adj,
   if (GIMP_IS_COLOR_BUTTON (object))
     {
       if (color == &xargs.threshold && lock_threshold == TRUE)
-        gimp_rgb_set (color, adj->value, adj->value, adj->value);
+        {
+          gdouble value = gtk_adjustment_get_value (adj);
+
+          gimp_rgb_set (color, value, value, value);
+        }
 
       gimp_color_button_set_color (GIMP_COLOR_BUTTON (object), color);
     }
diff --git a/plug-ins/common/curve-bend.c b/plug-ins/common/curve-bend.c
index ee1b0dd..71e1216 100644
--- a/plug-ins/common/curve-bend.c
+++ b/plug-ins/common/curve-bend.c
@@ -1516,7 +1516,8 @@ bender_update (BenderDialog *cd,
 
   if (update & UP_PREVIEW)
     {
-      gdk_window_set_cursor (GTK_WIDGET (cd->shell)->window, cd->cursor_busy);
+      gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (cd->shell)),
+                             cd->cursor_busy);
       gdk_flush ();
 
       if (cd->preview_layer_id2 >= 0)
@@ -1528,7 +1529,8 @@ bender_update (BenderDialog *cd,
       if (update & UP_DRAW)
         gtk_widget_queue_draw (cd->pv_widget);
 
-      gdk_window_set_cursor (GTK_WIDGET (cd->shell)->window, NULL);
+      gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (cd->shell)),
+                             NULL);
     }
   if (update & UP_PREVIEW_EXPOSE)
     {
@@ -1592,7 +1594,8 @@ bender_update (BenderDialog *cd,
                               RADIUS * 2, RADIUS * 2, 0, 23040);
             }
         }
-      gdk_draw_drawable (cd->graph->window, graph_style->black_gc, cd->pixmap,
+      gdk_draw_drawable (gtk_widget_get_window (cd->graph),
+                         graph_style->black_gc, cd->pixmap,
                          0, 0, 0, 0, GRAPH_WIDTH + RADIUS * 2, GRAPH_HEIGHT + RADIUS * 2);
     }
 }
@@ -1790,12 +1793,12 @@ bender_rotate_adj_callback (GtkAdjustment *adjustment,
 {
   BenderDialog *cd = client_data;
 
-  if (adjustment->value != cd->rotation)
-  {
-    cd->rotation = adjustment->value;
-    if (cd->preview)
-      bender_update (cd, UP_PREVIEW | UP_DRAW);
-  }
+  if (gtk_adjustment_get_value (adjustment) != cd->rotation)
+    {
+      cd->rotation = gtk_adjustment_get_value (adjustment);
+      if (cd->preview)
+        bender_update (cd, UP_PREVIEW | UP_DRAW);
+    }
 }
 
 static void
@@ -2144,7 +2147,7 @@ bender_graph_events (GtkWidget    *widget,
   closest_point = 0;
 
   /*  get the pointer position  */
-  gdk_window_get_pointer (cd->graph->window, &tx, &ty, NULL);
+  gdk_window_get_pointer (gtk_widget_get_window (cd->graph), &tx, &ty, NULL);
   x = CLAMP ((tx - RADIUS), 0, 255);
   y = CLAMP ((ty - RADIUS), 0, 255);
 
@@ -2165,7 +2168,7 @@ bender_graph_events (GtkWidget    *widget,
     {
     case GDK_EXPOSE:
       if (cd->pixmap == NULL)
-        cd->pixmap = gdk_pixmap_new (cd->graph->window,
+        cd->pixmap = gdk_pixmap_new (gtk_widget_get_window (cd->graph),
                                      GRAPH_WIDTH + RADIUS * 2,
                                      GRAPH_HEIGHT + RADIUS * 2, -1);
 
@@ -2301,7 +2304,7 @@ bender_graph_events (GtkWidget    *widget,
       if (new_type != cursor_type)
         {
           cursor_type = new_type;
-          /* change_win_cursor (cd->graph->window, cursor_type); */
+          /* change_win_cursor (gtk_widget_get_window (cd->graph), cursor_type); */
         }
       break;
 



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