[gimp] Use various GTK+ accessors instead of object->member



commit 06673f27e26c95a5c4318e54f73a33f6591a3b16
Author: Michael Natterer <mitch gimp org>
Date:   Sat Oct 10 15:10:14 2009 +0200

    Use various GTK+ accessors instead of object->member

 plug-ins/common/lens-flare.c      |    8 ++++----
 plug-ins/common/noise-rgb.c       |    2 +-
 plug-ins/common/nova.c            |    8 ++++----
 plug-ins/common/plugin-browser.c  |    7 +++++--
 plug-ins/common/sample-colorize.c |   30 +++++++++++++++---------------
 plug-ins/common/sinus.c           |    2 +-
 plug-ins/common/sphere-designer.c |   28 ++++++++++++++--------------
 plug-ins/common/tile-paper.c      |   16 ++++++++--------
 plug-ins/common/tile-small.c      |   10 +++++-----
 plug-ins/common/unit-editor.c     |   26 +++++++++++++++++++++-----
 10 files changed, 78 insertions(+), 59 deletions(-)
---
diff --git a/plug-ins/common/lens-flare.c b/plug-ins/common/lens-flare.c
index 6f665fa..73dbcae 100644
--- a/plug-ins/common/lens-flare.c
+++ b/plug-ins/common/lens-flare.c
@@ -839,24 +839,24 @@ flare_center_cursor_draw (FlareCenter *center)
     {
       if (center->cursor_drawn)
         {
-          gdk_draw_line (prvw->window,
+          gdk_draw_line (gtk_widget_get_window (prvw),
                          style->black_gc,
                          center->oldx, 1,
                          center->oldx,
                          height - 1);
-          gdk_draw_line (prvw->window,
+          gdk_draw_line (gtk_widget_get_window (prvw),
                          style->black_gc,
                          1, center->oldy,
                          width - 1,
                          center->oldy);
         }
 
-      gdk_draw_line (prvw->window,
+      gdk_draw_line (gtk_widget_get_window (prvw),
                      style->black_gc,
                      center->curx, 1,
                      center->curx,
                      height - 1);
-      gdk_draw_line (prvw->window,
+      gdk_draw_line (gtk_widget_get_window (prvw),
                      style->black_gc,
                      1, center->cury,
                      width - 1,
diff --git a/plug-ins/common/noise-rgb.c b/plug-ins/common/noise-rgb.c
index 23daf7a..8ab8cdc 100644
--- a/plug-ins/common/noise-rgb.c
+++ b/plug-ins/common/noise-rgb.c
@@ -621,6 +621,6 @@ noisify_double_adjustment_update (GtkAdjustment *adjustment,
       for (i = 0; i < n; i++)
         if (adjustment != GTK_ADJUSTMENT (noise_int.channel_adj[i]))
           gtk_adjustment_set_value (GTK_ADJUSTMENT (noise_int.channel_adj[i]),
-                                    adjustment->value);
+                                    gtk_adjustment_get_value (adjustment));
     }
 }
diff --git a/plug-ins/common/nova.c b/plug-ins/common/nova.c
index 54835ea..da15d94 100644
--- a/plug-ins/common/nova.c
+++ b/plug-ins/common/nova.c
@@ -530,21 +530,21 @@ nova_center_cursor_draw (NovaCenter *center)
     {
       if (center->cursor_drawn)
         {
-          gdk_draw_line (prvw->window,
+          gdk_draw_line (gtk_widget_get_window (prvw),
                          style->black_gc,
                          center->oldx, 1, center->oldx,
                          height - 1);
-          gdk_draw_line (prvw->window,
+          gdk_draw_line (gtk_widget_get_window (prvw),
                          style->black_gc,
                          1, center->oldy,
                          width - 1, center->oldy);
         }
 
-      gdk_draw_line (prvw->window,
+      gdk_draw_line (gtk_widget_get_window (prvw),
                      style->black_gc,
                      center->curx, 1, center->curx,
                      height - 1);
-      gdk_draw_line (prvw->window,
+      gdk_draw_line (gtk_widget_get_window (prvw),
                      style->black_gc,
                      1, center->cury,
                      width - 1, center->cury);
diff --git a/plug-ins/common/plugin-browser.c b/plug-ins/common/plugin-browser.c
index c4a08e9..3cac344 100644
--- a/plug-ins/common/plugin-browser.c
+++ b/plug-ins/common/plugin-browser.c
@@ -541,6 +541,7 @@ browser_dialog_new (void)
   GtkTreeStore      *tree_store;
   GtkWidget         *list_view;
   GtkWidget         *tree_view;
+  GtkWidget         *parent;
   GtkTreeViewColumn *column;
   GtkCellRenderer   *renderer;
   GtkTreeSelection  *selection;
@@ -713,8 +714,10 @@ browser_dialog_new (void)
   gtk_widget_show (scrolled_window);
   gtk_widget_show (notebook);
 
-  gtk_widget_set_size_request (GIMP_BROWSER (browser->browser)->right_vbox->parent->parent,
-                               DBL_WIDTH - DBL_LIST_WIDTH, -1);
+  parent = gtk_widget_get_parent (GIMP_BROWSER (browser->browser)->right_vbox);
+  parent = gtk_widget_get_parent (parent);
+
+  gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
 
   /* now build the list */
   browser_search (GIMP_BROWSER (browser->browser), "", 0, browser);
diff --git a/plug-ins/common/sample-colorize.c b/plug-ins/common/sample-colorize.c
index 91b6331..46c02d5 100644
--- a/plug-ins/common/sample-colorize.c
+++ b/plug-ins/common/sample-colorize.c
@@ -559,7 +559,7 @@ smp_adj_lvl_in_max_upd_callback (GtkAdjustment *adjustment)
   gint32 value;
   gint   upd_flags;
 
-  value = CLAMP ((adjustment->value), 1, 255);
+  value = CLAMP ((gtk_adjustment_get_value (adjustment)), 1, 255);
 
   if (value != g_values.lvl_in_max)
     {
@@ -580,7 +580,7 @@ smp_adj_lvl_in_min_upd_callback (GtkAdjustment *adjustment)
   double value;
   gint   upd_flags;
 
-  value = CLAMP ((adjustment->value), 0, 254);
+  value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0, 254);
 
   if (value != g_values.lvl_in_min)
     {
@@ -600,7 +600,7 @@ smp_text_gamma_upd_callback (GtkAdjustment *adjustment)
 {
   double value;
 
-  value = CLAMP ((adjustment->value), 0.1, 10.0);
+  value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0.1, 10.0);
 
   if (value != g_values.lvl_in_gamma)
     {
@@ -615,7 +615,7 @@ smp_adj_lvl_out_max_upd_callback (GtkAdjustment *adjustment)
   gint32 value;
   gint   upd_flags;
 
-  value = CLAMP ((adjustment->value), 1, 255);
+  value = CLAMP ((gtk_adjustment_get_value (adjustment)), 1, 255);
 
   if (value != g_values.lvl_out_max)
     {
@@ -636,7 +636,7 @@ smp_adj_lvl_out_min_upd_callback (GtkAdjustment *adjustment)
   double value;
   gint   upd_flags;
 
-  value = CLAMP ((adjustment->value), 0, 254);
+  value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0, 254);
 
   if (value != g_values.lvl_out_min)
     {
@@ -1020,9 +1020,9 @@ levels_update (gint update)
       GtkStyle *style = gtk_widget_get_style (g_di.in_lvl_drawarea);
       gdouble   width, mid, tmp;
 
-      levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[0]);
-      levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[1]);
-      levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[2]);
+      levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[0]);
+      levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[1]);
+      levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[2]);
 
       g_di.slider_pos[0] = DA_WIDTH * ((double) g_values.lvl_in_min / 255.0);
       g_di.slider_pos[2] = DA_WIDTH * ((double) g_values.lvl_in_max / 255.0);
@@ -1032,15 +1032,15 @@ levels_update (gint update)
       tmp = log10 (1.0 / g_values.lvl_in_gamma);
       g_di.slider_pos[1] = (int) (mid + width * tmp + 0.5);
 
-      levels_draw_slider (g_di.in_lvl_drawarea->window,
+      levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
                           style->black_gc,
                           style->dark_gc[GTK_STATE_NORMAL],
                           g_di.slider_pos[1]);
-      levels_draw_slider (g_di.in_lvl_drawarea->window,
+      levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
                           style->black_gc,
                           style->black_gc,
                           g_di.slider_pos[0]);
-      levels_draw_slider (g_di.in_lvl_drawarea->window,
+      levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
                           style->black_gc,
                           style->white_gc,
                           g_di.slider_pos[2]);
@@ -1050,17 +1050,17 @@ levels_update (gint update)
     {
       GtkStyle *style = gtk_widget_get_style (g_di.sample_drawarea);
 
-      levels_erase_slider (g_di.sample_drawarea->window, g_di.slider_pos[3]);
-      levels_erase_slider (g_di.sample_drawarea->window, g_di.slider_pos[4]);
+      levels_erase_slider (gtk_widget_get_window (g_di.sample_drawarea), g_di.slider_pos[3]);
+      levels_erase_slider (gtk_widget_get_window (g_di.sample_drawarea), g_di.slider_pos[4]);
 
       g_di.slider_pos[3] = DA_WIDTH * ((double) g_values.lvl_out_min / 255.0);
       g_di.slider_pos[4] = DA_WIDTH * ((double) g_values.lvl_out_max / 255.0);
 
-      levels_draw_slider (g_di.sample_drawarea->window,
+      levels_draw_slider (gtk_widget_get_window (g_di.sample_drawarea),
                           style->black_gc,
                           style->black_gc,
                           g_di.slider_pos[3]);
-      levels_draw_slider (g_di.sample_drawarea->window,
+      levels_draw_slider (gtk_widget_get_window (g_di.sample_drawarea),
                           style->black_gc,
                           style->black_gc,
                           g_di.slider_pos[4]);
diff --git a/plug-ins/common/sinus.c b/plug-ins/common/sinus.c
index 47a075c..0118279 100644
--- a/plug-ins/common/sinus.c
+++ b/plug-ins/common/sinus.c
@@ -566,7 +566,7 @@ alpha_scale_cb (GtkAdjustment *adj,
   color_button = GIMP_COLOR_BUTTON (data);
 
   gimp_color_button_get_color (GIMP_COLOR_BUTTON (color_button), &color);
-  gimp_rgb_set_alpha (&color, adj->value);
+  gimp_rgb_set_alpha (&color, gtk_adjustment_get_value (adj));
   gimp_color_button_set_color (GIMP_COLOR_BUTTON (color_button), &color);
 }
 
diff --git a/plug-ins/common/sphere-designer.c b/plug-ins/common/sphere-designer.c
index b0706a9..2eb29f5 100644
--- a/plug-ins/common/sphere-designer.c
+++ b/plug-ins/common/sphere-designer.c
@@ -2293,7 +2293,7 @@ expose_event (GtkWidget      *widget,
   GtkStyle *style = gtk_widget_get_style (widget);
   guchar   *data  = img + event->area.y * 3 * PREVIEWSIZE + event->area.x * 3;
 
-  gdk_draw_rgb_image_dithalign (widget->window,
+  gdk_draw_rgb_image_dithalign (gtk_widget_get_window (widget),
                                 style->white_gc,
                                 event->area.x, event->area.y,
                                 event->area.width, event->area.height,
@@ -2365,25 +2365,25 @@ getscales (GtkWidget *widget,
   if (!t)
     return;
 
-  t->amount = GTK_ADJUSTMENT (amountscale)->value;
-  t->exp = GTK_ADJUSTMENT (expscale)->value;
+  t->amount = gtk_adjustment_get_value (GTK_ADJUSTMENT (amountscale));
+  t->exp = gtk_adjustment_get_value (GTK_ADJUSTMENT (expscale));
 
-  f = GTK_ADJUSTMENT (turbulencescale)->value;
+  f = gtk_adjustment_get_value (GTK_ADJUSTMENT (turbulencescale));
   vset (&t->turbulence, f, f, f);
 
-  t->oscale = GTK_ADJUSTMENT (scalescale)->value;
+  t->oscale = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalescale));
 
-  t->scale.x = GTK_ADJUSTMENT (scalexscale)->value;
-  t->scale.y = GTK_ADJUSTMENT (scaleyscale)->value;
-  t->scale.z = GTK_ADJUSTMENT (scalezscale)->value;
+  t->scale.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalexscale));
+  t->scale.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (scaleyscale));
+  t->scale.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalezscale));
 
-  t->rotate.x = GTK_ADJUSTMENT (rotxscale)->value;
-  t->rotate.y = GTK_ADJUSTMENT (rotyscale)->value;
-  t->rotate.z = GTK_ADJUSTMENT (rotzscale)->value;
+  t->rotate.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotxscale));
+  t->rotate.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotyscale));
+  t->rotate.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotzscale));
 
