[gnome-games] Use accessor functions for -DGSEAL_ENABLE. Final patch.



commit da14cdf0c479d91a1eaa0eeffa4bea6e870c0115
Author: Javier Jardón <jjardon gnome org>
Date:   Tue Apr 6 04:13:27 2010 +0200

    Use accessor functions for -DGSEAL_ENABLE. Final patch.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=586731

 aisleriot/ar-fullscreen-button.c       |    3 ++-
 aisleriot/board-noclutter.c            |   13 ++++++++-----
 gnomine/minefield.c                    |    4 ++--
 libgames-support/games-conf.c          |    2 +-
 libgames-support/games-gridframe.c     |    2 +-
 libgames-support/games-gtk-compat.h    |   12 ++++++------
 libgames-support/games-scores-dialog.c |    2 +-
 7 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/aisleriot/ar-fullscreen-button.c b/aisleriot/ar-fullscreen-button.c
index 05e47c4..a11a64b 100644
--- a/aisleriot/ar-fullscreen-button.c
+++ b/aisleriot/ar-fullscreen-button.c
@@ -21,6 +21,7 @@
 
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-glib-compat.h>
+#include <libgames-support/games-gtk-compat.h>
 
 struct _ArFullscreenButtonPrivate {
   GtkWindow *window;
@@ -107,7 +108,7 @@ update_position (ArFullscreenButton *button)
   screen = gtk_widget_get_screen (widget);
   gdk_screen_get_monitor_geometry
     (screen,
-     GTK_WIDGET_REALIZED (widget)
+     gtk_widget_get_realized (widget)
         ? gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget))
         : 0,
      &screen_rect);
diff --git a/aisleriot/board-noclutter.c b/aisleriot/board-noclutter.c
index eff01a3..077ef52 100644
--- a/aisleriot/board-noclutter.c
+++ b/aisleriot/board-noclutter.c
@@ -738,7 +738,7 @@ slot_update_geometry (AisleriotBoard *board,
     slot->rect.x -= slot->rect.width - priv->card_size.width;
   }
 
