[gucharmap] Compile with -DGSEAL_ENABLE. Fixes bug 612487.



commit d994ff0d2aaa539151e3e0aa32377280da7038db
Author: Andre Klapper <a9016009 gmx de>
Date:   Fri Apr 16 18:37:20 2010 +0200

    Compile with -DGSEAL_ENABLE. Fixes bug 612487.

 configure.ac                               |    2 +-
 gucharmap/gucharmap-charmap.c              |   12 ++-
 gucharmap/gucharmap-chartable-accessible.c |   58 ++++++++++
 gucharmap/gucharmap-chartable.c            |  165 ++++++++++++++++++++++------
 gucharmap/gucharmap-mini-fontsel.c         |    4 +-
 gucharmap/gucharmap-search-dialog.c        |   26 +++-
 gucharmap/gucharmap-settings.c             |    4 +
 gucharmap/gucharmap-window.c               |   17 +++-
 8 files changed, 240 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8cbd3aa..4591234 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,7 @@ fi
 AM_CONDITIONAL(OS_WIN32, test "x$os_win32" = "xyes")
 
 GLIB_REQUIRED=2.16.3
-GTK_REQUIRED=2.13.6
+GTK_REQUIRED=2.14.0
 PKG_CHECK_MODULES([GTK],[glib-2.0 >= $GLIB_REQUIRED gtk+-2.0 >= $GTK_REQUIRED])
 
 GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
diff --git a/gucharmap/gucharmap-charmap.c b/gucharmap/gucharmap-charmap.c
index f116476..033a313 100644
--- a/gucharmap/gucharmap-charmap.c
+++ b/gucharmap/gucharmap-charmap.c
@@ -1049,7 +1049,7 @@ details_motion_notify_event (GtkWidget *text_view,
 
   set_cursor_if_appropriate (charmap, x, y);
 
-  gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
+  gdk_window_get_pointer (gtk_widget_get_window (text_view), NULL, NULL, NULL);
   return FALSE;
 }
 
@@ -1060,7 +1060,7 @@ details_visibility_notify_event (GtkWidget *text_view,
 {
   gint wx, wy, bx, by;
 
-  gdk_window_get_pointer (text_view->window, &wx, &wy, NULL);
+  gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL);
 
   gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), 
                                          GTK_TEXT_WINDOW_WIDGET,
@@ -1482,7 +1482,11 @@ gucharmap_charmap_get_chapters_visible (GucharmapCharmap *charmap)
 {
   GucharmapCharmapPrivate *priv = charmap->priv;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  return gtk_widget_get_visible (GTK_WIDGET (priv->chapters_view));
+#else
   return GTK_WIDGET_VISIBLE (priv->chapters_view);
+#endif
 }
 
 void
@@ -1511,7 +1515,11 @@ gucharmap_charmap_get_page_visible (GucharmapCharmap *charmap,
   if (!page_widget)
     return FALSE;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  return gtk_widget_get_visible (page_widget);
+#else
   return GTK_WIDGET_VISIBLE (page_widget);
+#endif
 }
 
 void