-  t->translate.x = GTK_ADJUSTMENT (posxscale)->value;
-  t->translate.y = GTK_ADJUSTMENT (posyscale)->value;
-  t->translate.z = GTK_ADJUSTMENT (poszscale)->value;
+  t->translate.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (posxscale));
+  t->translate.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (posyscale));
+  t->translate.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (poszscale));
 
   restartrender ();
 }
diff --git a/plug-ins/common/tile-paper.c b/plug-ins/common/tile-paper.c
index 189f0de..5435760 100644
--- a/plug-ins/common/tile-paper.c
+++ b/plug-ins/common/tile-paper.c
@@ -180,9 +180,9 @@ static struct
 static void
 tile_width_adj_changed (GtkAdjustment *adj)
 {
-  if (p.params.tile_width != (gint)adj->value)
+  if (p.params.tile_width != (gint)gtk_adjustment_get_value (adj))
     {
-      p.params.tile_width  = adj->value;
+      p.params.tile_width  = gtk_adjustment_get_value (adj);
       p.params.division_x = p.drawable->width  / p.params.tile_width;
       gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_x_adj),
                                 p.params.division_x);
@@ -192,9 +192,9 @@ tile_width_adj_changed (GtkAdjustment *adj)
 static void
 tile_height_adj_changed (GtkAdjustment *adj)
 {
-  if (p.params.tile_height != (gint)adj->value)
+  if (p.params.tile_height != (gint)gtk_adjustment_get_value (adj))
     {
-      p.params.tile_height  = adj->value;
+      p.params.tile_height  = gtk_adjustment_get_value (adj);
       p.params.division_y = p.drawable->height / p.params.tile_height;
       gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_y_adj),
                                 p.params.division_y);
