[gimp] Use accessors from GTK+ 2.20 instead of using sealed members directly



commit a2c70822d4cee7af3c6cf6f3983523e24afa6743
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 19 19:21:07 2010 +0200

    Use accessors from GTK+ 2.20 instead of using sealed members directly

 app/dialogs/resolution-calibrate-dialog.c |    5 +--
 app/display/gimpcanvas.c                  |    7 +--
 app/display/gimpdisplayshell-callbacks.c  |    2 +-
 app/display/gimpimagewindow.c             |    5 +--
 app/widgets/gimpcolormapeditor.c          |    4 +-
 app/widgets/gimpcursor.c                  |    5 +--
 app/widgets/gimpdockable.c                |    5 +--
 app/widgets/gimpoverlaybox.c              |   10 +---
 app/widgets/gimpoverlaychild.c            |    9 +---
 app/widgets/gimptagentry.c                |    4 +-
 app/widgets/gimptagpopup.c                |   50 +++++++++++++---------
 app/widgets/gimpview.c                    |   23 ++++------
 app/widgets/gimpwidgets-utils.c           |   13 ++----
 libgimp/gimpprogressbar.c                 |    7 +--
 libgimp/gimpui.c                          |    7 +--
 libgimp/gimpzoompreview.c                 |    5 +--
 libgimpwidgets/gimpcolorscale.c           |   65 +++++++++++++---------------
 libgimpwidgets/gimppixmap.c               |    2 +-
 libgimpwidgets/gimppreview.c              |    7 +--
 libgimpwidgets/gimpruler.c                |   10 +---
 libgimpwidgets/gimpscrolledpreview.c      |    5 +--
 plug-ins/common/animation-play.c          |    5 +--
 plug-ins/ifs-compose/ifs-compose.c        |    5 +--
 23 files changed, 104 insertions(+), 156 deletions(-)
---
diff --git a/app/dialogs/resolution-calibrate-dialog.c b/app/dialogs/resolution-calibrate-dialog.c
index 9e34dda..e7ca180 100644
--- a/app/dialogs/resolution-calibrate-dialog.c
+++ b/app/dialogs/resolution-calibrate-dialog.c
@@ -17,9 +17,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpmath/gimpmath.h"
@@ -62,7 +59,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
   gint          monitor;
 
   g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
-  g_return_if_fail (GTK_WIDGET_REALIZED (resolution_entry));
+  g_return_if_fail (gtk_widget_get_realized (resolution_entry));
   g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
 
   /*  this dialog can only exist once  */