diff --git a/gucharmap/gucharmap-chartable-accessible.c b/gucharmap/gucharmap-chartable-accessible.c
index 7a24726..4a9c166 100644
--- a/gucharmap/gucharmap-chartable-accessible.c
+++ b/gucharmap/gucharmap-chartable-accessible.c
@@ -105,7 +105,11 @@ gucharmap_chartable_accessible_ref_child (AtkObject *obj,
   GPtrArray *cells;
   guint n_cells, n;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+#else
   widget = GTK_ACCESSIBLE (obj)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -159,7 +163,11 @@ gucharmap_chartable_accessible_ref_at (AtkTable *table,
   AtkObject *child;
   gint index;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -186,7 +194,11 @@ gucharmap_chartable_accessible_ref_accessible_at_point (AtkComponent *component,
   gint x_pos, y_pos;
   gint row, col;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
+#else
   widget = GTK_ACCESSIBLE (component)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -244,7 +256,11 @@ gucharmap_chartable_accessible_ref_state_set (AtkObject *obj)
   GtkWidget *widget;
 
   state_set = ATK_OBJECT_CLASS (gucharmap_chartable_accessible_parent_class)->ref_state_set (obj);
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+#else
   widget = GTK_ACCESSIBLE (obj)->widget;
+#endif
 
   if (widget != NULL)
     atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS);
@@ -259,7 +275,11 @@ gucharmap_chartable_accessible_get_n_children (AtkObject *obj)
 {
   GtkWidget *widget;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+#else
   widget = GTK_ACCESSIBLE (obj)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -313,7 +333,11 @@ gucharmap_chartable_accessible_update_all_cells (AtkObject *obj)
   GPtrArray *cells;
   guint n_cells, n;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+#else
   widget = GTK_ACCESSIBLE (obj)->widget;
+#endif
   if (!widget)
     /* Widget is being deleted */
     return;
@@ -498,9 +522,15 @@ gucharmap_chartable_accessible_destroyed (GtkWidget *widget,
 static void
 gucharmap_chartable_accessible_connect_widget_destroyed (GtkAccessible *accessible)
 {
+#if GTK_CHECK_VERSION(2,21,0)
+  if (gtk_accessible_get_widget (accessible))
+    {
+      g_signal_connect_after (gtk_accessible_get_widget (accessible),
+#else
   if (accessible->widget)
     {
       g_signal_connect_after (accessible->widget,
+#endif
                               "destroy",
                               G_CALLBACK (gucharmap_chartable_accessible_destroyed),
                               accessible);
@@ -537,7 +567,11 @@ gucharmap_chartable_accessible_get_n_columns (AtkTable *table)
   GucharmapChartable *chartable;
   GucharmapChartablePrivate *chartable_priv;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -556,7 +590,11 @@ gucharmap_chartable_accessible_get_column_extent_at (AtkTable       *table,
 {
   GtkWidget *widget;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -573,7 +611,11 @@ gucharmap_chartable_accessible_get_n_rows (AtkTable *table)
   GucharmapChartablePrivate *chartable_priv;
   gint n_rows;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -594,7 +636,11 @@ gucharmap_chartable_accessible_get_row_extent_at (AtkTable *table,
 {
   GtkWidget *widget;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -612,7 +658,11 @@ gucharmap_chartable_accessible_get_index_at (AtkTable *table,
   GucharmapChartable *chartable;
   GucharmapChartablePrivate *chartable_priv;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return -1;
@@ -632,7 +682,11 @@ gucharmap_chartable_accessible_get_column_at_index (AtkTable *table,
   GucharmapChartable *chartable;
   GucharmapChartablePrivate *chartable_priv;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return -1;
@@ -652,7 +706,11 @@ gucharmap_chartable_accessible_get_row_at_index (AtkTable *table,
   GucharmapChartable *chartable;
   GucharmapChartablePrivate *chartable_priv;
 
+#if GTK_CHECK_VERSION(2,21,0)
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table));
+#else
   widget = GTK_ACCESSIBLE (table)->widget;
+#endif
   if (widget == NULL)
     /* State is defunct */
     return -1;
diff --git a/gucharmap/gucharmap-chartable.c b/gucharmap/gucharmap-chartable.c
index 88ff112..6994da3 100644
--- a/gucharmap/gucharmap-chartable.c
+++ b/gucharmap/gucharmap-chartable.c
@@ -263,7 +263,7 @@ position_rectangle_on_screen (GtkWidget *widget,
   
   direction = gtk_widget_get_direction (widget);
   screen = gtk_widget_get_screen (widget);
-  monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+  monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
   if (monitor_num < 0)
     monitor_num = 0;
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
@@ -286,7 +286,7 @@ get_root_coords_at_active_char (GucharmapChartable *chartable,
   gint x, y;
   gint row, col;
 
-  gdk_window_get_origin (widget->window, &x, &y);
+  gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
 
   row = (priv->active_cell - priv->page_first_cell) / priv->cols;
   col = _gucharmap_chartable_cell_column (chartable, priv->active_cell);
@@ -568,7 +568,7 @@ create_glyph_pixmap (GucharmapChartable *chartable,
 
   style = gtk_widget_get_style (widget);
 
-  pixmap = gdk_pixmap_new (widget->window,
+  pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
                            pixmap_width, pixmap_height, -1);
 
   gdk_draw_rectangle (pixmap, style->base_gc[GTK_STATE_NORMAL],
@@ -733,7 +733,7 @@ destroy_zoom_window (GucharmapChartable *chartable)
       priv->zoom_window = NULL;
       priv->zoom_image = NULL;
 
-      gdk_window_set_cursor (widget->window, NULL);
+      gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
       gtk_widget_destroy (zoom_window);
     }
 }
@@ -833,33 +833,59 @@ draw_borders (GucharmapChartable *chartable)
 {
   GucharmapChartablePrivate *priv = chartable->priv;
   GtkWidget *widget = GTK_WIDGET (chartable);
+#if GTK_CHECK_VERSION (2,18,0)
+  GtkAllocation allocation;
+#endif
+  GtkStyle *style;
   gint x, y, col, row;
 
   /* dark_gc[GTK_STATE_NORMAL] seems to be what is used to draw the borders
    * around widgets, so we use it for the lines */
 
+  style = gtk_widget_get_style (widget);
+
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_get_allocation (widget, &allocation);
+#endif
+
   /* vertical lines */
   gdk_draw_line (priv->pixmap,
-                 widget->style->dark_gc[GTK_STATE_NORMAL],
+                 style->dark_gc[GTK_STATE_NORMAL],
+#if GTK_CHECK_VERSION (2,18,0)
+                 0, 0, 0, allocation.height - 1);
+#else
                  0, 0, 0, widget->allocation.height - 1);
+#endif
   for (col = 0, x = 0;  col < priv->cols;  col++)
     {
       x += _gucharmap_chartable_column_width (chartable, col);
       gdk_draw_line (priv->pixmap,
-                     widget->style->dark_gc[GTK_STATE_NORMAL],
+                     style->dark_gc[GTK_STATE_NORMAL],
+#if GTK_CHECK_VERSION (2,18,0)
+                     x, 0, x, allocation.height - 1);
+#else
                      x, 0, x, widget->allocation.height - 1);
+#endif
     }
 
   /* horizontal lines */
   gdk_draw_line (priv->pixmap,
-                 widget->style->dark_gc[GTK_STATE_NORMAL],
+                 style->dark_gc[GTK_STATE_NORMAL],
+#if GTK_CHECK_VERSION (2,18,0)
+                 0, 0, allocation.width - 1, 0);
+#else
                  0, 0, widget->allocation.width - 1, 0);
+#endif
   for (row = 0, y = 0;  row < priv->rows;  row++)
     {
       y += _gucharmap_chartable_row_height (chartable, row);
       gdk_draw_line (priv->pixmap,
-                     widget->style->dark_gc[GTK_STATE_NORMAL],
+                     style->dark_gc[GTK_STATE_NORMAL],
+#if GTK_CHECK_VERSION (2,18,0)
+                     0, y, allocation.width - 1, y);
+#else
                      0, y, widget->allocation.width - 1, y);
+#endif
     }
 }
 
@@ -917,6 +943,7 @@ draw_character (GucharmapChartable *chartable,
   gunichar wc;
   guint cell;
   GdkGC *gc;
+  GtkStyle *style;
   gchar buf[10];
   gint n;
 
@@ -926,12 +953,18 @@ draw_character (GucharmapChartable *chartable,
   if (wc > UNICHAR_MAX || !gucharmap_unichar_validate (wc) || !gucharmap_unichar_isdefined (wc))
     return;
 
+  style = gtk_widget_get_style (widget);
+
+#if GTK_CHECK_VERSION (2,18,0)
+  if (gtk_widget_has_focus (widget) && (gint)cell == priv->active_cell)
+#else
   if (GTK_WIDGET_HAS_FOCUS (widget) && (gint)cell == priv->active_cell)
-    gc = widget->style->text_gc[GTK_STATE_SELECTED];
+#endif
+    gc = style->text_gc[GTK_STATE_SELECTED];
   else if ((gint)cell == priv->active_cell)
-    gc = widget->style->text_gc[GTK_STATE_ACTIVE];
+    gc = style->text_gc[GTK_STATE_ACTIVE];
   else
-    gc = widget->style->text_gc[GTK_STATE_NORMAL];
+    gc = style->text_gc[GTK_STATE_NORMAL];
 
   square_width = _gucharmap_chartable_column_width (chartable, col) - 1;
   square_height = _gucharmap_chartable_row_height (chartable, row) - 1;
@@ -959,26 +992,33 @@ draw_square_bg (GucharmapChartable *chartable, gint row, gint col)
   gint square_width, square_height; 
   GdkGC *gc;
   GdkColor untinted;
+  GtkStyle *style;
   guint cell;
   gunichar wc;
 
   cell = get_cell_at_rowcol (chartable, row, col);
   wc = gucharmap_codepoint_list_get_char (priv->codepoint_list, cell);
 
-  gc = gdk_gc_new (GDK_DRAWABLE (widget->window));
+  gc = gdk_gc_new (GDK_DRAWABLE (gtk_widget_get_window (widget)));
 
+  style = gtk_widget_get_style (widget);
+
+#if GTK_CHECK_VERSION (2,18,0)
+  if (gtk_widget_has_focus (widget) && (gint)cell == priv->active_cell)
+#else
   if (GTK_WIDGET_HAS_FOCUS (widget) && (gint)cell == priv->active_cell)
-    untinted = widget->style->base[GTK_STATE_SELECTED];
+#endif
+    untinted = style->base[GTK_STATE_SELECTED];
   else if ((gint)cell == priv->active_cell)
-    untinted = widget->style->base[GTK_STATE_ACTIVE];
+    untinted = style->base[GTK_STATE_ACTIVE];
   else if ((gint)cell > priv->last_cell)
-    untinted = widget->style->dark[GTK_STATE_NORMAL];
+    untinted = style->dark[GTK_STATE_NORMAL];
   else if (! gucharmap_unichar_validate (wc))
-    untinted = widget->style->fg[GTK_STATE_INSENSITIVE];
+    untinted = style->fg[GTK_STATE_INSENSITIVE];
   else if (! gucharmap_unichar_isdefined (wc))
-    untinted = widget->style->bg[GTK_STATE_INSENSITIVE];
+    untinted = style->bg[GTK_STATE_INSENSITIVE];
   else
-    untinted = widget->style->base[GTK_STATE_NORMAL];
+    untinted = style->base[GTK_STATE_NORMAL];
 
   gdk_gc_set_rgb_fg_color (gc, &untinted);
 
@@ -1034,18 +1074,34 @@ draw_chartable_from_scratch (GucharmapChartable *chartable)
 {
   GucharmapChartablePrivate *priv = chartable->priv;
   GtkWidget *widget = GTK_WIDGET (chartable);
+#if GTK_CHECK_VERSION (2,18,0)
+  GtkAllocation allocation;
+#endif
   gint row, col;
 
   /* drawing area may not be exposed yet when restoring last char setting
    */
+#if GTK_CHECK_VERSION (2,20,0)
+  if (!gtk_widget_get_realized (GTK_WIDGET (chartable)))
+#else
   if (!GTK_WIDGET_REALIZED (chartable))
+#endif
     return;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_get_allocation (widget, &allocation);
+#endif
+
   if (priv->pixmap == NULL)
     priv->pixmap = gdk_pixmap_new (
-	    widget->window, 
-	    widget->allocation.width,
-	    widget->allocation.height, -1);
+	    gtk_widget_get_window (widget),
+#if GTK_CHECK_VERSION (2,18,0)
+	    allocation.width,
+	    allocation.height, -1);
+#else
+            widget->allocation.width,
+            widget->allocation.height, -1);
+#endif
 
   draw_borders (chartable);
 
@@ -1063,9 +1119,16 @@ copy_rows (GucharmapChartable *chartable, gint row_offset)
 {
   GucharmapChartablePrivate *priv = chartable->priv;
   GtkWidget *widget = GTK_WIDGET (chartable);
+#if GTK_CHECK_VERSION (2,18,0)
+  GtkAllocation allocation;
+#endif
   gint num_padded_rows = priv->n_padded_rows;
   gint from_row, to_row;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_get_allocation (widget, &allocation);
+#endif
+
   if (ABS (row_offset) < priv->rows - num_padded_rows)
     {
       gint num_rows, height;
@@ -1088,11 +1151,15 @@ copy_rows (GucharmapChartable *chartable, gint row_offset)
 
       gdk_draw_drawable (
               priv->pixmap,
-              widget->style->base_gc[GTK_STATE_NORMAL],
+              (gtk_widget_get_style (widget))->base_gc[GTK_STATE_NORMAL],
               priv->pixmap,
               0, _gucharmap_chartable_y_offset (chartable, from_row), 
               0, _gucharmap_chartable_y_offset (chartable, to_row),
+#if GTK_CHECK_VERSION (2,18,0)
+              allocation.width, height);
+#else
               widget->allocation.width, height);
+#endif
     }
 
   if (ABS (row_offset) < num_padded_rows)
@@ -1112,12 +1179,17 @@ copy_rows (GucharmapChartable *chartable, gint row_offset)
       /* it's ok to go off the end (so use allocation.height) */
       gdk_draw_drawable (
               priv->pixmap,
-              widget->style->base_gc[GTK_STATE_NORMAL],
+              (gtk_widget_get_style (widget))->base_gc[GTK_STATE_NORMAL],
               priv->pixmap,
               0, _gucharmap_chartable_y_offset (chartable, from_row), 
               0, _gucharmap_chartable_y_offset (chartable, to_row),
+#if GTK_CHECK_VERSION (2,18,0)
+              allocation.width,
+              allocation.height);
+#else
               widget->allocation.width, 
               widget->allocation.height);
+#endif
     }
 }
 
@@ -1236,12 +1308,12 @@ update_scrollbar_adjustment (GucharmapChartable *chartable)
   if (!vadjustment)
     return;
 
-  vadjustment->value = 1.0 * priv->page_first_cell / priv->cols;
-  vadjustment->lower = 0.0;
-  vadjustment->upper = 1.0 * ( priv->last_cell / priv->cols + 1 );
-  vadjustment->step_increment = 3.0;
-  vadjustment->page_increment = 1.0 * priv->rows;
-  vadjustment->page_size = priv->rows; /* FIXMEchpe + 1 maybe? so scroll-wheel up/down scroll exactly half a page? */
+  gtk_adjustment_set_value (vadjustment, 1.0 * priv->page_first_cell / priv->cols);
+  gtk_adjustment_set_lower (vadjustment, 0.0);
+  gtk_adjustment_set_upper (vadjustment, 1.0 * ( priv->last_cell / priv->cols + 1 ));
+  gtk_adjustment_set_step_increment (vadjustment, 3.0);
+  gtk_adjustment_set_page_increment (vadjustment, 1.0 * priv->rows);
+  gtk_adjustment_set_page_size (vadjustment, priv->rows); /* FIXMEchpe + 1 maybe? so scroll-wheel up/down scroll exactly half a page? */
 
   gtk_adjustment_changed (vadjustment);
 }
@@ -1385,7 +1457,7 @@ gucharmap_chartable_drag_data_received (GtkWidget *widget,
   gchar *text;
   gunichar wc;
 
-  if (selection_data->length <= 0 || selection_data->data == NULL)
+  if (gtk_selection_data_get_length (selection_data) <= 0 || gtk_selection_data_get_data (selection_data) == NULL)
     return;
 
   text = (gchar *) gtk_selection_data_get_text (selection_data);
@@ -1448,9 +1520,9 @@ gucharmap_chartable_expose_event (GtkWidget *widget,
   }
 #endif
 
-  gc = widget->style->fg_gc[GTK_STATE_NORMAL];
+  gc = (gtk_widget_get_style (widget))->fg_gc[GTK_STATE_NORMAL];
   for (i = 0; i < n_rects; ++i) {
-    gdk_draw_drawable (widget->window,
+    gdk_draw_drawable (gtk_widget_get_window (widget),
                        gc,
                        priv->pixmap,
                        rects[i].x, rects[i].y,
@@ -1589,7 +1661,7 @@ gucharmap_chartable_realize (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (gucharmap_chartable_parent_class)->realize (widget);
 
-  gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
+  gdk_window_set_back_pixmap (gtk_widget_get_window (widget), NULL, FALSE);
     
   if (priv->pixmap != NULL)
     {
@@ -1606,6 +1678,9 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
 {
   GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
   GucharmapChartablePrivate *priv = chartable->priv;
+#if GTK_CHECK_VERSION (2,18,0)
+  GtkAllocation widget_allocation;
+#endif
   int old_rows, old_cols;
   int total_extra_pixels;
   int new_first_cell;
@@ -1638,6 +1713,19 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
 
   priv->page_size = priv->rows * priv->cols;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_get_allocation (widget, &widget_allocation);
+#endif
+
+#if GTK_CHECK_VERSION (2,18,0)
+  total_extra_pixels = widget_allocation.width - (priv->cols * bare_minimal_column_width + 1);
+  priv->minimal_column_width = bare_minimal_column_width + total_extra_pixels / priv->cols;
+  priv->n_padded_columns = widget_allocation.width - (priv->minimal_column_width * priv->cols + 1);
+
+  total_extra_pixels = widget_allocation.height - (priv->rows * bare_minimal_row_height + 1);
+  priv->minimal_row_height = bare_minimal_row_height + total_extra_pixels / priv->rows;
+  priv->n_padded_rows = widget_allocation.height - (priv->minimal_row_height * priv->rows + 1);
+#else
   total_extra_pixels = widget->allocation.width - (priv->cols * bare_minimal_column_width + 1);
   priv->minimal_column_width = bare_minimal_column_width + total_extra_pixels / priv->cols;
   priv->n_padded_columns = widget->allocation.width - (priv->minimal_column_width * priv->cols + 1);
@@ -1645,6 +1733,7 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
   total_extra_pixels = widget->allocation.height - (priv->rows * bare_minimal_row_height + 1);
   priv->minimal_row_height = bare_minimal_row_height + total_extra_pixels / priv->rows;
   priv->n_padded_rows = widget->allocation.height - (priv->minimal_row_height * priv->rows + 1);
+#endif
 
   /* force pixmap to be redrawn on next expose event */
   if (priv->pixmap != NULL)
@@ -1702,7 +1791,7 @@ gucharmap_chartable_style_set (GtkWidget *widget,
   if (priv->font_desc == NULL) {
     PangoFontDescription *font_desc;
 
-    font_desc = pango_font_description_copy (widget->style->font_desc);
+    font_desc = pango_font_description_copy ((gtk_widget_get_style (widget))->font_desc);
 
     /* Use twice the size of the style's font */
     if (pango_font_description_get_size_is_absolute (font_desc))
@@ -1976,7 +2065,11 @@ gucharmap_chartable_paste_clipboard (GucharmapChartable *chartable)
   GtkClipboard *clipboard;
   gpointer *data;
 
+#if GTK_CHECK_VERSION (2,20,0)
+  if (!gtk_widget_get_realized (GTK_WIDGET (chartable)))
+#else
   if (!GTK_WIDGET_REALIZED (chartable))
+#endif
     return;
 
   data = g_slice_new (gpointer);
@@ -2025,7 +2118,11 @@ gucharmap_chartable_init (GucharmapChartable *chartable)
   gtk_drag_dest_add_text_targets (widget);
 
   /* this is required to get key_press events */
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_set_can_focus (widget, TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+#endif
 
   gucharmap_chartable_set_codepoint_list (chartable, NULL);
 
diff --git a/gucharmap/gucharmap-mini-fontsel.c b/gucharmap/gucharmap-mini-fontsel.c
index 52e247b..c2dfc56 100644
--- a/gucharmap/gucharmap-mini-fontsel.c
+++ b/gucharmap/gucharmap-mini-fontsel.c
@@ -270,7 +270,7 @@ gucharmap_mini_font_selection_init (GucharmapMiniFontSelection *fontsel)
   AtkObject *accessib;
 
   gtk_widget_ensure_style (GTK_WIDGET (fontsel));
-  fontsel->font_desc = pango_font_description_copy (GTK_WIDGET (fontsel)->style->font_desc);
+  fontsel->font_desc = pango_font_description_copy ((gtk_widget_get_style (GTK_WIDGET (fontsel)))->font_desc);
   fontsel->default_size = -1;
 
   fontsel->size_adj = gtk_adjustment_new (MIN_FONT_SIZE, 
@@ -418,5 +418,5 @@ gucharmap_mini_font_selection_reset_font_size (GucharmapMiniFontSelection *fonts
   if (fontsel->default_size > 0)
     set_font_size (fontsel, fontsel->default_size);
   else
-    set_font_size (fontsel, pango_font_description_get_size (GTK_WIDGET (fontsel)->style->font_desc) * 2.0f / PANGO_SCALE);
+    set_font_size (fontsel, pango_font_description_get_size ((gtk_widget_get_style (GTK_WIDGET (fontsel)))->font_desc) * 2.0f / PANGO_SCALE);
 }
diff --git a/gucharmap/gucharmap-search-dialog.c b/gucharmap/gucharmap-search-dialog.c
index cf650e9..e37f743 100644
--- a/gucharmap/gucharmap-search-dialog.c
+++ b/gucharmap/gucharmap-search-dialog.c
@@ -555,7 +555,11 @@ information_dialog (GucharmapSearchDialog *search_dialog,
   GucharmapSearchDialogPrivate *priv = GUCHARMAP_SEARCH_DIALOG_GET_PRIVATE (search_dialog);
   GtkWidget *dialog;
 
+#if GTK_CHECK_VERSION (2,18,0)
+  dialog = gtk_message_dialog_new (gtk_widget_get_visible (GTK_WIDGET (search_dialog)) ?
+#else
   dialog = gtk_message_dialog_new (GTK_WIDGET_VISIBLE (search_dialog) ?
+#endif
                                      GTK_WINDOW (search_dialog) :
                                      GTK_WINDOW (priv->guw),
                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -587,7 +591,7 @@ search_completed (GucharmapSearchDialog *search_dialog)
       gtk_widget_set_sensitive (priv->next_button, FALSE);
     }
 
-  gdk_window_set_cursor (GTK_WIDGET (search_dialog)->window, NULL);
+  gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (search_dialog)), NULL);
 }
 
 static gboolean
@@ -616,7 +620,7 @@ _gucharmap_search_dialog_fire_search (GucharmapSearchDialog *search_dialog,
     return;
 
   GdkCursor *cursor = _gucharmap_window_progress_cursor ();
-  gdk_window_set_cursor (GTK_WIDGET (search_dialog)->window, cursor);
+  gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (search_dialog)), cursor);
   gdk_cursor_unref (cursor);
 
   list = gucharmap_charmap_get_book_codepoint_list (priv->guw->charmap);
@@ -730,7 +734,7 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
   gtk_container_set_border_width (GTK_CONTAINER (search_dialog), 6);
   gtk_dialog_set_has_separator (GTK_DIALOG (search_dialog), FALSE);
   gtk_window_set_destroy_with_parent (GTK_WINDOW (search_dialog), TRUE);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (search_dialog)->vbox), 12);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (search_dialog))), 12);
   gtk_window_set_resizable (GTK_WINDOW (search_dialog), FALSE);
 
   g_signal_connect (search_dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
@@ -739,13 +743,21 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
   gtk_dialog_add_button (GTK_DIALOG (search_dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
 
   priv->prev_button = gtk_button_new ();
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_set_can_default (priv->prev_button, TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (priv->prev_button, GTK_CAN_DEFAULT);
+#endif
   set_button_stock_image_and_label (GTK_BUTTON (priv->prev_button), GTK_STOCK_GO_BACK, _("_Previous"));
   gtk_dialog_add_action_widget (GTK_DIALOG (search_dialog), priv->prev_button, GUCHARMAP_RESPONSE_PREVIOUS);
   gtk_widget_show (priv->prev_button);
 
   priv->next_button = gtk_button_new ();
-  GTK_WIDGET_SET_FLAGS (priv->next_button, GTK_CAN_DEFAULT);
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_set_can_default (priv->prev_button, TRUE);
+#else
+  GTK_WIDGET_SET_FLAGS (priv->prev_button, GTK_CAN_DEFAULT);
+#endif
   gtk_widget_show (priv->next_button);
   set_button_stock_image_and_label (GTK_BUTTON (priv->next_button), GTK_STOCK_GO_FORWARD, _("_Next"));
   gtk_dialog_add_action_widget (GTK_DIALOG (search_dialog), priv->next_button, GUCHARMAP_RESPONSE_NEXT);
@@ -760,7 +772,7 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
   hbox = gtk_hbox_new (FALSE, 12);
   gtk_widget_show (hbox);
   gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (search_dialog)->vbox), hbox, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (search_dialog))), hbox, FALSE, FALSE, 0);
 
   label = gtk_label_new_with_mnemonic (_("_Search:"));
   gtk_widget_show (label);
@@ -774,12 +786,12 @@ gucharmap_search_dialog_init (GucharmapSearchDialog *search_dialog)
 
   priv->whole_word_option = gtk_check_button_new_with_mnemonic (_("Match _whole word"));
   gtk_widget_show (priv->whole_word_option);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (search_dialog)->vbox), priv->whole_word_option, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (search_dialog))), priv->whole_word_option, FALSE, FALSE, 0);
   g_signal_connect (priv->whole_word_option, "toggled", G_CALLBACK (entry_changed), search_dialog);
 
   priv->annotations_option = gtk_check_button_new_with_mnemonic (_("Search in character _details"));
   gtk_widget_show (priv->annotations_option);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (search_dialog)->vbox), priv->annotations_option, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (search_dialog))), priv->annotations_option, FALSE, FALSE, 0);
   g_signal_connect (priv->annotations_option, "toggled", G_CALLBACK (entry_changed), search_dialog);
 
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->entry);
diff --git a/gucharmap/gucharmap-settings.c b/gucharmap/gucharmap-settings.c
index 7e19511..72e0858 100644
--- a/gucharmap/gucharmap-settings.c
+++ b/gucharmap/gucharmap-settings.c
@@ -377,7 +377,11 @@ gucharmap_settings_add_window (GtkWindow *window)
   gboolean maximised, fullscreen;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
+#if GTK_CHECK_VERSION (2,20,0)
+  g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
+#else
   g_return_if_fail (!GTK_WIDGET_REALIZED (window));
+#endif
 
   state = g_slice_new0 (WindowState);
   g_object_set_data_full (G_OBJECT (window), "GamesConf::WindowState",
diff --git a/gucharmap/gucharmap-window.c b/gucharmap/gucharmap-window.c
index 32b94ba..4a80f4e 100644
--- a/gucharmap/gucharmap-window.c
+++ b/gucharmap/gucharmap-window.c
@@ -233,7 +233,7 @@ search_start (GucharmapSearchDialog *search_dialog,
   GtkAction *action;
 
   cursor = _gucharmap_window_progress_cursor ();
-  gdk_window_set_cursor (GTK_WIDGET (guw)->window, cursor);
+  gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (guw)), cursor);
   gdk_cursor_unref (cursor);
 
   action = gtk_action_group_get_action (guw->action_group, "Find");
@@ -261,7 +261,7 @@ search_finish (GucharmapSearchDialog *search_dialog,
     gucharmap_charmap_set_active_character (guw->charmap, found_char);
   /* not-found dialog handled by GucharmapSearchDialog */
 
-  gdk_window_set_cursor (GTK_WIDGET (guw)->window, NULL);
+  gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (guw)), NULL);
 
   action = gtk_action_group_get_action (guw->action_group, "Find");
   gtk_action_set_sensitive (action, TRUE);
@@ -757,9 +757,18 @@ static void
 status_realize (GtkWidget       *status,
                 GucharmapWindow *guw)
 {
+#if GTK_CHECK_VERSION (2,18,0)
+  GtkAllocation allocation;
+
+  gtk_widget_get_allocation (guw->status, &allocation);
+#endif
   /* FIXMEchpe ewww... */
   /* increase the height a bit so it doesn't resize itself */
+#if GTK_CHECK_VERSION (2,18,0)
+  gtk_widget_set_size_request (guw->status, -1, allocation.height + 9);
+#else
   gtk_widget_set_size_request (guw->status, -1, guw->status->allocation.height + 9);
+#endif
 }
 
 static gboolean
@@ -1073,7 +1082,11 @@ gucharmap_window_set_font (GucharmapWindow *guw,
 
   g_return_if_fail (GUCHARMAP_IS_WINDOW (guw));
 
+#if GTK_CHECK_VERSION (2,20,0)
+  g_assert (!gtk_widget_get_realized (GTK_WIDGET (guw)));
+#else
   g_assert (!GTK_WIDGET_REALIZED (guw));
+#endif
 
   if (!font)
     return;



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