@@ -204,9 +204,9 @@ tile_height_adj_changed (GtkAdjustment *adj)
 static void
 division_x_adj_changed (GtkAdjustment *adj)
 {
-  if (p.params.division_x != (gint) adj->value)
+  if (p.params.division_x != (gint) gtk_adjustment_get_value (adj))
     {
-      p.params.division_x = adj->value;
+      p.params.division_x = gtk_adjustment_get_value (adj);
       p.params.tile_width  = p.drawable->width  / p.params.division_x;
       gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_width_adj),
                                 p.params.tile_width);
@@ -216,9 +216,9 @@ division_x_adj_changed (GtkAdjustment *adj)
 static void
 division_y_adj_changed (GtkAdjustment *adj)
 {
-  if (p.params.division_y != (gint)adj->value)
+  if (p.params.division_y != (gint)gtk_adjustment_get_value (adj))
     {
-      p.params.division_y = adj->value;
+      p.params.division_y = gtk_adjustment_get_value (adj);
       p.params.tile_height  = p.drawable->height / p.params.division_y;
       gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_height_adj),
                                 p.params.tile_height);
diff --git a/plug-ins/common/tile-small.c b/plug-ins/common/tile-small.c
index e3cf44e..83a8e1c 100644
--- a/plug-ins/common/tile-small.c
+++ b/plug-ins/common/tile-small.c
@@ -649,21 +649,21 @@ draw_explict_sel (void)
 
       gdk_gc_set_function (style->black_gc, GDK_INVERT);
 