diff --git a/app/display/gimpcanvas.c b/app/display/gimpcanvas.c
index b41e8b7..9b27a85 100644
--- a/app/display/gimpcanvas.c
+++ b/app/display/gimpcanvas.c
@@ -17,9 +17,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
@@ -344,7 +341,7 @@ gimp_canvas_gc_new (GimpCanvas      *canvas,
   GdkColor         fg   = { 0, 0, 0, 0 };
   GdkColor         bg   = { 0, 0, 0, 0 };
 
-  if (! GTK_WIDGET_REALIZED (GTK_WIDGET (canvas)))
+  if (! gtk_widget_get_realized (GTK_WIDGET (canvas)))
     return NULL;
 
   switch (style)
@@ -1052,7 +1049,7 @@ gimp_canvas_set_bg_color (GimpCanvas *canvas,
   GdkColormap *colormap;
   GdkColor     gdk_color;
 
-  if (! GTK_WIDGET_REALIZED (widget))
+  if (! gtk_widget_get_realized (widget))
     return;
 
   gimp_rgb_get_gdk_color (color, &gdk_color);
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 7464010..310715a 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -613,7 +613,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
   gboolean         return_val       = FALSE;
   gboolean         update_sw_cursor = FALSE;
 
-  g_return_val_if_fail (GTK_WIDGET_REALIZED (canvas), FALSE);
+  g_return_val_if_fail (gtk_widget_get_realized (canvas), FALSE);
 
   /*  are we in destruction?  */
   if (! shell->display || ! gimp_display_get_shell (shell->display))
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index b915e00..b58a133 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -17,9 +17,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gegl.h>
 #include <gtk/gtk.h>
 
@@ -923,7 +920,7 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
 
   private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
 
-  if (! GTK_WIDGET_REALIZED (window))
+  if (! gtk_widget_get_realized (GTK_WIDGET (window)))
     return;
 
   /* FIXME this so needs cleanup and shell/window separation */
diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c
index 4f8be86..c212157 100644
--- a/app/widgets/gimpcolormapeditor.c
+++ b/app/widgets/gimpcolormapeditor.c
@@ -19,8 +19,6 @@
 
 #include <string.h>
 
-#undef GSEAL_ENABLE
-
 /* FIXME: #undef GTK_DISABLE_DEPRECATED */
 #undef GTK_DISABLE_DEPRECATED
 
@@ -328,7 +326,7 @@ gimp_colormap_editor_set_image (GimpImageEditor *image_editor,
         {
           gtk_adjustment_set_upper (editor->index_adjustment, 0);
 
-          if (GTK_WIDGET_MAPPED (GTK_WIDGET (editor)))
+          if (gtk_widget_get_mapped (GTK_WIDGET (editor)))
             gimp_colormap_editor_clear (editor, -1);
         }
     }
diff --git a/app/widgets/gimpcursor.c b/app/widgets/gimpcursor.c
index ee1d9cb..b82adad 100644
--- a/app/widgets/gimpcursor.c
+++ b/app/widgets/gimpcursor.c
@@ -17,9 +17,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "widgets-types.h"
@@ -812,7 +809,7 @@ gimp_cursor_set (GtkWidget          *widget,
   GdkCursor *cursor;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GTK_WIDGET_REALIZED (widget));
+  g_return_if_fail (gtk_widget_get_realized (widget));
 
   cursor = gimp_cursor_new (gtk_widget_get_display (widget),
                             cursor_format,
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index b5dc78c..ea4eb1e 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <string.h>
 
 #include <gtk/gtk.h>
@@ -1263,7 +1260,7 @@ gimp_dockable_blink_cancel (GimpDockable *dockable)
 static void
 gimp_dockable_cursor_setup (GimpDockable *dockable)
 {
-  if (! GTK_WIDGET_REALIZED (GTK_WIDGET (dockable)))
+  if (! gtk_widget_get_realized (GTK_WIDGET (dockable)))
     return;
 
   if (! dockable->p->title_window)
diff --git a/app/widgets/gimpoverlaybox.c b/app/widgets/gimpoverlaybox.c
index d840a79..ab68d04 100644
--- a/app/widgets/gimpoverlaybox.c
+++ b/app/widgets/gimpoverlaybox.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "widgets-types.h"
@@ -143,7 +140,7 @@ gimp_overlay_box_realize (GtkWidget *widget)
   gint            attributes_mask;
   GList          *list;
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
 
   gtk_widget_get_allocation (widget, &allocation);
 
@@ -168,8 +165,7 @@ gimp_overlay_box_realize (GtkWidget *widget)
                     G_CALLBACK (gimp_overlay_box_pick_embedded_child),
                     widget);
 
-  widget->style = gtk_style_attach (gtk_widget_get_style (widget),
-                                    gtk_widget_get_window (widget));
+  gtk_widget_style_attach (widget);
   gtk_style_set_background (gtk_widget_get_style (widget),
                             gtk_widget_get_window (widget),
                             GTK_STATE_NORMAL);
@@ -216,7 +212,7 @@ gimp_overlay_box_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     gdk_window_move_resize (gtk_widget_get_window (widget),
                             allocation->x,
                             allocation->y,
diff --git a/app/widgets/gimpoverlaychild.c b/app/widgets/gimpoverlaychild.c
index 9dc4966..d51bbc0 100644
--- a/app/widgets/gimpoverlaychild.c
+++ b/app/widgets/gimpoverlaychild.c
@@ -21,9 +21,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include <libgimpmath/gimpmath.h>
@@ -81,7 +78,7 @@ gimp_overlay_child_new (GimpOverlayBox *box,
 
   cairo_matrix_init_identity (&child->matrix);
 
-  if (GTK_WIDGET_REALIZED (box))
+  if (gtk_widget_get_realized (GTK_WIDGET (box)))
     gimp_overlay_child_realize (box, child);
 
   gtk_widget_set_parent (widget, GTK_WIDGET (box));
@@ -98,7 +95,7 @@ gimp_overlay_child_free (GimpOverlayBox   *box,
 
   gtk_widget_unparent (child->widget);
 
-  if (GTK_WIDGET_REALIZED (box))
+  if (gtk_widget_get_realized (GTK_WIDGET (box)))
     gimp_overlay_child_unrealize (box, child);
 
   g_slice_free (GimpOverlayChild, child);
@@ -245,7 +242,7 @@ gimp_overlay_child_size_allocate (GimpOverlayBox   *box,
 
   gtk_widget_get_allocation (child->widget, &child_allocation);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (GTK_WIDGET (widget)))
     {
       GdkRectangle old_allocation;
       GdkRectangle old_bounds;
diff --git a/app/widgets/gimptagentry.c b/app/widgets/gimptagentry.c
index 1f8c5ee..934c3d4 100644
--- a/app/widgets/gimptagentry.c
+++ b/app/widgets/gimptagentry.c
@@ -22,8 +22,6 @@
 
 #include <string.h>
 
-#undef GSEAL_ENABLE
-
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -1271,7 +1269,7 @@ gimp_tag_entry_expose (GtkWidget      *widget,
   const char     *display_text;
 
   /* eeeeeek */
-  if (event->window != GTK_ENTRY (widget)->text_area)
+  if (event->window != gtk_entry_get_text_window (GTK_ENTRY (widget)))
     return FALSE;
 
   if (! GIMP_TAG_ENTRY (widget)->description_shown)
diff --git a/app/widgets/gimptagpopup.c b/app/widgets/gimptagpopup.c
index 79cf1d3..1b4e1c8 100644
--- a/app/widgets/gimptagpopup.c
+++ b/app/widgets/gimptagpopup.c
@@ -204,6 +204,9 @@ gimp_tag_popup_constructor (GType                  type,
   GObject               *object;
   GimpTagPopup          *popup;
   GimpFilteredContainer *container;
+  GtkWidget             *entry;
+  GtkAllocation          entry_allocation;
+  GtkStyle              *frame_style;
   gint                   x;
   gint                   y;
   gint                   width;
@@ -227,12 +230,15 @@ gimp_tag_popup_constructor (GType                  type,
                                                        construct_params);
   popup = GIMP_TAG_POPUP (object);
 
-  gtk_window_set_screen (GTK_WINDOW (popup),
-                         gtk_widget_get_screen (GTK_WIDGET (popup->combo_entry)));
+  entry = GTK_WIDGET (popup->combo_entry);
+
+  gtk_window_set_screen (GTK_WINDOW (popup), gtk_widget_get_screen (entry));
 
   popup->context = gtk_widget_create_pango_context (GTK_WIDGET (popup));
   popup->layout  = pango_layout_new (popup->context);
 
+  gtk_widget_get_allocation (entry, &entry_allocation);
+
   gtk_widget_style_get (GTK_WIDGET (popup),
                         "scroll-arrow-vlength", &popup->scroll_arrow_height,
                         NULL);
@@ -291,23 +297,25 @@ gimp_tag_popup_constructor (GType                  type,
                               popup);
     }
 
-  width  = (GTK_WIDGET (popup->combo_entry)->allocation.width -
-            2 * popup->frame->style->xthickness);
+  frame_style = gtk_widget_get_style (popup->frame);
+
+  width  = (entry_allocation.width -
+            2 * frame_style->xthickness);
   height = (gimp_tag_popup_layout_tags (popup, width) +
-            2 * popup->frame->style->ythickness);
+            2 * frame_style->ythickness);
 
-  gdk_window_get_origin (GTK_WIDGET (popup->combo_entry)->window, &x, &y);
+  gdk_window_get_origin (gtk_widget_get_window (entry), &x, &y);
 
-  max_height = GTK_WIDGET (popup->combo_entry)->allocation.height * 10;
+  max_height = entry_allocation.height * 10;
 
-  screen_height = gdk_screen_get_height (gtk_widget_get_screen (GTK_WIDGET (popup->combo_entry)));
+  screen_height = gdk_screen_get_height (gtk_widget_get_screen (entry));
 
   popup_height = MIN (height, max_height);
 
   popup_rects[0].x      = x;
   popup_rects[0].y      = 0;
-  popup_rects[0].width  = GTK_WIDGET (popup->combo_entry)->allocation.width;
-  popup_rects[0].height = y + GTK_WIDGET (popup->combo_entry)->allocation.height;
+  popup_rects[0].width  = entry_allocation.width;
+  popup_rects[0].height = y + entry_allocation.height;
 
   popup_rects[1].x      = x;
   popup_rects[1].y      = y;
@@ -330,14 +338,12 @@ gimp_tag_popup_constructor (GType                  type,
       if (popup_rects[0].height >= popup_rects[1].height)
         {
           popup_rect = popup_rects[0];
-          popup_rect.y += (popup->scroll_arrow_height +
-                           popup->frame->style->ythickness);
+          popup_rect.y += popup->scroll_arrow_height + frame_style->ythickness;
         }
       else
         {
           popup_rect = popup_rects[1];
-          popup_rect.y -= (popup->scroll_arrow_height +
-                           popup->frame->style->ythickness);
+          popup_rect.y -= popup->scroll_arrow_height + frame_style->ythickness;
         }
 
       popup_height = popup_rect.height;
@@ -648,6 +654,7 @@ gimp_tag_popup_border_event (GtkWidget *widget,
   if (event->type == GDK_BUTTON_PRESS)
     {
       GdkEventButton *button_event = (GdkEventButton *) event;
+      GtkAllocation   allocation;
       gint            x;
       gint            y;
 
@@ -657,13 +664,15 @@ gimp_tag_popup_border_event (GtkWidget *widget,
           return TRUE;
         }
 
+      gtk_widget_get_allocation (widget, &allocation);
+
       gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL);
 
       if (button_event->window != gtk_widget_get_window (popup->tag_area) &&
-          (x < widget->allocation.y                            ||
-           y < widget->allocation.x                            ||
-           x > widget->allocation.x + widget->allocation.width ||
-           y > widget->allocation.y + widget->allocation.height))
+          (x < allocation.y                    ||
+           y < allocation.x                    ||
+           x > allocation.x + allocation.width ||
+           y > allocation.y + allocation.height))
         {
           /* user has clicked outside the popup area,
            * which means it should be hidden.
@@ -682,7 +691,8 @@ gimp_tag_popup_border_event (GtkWidget *widget,
       gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL);
 
       gimp_tag_popup_handle_scrolling (popup, x, y,
-                                       motion_event->window == widget->window,
+                                       motion_event->window ==
+                                       gtk_widget_get_window (widget),
                                        TRUE);
     }
   else if (event->type == GDK_BUTTON_RELEASE)
@@ -1496,7 +1506,7 @@ get_arrows_visible_area (GimpTagPopup *popup,
                              &padding_top, &padding_bottom,
                              &padding_left, &padding_right);
 
-  *border = widget->allocation;
+  gtk_widget_get_allocation (widget, border);
 
   upper->x      = border->x + padding_left;
   upper->y      = border->y;
diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c
index f37862e..1a22157 100644
--- a/app/widgets/gimpview.c
+++ b/app/widgets/gimpview.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <string.h>
 
 #include <gtk/gtk.h>
@@ -377,7 +374,7 @@ gimp_view_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     gdk_window_move_resize (view->event_window,
                             allocation->x,
                             allocation->y,
@@ -432,7 +429,7 @@ gimp_view_button_press_event (GtkWidget      *widget,
       ! view->show_popup)
     return FALSE;
 
-  if (! GTK_WIDGET_REALIZED (widget))
+  if (! gtk_widget_get_realized (widget))
     return FALSE;
 
   if (bevent->type == GDK_BUTTON_PRESS)
@@ -780,19 +777,19 @@ static void
 gimp_view_update_callback (GimpViewRenderer *renderer,
                            GimpView         *view)
 {
-  GtkWidget *widget = GTK_WIDGET (view);
-  gint       width;
-  gint       height;
+  GtkWidget      *widget = GTK_WIDGET (view);
+  GtkRequisition  requisition;
+  gint            width;
+  gint            height;
+
+  gtk_widget_get_requisition (widget, &requisition);
 
   width  = renderer->width  + 2 * renderer->border_width;
   height = renderer->height + 2 * renderer->border_width;
 
-  if (width  != widget->requisition.width ||
-      height != widget->requisition.height)
+  if (width  != requisition.width ||
+      height != requisition.height)
     {
-      widget->requisition.width  = width;
-      widget->requisition.height = height;
-
       gtk_widget_queue_resize (widget);
     }
   else
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 757c029..9c995d0 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <string.h>
 
 #include <gtk/gtk.h>
@@ -139,7 +136,7 @@ gimp_button_menu_position (GtkWidget       *button,
   gint            monitor;
 
   g_return_if_fail (GTK_IS_WIDGET (button));
-  g_return_if_fail (GTK_WIDGET_REALIZED (button));
+  g_return_if_fail (gtk_widget_get_realized (button));
   g_return_if_fail (GTK_IS_MENU (menu));
   g_return_if_fail (x != NULL);
   g_return_if_fail (y != NULL);
@@ -820,12 +817,12 @@ gimp_window_get_native (GtkWindow *window)
 #endif
 
 #ifdef GDK_WINDOWING_WIN32
-  if (window && GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
     return (GdkNativeWindow) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (window)));
 #endif
 
 #ifdef GDK_WINDOWING_X11
-  if (window && GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
     return GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
 #endif
 
@@ -836,7 +833,7 @@ static void
 gimp_window_transient_realized (GtkWidget *window,
                                 GdkWindow *parent)
 {
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (window))
     gdk_window_set_transient_for (gtk_widget_get_window (window), parent);
 }
 
@@ -861,7 +858,7 @@ gimp_window_set_transient_for (GtkWindow *window,
   if (! parent)
     return;
 
-  if (GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (window)),
                                   parent);
 
diff --git a/libgimp/gimpprogressbar.c b/libgimp/gimpprogressbar.c
index 7736158..a12365b 100644
--- a/libgimp/gimpprogressbar.c
+++ b/libgimp/gimpprogressbar.c
@@ -21,9 +21,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #ifdef GDK_WINDOWING_WIN32
@@ -181,12 +178,12 @@ gimp_window_get_native (GtkWindow *window)
 #endif
 
 #ifdef GDK_WINDOWING_WIN32
-  if (window && GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
     return GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (window)));
 #endif
 
 #ifdef GDK_WINDOWING_X11
-  if (window && GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
     return GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
 #endif
 
diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c
index ed61886..ce81f04 100644
--- a/libgimp/gimpui.c
+++ b/libgimp/gimpui.c
@@ -18,9 +18,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpmodule/gimpmodule.h"
@@ -274,7 +271,7 @@ static void
 gimp_window_transient_realized (GtkWidget *window,
                                 GdkWindow *parent)
 {
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (window))
     gdk_window_set_transient_for (gtk_widget_get_window (window), parent);
 }
 
@@ -293,7 +290,7 @@ gimp_window_set_transient_for (GtkWindow *window,
   if (! parent)
     return;
 
-  if (GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (window)),
                                   parent);
 
diff --git a/libgimp/gimpzoompreview.c b/libgimp/gimpzoompreview.c
index 23448ea..5f285c6 100644
--- a/libgimp/gimpzoompreview.c
+++ b/libgimp/gimpzoompreview.c
@@ -21,9 +21,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpwidgets/gimpwidgets.h"
@@ -567,7 +564,7 @@ gimp_zoom_preview_draw_thumb (GimpPreview     *preview,
 static void
 gimp_zoom_preview_set_cursor (GimpPreview *preview)
 {
-  if (! GTK_WIDGET_REALIZED (preview->area))
+  if (! gtk_widget_get_realized (preview->area))
     return;
 
   if (gimp_zoom_preview_get_factor (GIMP_ZOOM_PREVIEW (preview)) > 1.0)
diff --git a/libgimpwidgets/gimpcolorscale.c b/libgimpwidgets/gimpcolorscale.c
index 207d06f..3e9e1e5 100644
--- a/libgimpwidgets/gimpcolorscale.c
+++ b/libgimpwidgets/gimpcolorscale.c
@@ -2,8 +2,8 @@
  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
  *
  * gimpcolorscale.c
- * Copyright (C) 2002  Sven Neumann <sven gimp org>
- *                     Michael Natterer <mitch gimp org>
+ * Copyright (C) 2002-2010  Sven Neumann <sven gimp org>
+ *                          Michael Natterer <mitch gimp org>
  *
  * This library is free software: you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,8 +24,6 @@
 
 #include <string.h>
 
-#undef GSEAL_ENABLE
-
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
@@ -78,7 +76,7 @@ gimp_color_scale_init (GimpColorScale *scale)
 {
   GtkRange *range = GTK_RANGE (scale);
 
-  range->slider_size_fixed = TRUE;
+  gtk_range_set_slider_size_fixed (range, TRUE);
   /* range->update_policy     = GTK_UPDATE_DELAYED; */
 
   gtk_range_set_flippable (GTK_RANGE (scale), TRUE);
@@ -118,6 +116,7 @@ gimp_color_scale_size_allocate (GtkWidget     *widget,
 {
   GimpColorScale *scale = GIMP_COLOR_SCALE (widget);
   GtkRange       *range = GTK_RANGE (widget);
+  GdkRectangle    range_rect;
   gint            focus = 0;
   gint            trough_border;
   gint            scale_width;
@@ -138,25 +137,28 @@ gimp_color_scale_size_allocate (GtkWidget     *widget,
       focus += focus_padding;
     }
 
-  range->min_slider_size = (MIN (allocation->width,
-                                 allocation->height) - 2 * focus) / 2;
+  gtk_range_set_min_slider_size (range,
+                                 (MIN (allocation->width,
+                                       allocation->height) - 2 * focus) / 2);
 
   if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
     GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
 
-  scale_width  = range->range_rect.width  - 2 * (focus + trough_border);
-  scale_height = range->range_rect.height - 2 * (focus + trough_border);
+  gtk_range_get_range_rect (range, &range_rect);
+
+  scale_width  = range_rect.width  - 2 * (focus + trough_border);
+  scale_height = range_rect.height - 2 * (focus + trough_border);
 
   switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)))
     {
     case GTK_ORIENTATION_HORIZONTAL:
-      scale_width  -= range->min_slider_size - 1;
+      scale_width  -= gtk_range_get_min_slider_size (range) - 1;
       scale_height -= 2;
       break;
 
     case GTK_ORIENTATION_VERTICAL:
       scale_width  -= 2;
-      scale_height -= range->min_slider_size - 1;
+      scale_height -= gtk_range_get_min_slider_size (range) - 1;
       break;
     }
 
@@ -243,10 +245,12 @@ gimp_color_scale_expose (GtkWidget      *widget,
   GtkStyle       *style  = gtk_widget_get_style (widget);
   GdkWindow      *window = gtk_widget_get_window (widget);
   GtkAllocation   allocation;
+  GdkRectangle    range_rect;
   GdkRectangle    expose_area;        /* Relative to widget->allocation */
   GdkRectangle    area;
   gint            focus = 0;
   gint            trough_border;
+  gint            slider_start;
   gint            slider_size;
   gint            x, y;
   gint            w, h;
@@ -254,18 +258,6 @@ gimp_color_scale_expose (GtkWidget      *widget,
   if (! scale->buf || ! gtk_widget_is_drawable (widget))
     return FALSE;
 
-  /* This is ugly as it relies heavily on GTK+ internals, but I see no
-   * other way to force the range to recalculate its layout. Might
-   * break if GtkRange internals change.
-   */
-  if (range->need_recalc)
-    {
-      GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
-      GTK_WIDGET_CLASS (parent_class)->size_allocate (widget,
-                                                      &widget->allocation);
-      GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-    }
-
   gtk_widget_style_get (widget,
                         "trough-border", &trough_border,
                         NULL);
@@ -283,18 +275,21 @@ gimp_color_scale_expose (GtkWidget      *widget,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  x = allocation.x + range->range_rect.x + focus;
-  y = allocation.y + range->range_rect.y + focus;
-  w = range->range_rect.width  - 2 * focus;
-  h = range->range_rect.height - 2 * focus;
+  gtk_range_get_range_rect (range, &range_rect);
+  gtk_range_get_slider_range (range, &slider_start, NULL);
+
+  x = allocation.x + range_rect.x + focus;
+  y = allocation.y + range_rect.y + focus;
+  w = range_rect.width  - 2 * focus;
+  h = range_rect.height - 2 * focus;
 
-  slider_size = range->min_slider_size / 2;
+  slider_size = gtk_range_get_min_slider_size (range) / 2;
 
   expose_area = event->area;
   expose_area.x -= allocation.x;
   expose_area.y -= allocation.y;
 
-  if (gdk_rectangle_intersect (&expose_area, &range->range_rect, &area))
+  if (gdk_rectangle_intersect (&expose_area, &range_rect, &area))
     {
       gboolean sensitive = gtk_widget_is_sensitive (widget);
 
@@ -354,15 +349,15 @@ gimp_color_scale_expose (GtkWidget      *widget,
   if (gtk_widget_has_focus (widget))
     gtk_paint_focus (style, window, gtk_widget_get_state (widget),
                      &area, widget, "trough",
-                     allocation.x + range->range_rect.x,
-                     allocation.y + range->range_rect.y,
-                     range->range_rect.width,
-                     range->range_rect.height);
+                     allocation.x + range_rect.x,
+                     allocation.y + range_rect.y,
+                     range_rect.width,
+                     range_rect.height);
 
   switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)))
     {
     case GTK_ORIENTATION_HORIZONTAL:
-      area.x      = allocation.x + range->slider_start;
+      area.x      = allocation.x + slider_start;
       area.y      = y + trough_border;
       area.width  = 2 * slider_size + 1;
       area.height = h - 2 * trough_border;
@@ -370,7 +365,7 @@ gimp_color_scale_expose (GtkWidget      *widget,
 
     case GTK_ORIENTATION_VERTICAL:
       area.x      = x + trough_border;
-      area.y      = allocation.y + range->slider_start;
+      area.y      = allocation.y + slider_start;
       area.width  = w - 2 * trough_border;
       area.height = 2 * slider_size + 1;
       break;
diff --git a/libgimpwidgets/gimppixmap.c b/libgimpwidgets/gimppixmap.c
index 07a793a..34408ef 100644
--- a/libgimpwidgets/gimppixmap.c
+++ b/libgimpwidgets/gimppixmap.c
@@ -93,7 +93,7 @@ gimp_pixmap_set (GimpPixmap  *pixmap,
   GTK_WIDGET (pixmap)->requisition.width  = 0;
   GTK_WIDGET (pixmap)->requisition.height = 0;
 
-  if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
+  if (! gtk_widget_get_realized (GTK_WIDGET (pixmap)))
     {
       if (xpm_data)
         {
diff --git a/libgimpwidgets/gimppreview.c b/libgimpwidgets/gimppreview.c
index dfc2045..c5bcea0 100644
--- a/libgimpwidgets/gimppreview.c
+++ b/libgimpwidgets/gimppreview.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpmath/gimpmath.h"
@@ -477,7 +474,7 @@ gimp_preview_invalidate_now (GimpPreview *preview)
 
   preview->timeout_id = 0;
 
-  if (toplevel && GTK_WIDGET_REALIZED (toplevel))
+  if (toplevel && gtk_widget_get_realized (toplevel))
     {
       gdk_window_set_cursor (gtk_widget_get_window (toplevel),
                              preview->cursor_busy);
@@ -502,7 +499,7 @@ gimp_preview_invalidate_now (GimpPreview *preview)
 static void
 gimp_preview_real_set_cursor (GimpPreview *preview)
 {
-  if (GTK_WIDGET_REALIZED (preview->area))
+  if (gtk_widget_get_realized (preview->area))
     gdk_window_set_cursor (gtk_widget_get_window (preview->area),
                            preview->default_cursor);
 }
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index d703c19..be5b356 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -20,9 +20,6 @@
 
 #include <string.h>
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
@@ -503,7 +500,7 @@ gimp_ruler_realize (GtkWidget *widget)
   GdkWindowAttr  attributes;
   gint           attributes_mask;
 
-  GTK_WIDGET_SET_FLAGS (ruler, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
 
   gtk_widget_get_allocation (widget, &allocation);
 
@@ -527,8 +524,7 @@ gimp_ruler_realize (GtkWidget *widget)
                                          &attributes, attributes_mask));
   gdk_window_set_user_data (gtk_widget_get_window (widget), ruler);
 
-  widget->style = gtk_style_attach (gtk_widget_get_style (widget),
-                                    gtk_widget_get_window (widget));
+  gtk_widget_style_attach (widget);
   gtk_style_set_background (gtk_widget_get_style (widget),
                             gtk_widget_get_window (widget),
                             GTK_STATE_ACTIVE);
@@ -571,7 +567,7 @@ gimp_ruler_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       gdk_window_move_resize (gtk_widget_get_window (widget),
                               allocation->x, allocation->y,
diff --git a/libgimpwidgets/gimpscrolledpreview.c b/libgimpwidgets/gimpscrolledpreview.c
index e81b398..4c5134e 100644
--- a/libgimpwidgets/gimpscrolledpreview.c
+++ b/libgimpwidgets/gimpscrolledpreview.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <gtk/gtk.h>
 
 #include "libgimpmath/gimpmath.h"
@@ -780,7 +777,7 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget           *widget,
 static void
 gimp_scrolled_preview_set_cursor (GimpPreview *preview)
 {
-  if (! GTK_WIDGET_REALIZED (preview->area))
+  if (! gtk_widget_get_realized (preview->area))
     return;
 
   if (preview->xmax - preview->xmin > preview->width  ||
diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c
index fb19533..803d5f7 100644
--- a/plug-ins/common/animation-play.c
+++ b/plug-ins/common/animation-play.c
@@ -35,9 +35,6 @@
 
 #include <string.h>
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
@@ -416,7 +413,7 @@ detach_callback (GtkToggleAction *action)
       gtk_window_set_screen (GTK_WINDOW (shape_window),
                              gtk_widget_get_screen (drawing_area));
 
-      if (GTK_WIDGET_REALIZED (drawing_area))
+      if (gtk_widget_get_realized (drawing_area))
         {
           gint x, y;
 
diff --git a/plug-ins/ifs-compose/ifs-compose.c b/plug-ins/ifs-compose/ifs-compose.c
index b1fdb43..03495dc 100644
--- a/plug-ins/ifs-compose/ifs-compose.c
+++ b/plug-ins/ifs-compose/ifs-compose.c
@@ -34,9 +34,6 @@
 
 #include <glib/gstdio.h>
 
-#undef GSEAL_ENABLE
-#undef GTK_DISABLE_DEPRECATED
-
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
@@ -2207,7 +2204,7 @@ design_op_update_callback (GtkRadioAction *action,
   ifsDesign->op = gtk_radio_action_get_current_value (action);
 
   /* cursor switch */
-  if (GTK_WIDGET_REALIZED (ifsDesign->area))
+  if (gtk_widget_get_realized (ifsDesign->area))
     design_area_realize (ifsDesign->area);
 }
 



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