-  if (GTK_WIDGET_REALIZED (widget)) {
+  if (gtk_widget_get_realized (widget)) {
     GdkRectangle damage = slot->rect;
 
     if (old_rect.width > 0 && old_rect.height > 0) {
@@ -848,7 +848,7 @@ aisleriot_board_setup_geometry (AisleriotBoard *board)
   if (aisleriot_game_get_state (priv->game) <= GAME_LOADED)
     return;
 
-  g_return_if_fail (GTK_WIDGET_REALIZED (widget));
+  g_return_if_fail (gtk_widget_get_realized (widget));
   g_return_if_fail (priv->width > 0 && priv->height > 0);
 
   priv->xslotstep = ((double) priv->allocation.width) / priv->width;
@@ -2431,6 +2431,7 @@ aisleriot_board_sync_style (ArStyle *style,
   GtkWidget *widget = GTK_WIDGET (board);
   const char *pspec_name;
   gboolean update_geometry = FALSE, redraw_focus = FALSE, queue_redraw = FALSE, redraw_selection = FALSE;
+  gboolean realized;
 
   g_assert (style == priv->style);
 
@@ -2564,11 +2565,13 @@ aisleriot_board_sync_style (ArStyle *style,
   }
 #endif /* !HAVE_HILDON */
 
-  if (update_geometry && GTK_WIDGET_REALIZED (widget)) {
+  realized = gtk_widget_get_realized (widget);
+
+  if (update_geometry && realized) {
     aisleriot_board_setup_geometry (board);
   }
 
-  if (queue_redraw && GTK_WIDGET_REALIZED (widget)) {
+  if (queue_redraw && realized) {
     gtk_widget_queue_draw (widget);
   }
 
@@ -2603,7 +2606,7 @@ aisleriot_board_size_allocate (GtkWidget *widget,
   priv->allocation.width = allocation->width;
   priv->allocation.height = allocation->height;
 
-  if (GTK_WIDGET_REALIZED (widget)) {
+  if (gtk_widget_get_realized (widget)) {
     aisleriot_board_setup_geometry (board);
   }
 }
diff --git a/gnomine/minefield.c b/gnomine/minefield.c
index dd59fc3..f2ca8e0 100644
--- a/gnomine/minefield.c
+++ b/gnomine/minefield.c
@@ -339,7 +339,7 @@ gtk_minefield_realize (GtkWidget * widget)
   g_return_if_fail (GTK_IS_MINEFIELD (widget));
 
   mfield = GTK_MINEFIELD (widget);
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
 
   gtk_widget_get_allocation (widget, &allocation);
 
@@ -392,7 +392,7 @@ gtk_minefield_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
 
   mfield = GTK_MINEFIELD (widget);
 
-  if (GTK_WIDGET_REALIZED (widget)) {
+  if (gtk_widget_get_realized (widget)) {
     minesizepixels = MIN (allocation->width / mfield->xsize,
 		    allocation->height / mfield->ysize);
     mfield->minesizepixels = minesizepixels;
diff --git a/libgames-support/games-conf.c b/libgames-support/games-conf.c
index aa367ed..a9c06e8 100644
--- a/libgames-support/games-conf.c
+++ b/libgames-support/games-conf.c
@@ -1288,7 +1288,7 @@ games_conf_add_window (GtkWindow *window,
   gboolean maximised, fullscreen;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (!GTK_WIDGET_REALIZED (window));
+  g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
 
   state = g_slice_new0 (WindowState);
 
diff --git a/libgames-support/games-gridframe.c b/libgames-support/games-gridframe.c
index 3e4363f..a4fed75 100644
--- a/libgames-support/games-gridframe.c
+++ b/libgames-support/games-gridframe.c
@@ -191,7 +191,7 @@ games_grid_frame_size_allocate (GtkWidget * widget,
     (allocation->height - child_allocation.height) * frame->yalign +
     allocation->y;
 
-  if (GTK_WIDGET_MAPPED (widget) &&
+  if (gtk_widget_get_mapped (widget) &&
       (child_allocation.x != frame->old_allocation.x ||
        child_allocation.y != frame->old_allocation.y ||
        child_allocation.width != frame->old_allocation.width ||
diff --git a/libgames-support/games-gtk-compat.h b/libgames-support/games-gtk-compat.h
index d70a6c5..8f07697 100644
--- a/libgames-support/games-gtk-compat.h
+++ b/libgames-support/games-gtk-compat.h
@@ -21,11 +21,11 @@
 
 G_BEGIN_DECLS
 
-#ifdef GSEAL_ENABLE
-/* Temporary fix from http://live.gnome.org/GnomeGoals/UseGseal */
-#undef GTK_OBJECT_FLAGS
-#define GTK_OBJECT_FLAGS(i) (GTK_OBJECT (i)->GSEAL(flags))
-#endif /* GSEAL_ENABLE */
+#if !GTK_CHECK_VERSION (2, 20, 0)
+#define gtk_widget_get_realized(widget)                 GTK_WIDGET_REALIZED(widget)
+#define gtk_widget_set_realized(w,realized)             ((realized) ? (GTK_WIDGET_SET_FLAGS (w, GTK_REALIZED)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_REALIZED)))
+#define gtk_widget_get_mapped(widget)                   GTK_WIDGET_MAPPED(widget)
+#endif /* GTK < 2.20.0 */
 
 #if !GTK_CHECK_VERSION (2, 18, 0)
 #define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation=*(alloc))
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 #define gtk_widget_get_state(widget) ((widget)->state)
 #define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
 #define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE (widget))
-#define gtk_widget_set_can_focus(widget, can_focus) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS)
+#define gtk_widget_set_can_focus(w,can_focus)           ((can_focus) ? (GTK_WIDGET_SET_FLAGS (w, GTK_CAN_FOCUS)) : (GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS)))
 #endif /* GTK < 2.18.0 */
 
 #if !GTK_CHECK_VERSION (2, 14, 0)
diff --git a/libgames-support/games-scores-dialog.c b/libgames-support/games-scores-dialog.c
index 3209090..ffa6f6f 100644
--- a/libgames-support/games-scores-dialog.c
+++ b/libgames-support/games-scores-dialog.c
@@ -210,7 +210,7 @@ static gboolean games_scores_dialog_set_edit (GamesScoresDialog *self)
   GtkTreeSelection *selection;
 
   /* Just in case we've been closed as soon as we're created. */
-  if (!GTK_WIDGET_REALIZED (self))
+  if (!gtk_widget_get_realized (GTK_WIDGET (self)))
     return FALSE;
 
   /* Temporarily disable the code that prevents editing when the



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