-      gdk_draw_rectangle (tint.preview->window,
+      gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
                           style->black_gc,
                           0,
                           (gint) x,
                           (gint) y,
                           (gint) width,
                           (gint) height);
-      gdk_draw_rectangle (tint.preview->window,
+      gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
                           style->black_gc,
                           0,
                           (gint) x + 1,
                           (gint) y + 1,
                           (gint) width - 2,
                           (gint) height - 2);
-      gdk_draw_rectangle (tint.preview->window,
+      gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
                           style->black_gc,
                           0,
                           (gint) x + 2,
@@ -763,12 +763,12 @@ explict_update (gboolean settile)
   gint x,y;
 
   /* Make sure bounds are OK */
-  y = ROUND (GTK_ADJUSTMENT (exp_call.r_adj)->value);
+  y = ROUND (gtk_adjustment_get_value (GTK_ADJUSTMENT (exp_call.r_adj)));
   if (y > itvals.numtiles || y <= 0)
     {
       y = itvals.numtiles;
     }
-  x = ROUND (GTK_ADJUSTMENT (exp_call.c_adj)->value);
+  x = ROUND (gtk_adjustment_get_value (GTK_ADJUSTMENT (exp_call.c_adj)));
   if (x > itvals.numtiles || x <= 0)
     {
       x = itvals.numtiles;
diff --git a/plug-ins/common/unit-editor.c b/plug-ins/common/unit-editor.c
index dcda56f..033a326 100644
--- a/plug-ins/common/unit-editor.c
+++ b/plug-ins/common/unit-editor.c
@@ -384,6 +384,8 @@ unit_editor_dialog (void)
   GtkListStore      *list_store;
   GtkWidget         *tv;
   GtkTreeViewColumn *col;
+  GtkWidget         *col_widget;
+  GtkWidget         *button;
   GtkCellRenderer   *rend;
   gint               i;
 
@@ -479,8 +481,15 @@ unit_editor_dialog (void)
 
   gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
 
-  gimp_help_set_help_data (col->button,
-                           gettext (columns[SAVE].help), NULL);
+  col_widget = gtk_tree_view_column_get_widget (col);
+  if (col_widget)
+    {
+      button = gtk_widget_get_ancestor (col_widget, GTK_TYPE_BUTTON);
+
+      if (button)
+        gimp_help_set_help_data (button,
+                                 gettext (columns[SAVE].help), NULL);
+    }
 
   g_signal_connect (rend, "toggled",
                     G_CALLBACK (saved_toggled_callback),
@@ -500,7 +509,14 @@ unit_editor_dialog (void)
 
       gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
 
-      gimp_help_set_help_data (col->button, gettext (columns[i].help), NULL);
+      col_widget = gtk_tree_view_column_get_widget (col);
+      if (col_widget)
+        {
+          button = gtk_widget_get_ancestor (col_widget, GTK_TYPE_BUTTON);
+
+          if (button)
+            gimp_help_set_help_data (button, gettext (columns[i].help), NULL);
+        }
     }
 
   unit_list_init (GTK_TREE_VIEW (tv));
@@ -555,7 +571,7 @@ new_callback (GtkAction   *action,
                                           &iter);
 
           adj = gtk_tree_view_get_vadjustment (tv);
-          gtk_adjustment_set_value (adj, adj->upper);
+          gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj));
         }
     }
 }
@@ -597,7 +613,7 @@ duplicate_callback (GtkAction   *action,
               gtk_tree_selection_select_iter (sel, &iter);
 
               adj = gtk_tree_view_get_vadjustment (tv);
-              gtk_adjustment_set_value (adj, adj->upper);
+              gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj));
             }
         }
     }



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