File fix-GtkWidget-migration.patch of Package scim-anthy
Index: scim-anthy-1.2.7/src/scim_anthy_color_button.cpp
===================================================================
--- scim-anthy-1.2.7.orig/src/scim_anthy_color_button.cpp
+++ scim-anthy-1.2.7/src/scim_anthy_color_button.cpp
@@ -211,13 +211,22 @@ scim_anthy_color_button_expose (GtkWidge
gint width, height;
gint swap_w = 0, swap_h = 0;
gint rect_w, rect_h;
-
+ GtkAllocation *allocation = NULL;
+
if (!gtk_widget_is_drawable(widget))
return FALSE;
- width = widget->allocation.width;
- height = widget->allocation.height;
+ allocation = g_new0 (GtkAllocation, 1);
+ if (allocation == NULL)
+ return FALSE;
+
+ gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
+ width = allocation->width;
+ height = allocation->height;
+ if (allocation != NULL)
+ g_free (allocation);
+
/* draw the swap colors pixbuf */
if (!button->swap_icon) {
button->swap_icon
@@ -231,7 +240,7 @@ scim_anthy_color_button_expose (GtkWidge
}
if (swap_w < width / 2 && swap_h < height / 2) {
- gdk_draw_pixbuf (widget->window, NULL, button->swap_icon,
+ gdk_draw_pixbuf (gtk_widget_get_window (widget), NULL, button->swap_icon,
0, 0, width - swap_w, 0, swap_w, swap_h,
GDK_RGB_DITHER_NORMAL, 0, 0);
} else {
@@ -252,14 +261,14 @@ scim_anthy_color_button_expose (GtkWidge
/* draw the background area */
scim_anthy_color_button_draw_rect (button,
- widget->window,
- widget->style->fg_gc[0],
+ gtk_widget_get_window (widget),
+ gtk_widget_get_style (widget)->fg_gc[0],
(width - rect_w),
(height - rect_h),
rect_w, rect_h,
&button->bg_color);
- gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
+ gtk_paint_shadow (gtk_widget_get_style (widget), gtk_widget_get_window (widget), GTK_STATE_NORMAL,
GTK_SHADOW_IN,
NULL, widget, NULL,
(width - rect_w),
@@ -269,13 +278,13 @@ scim_anthy_color_button_expose (GtkWidge
/* draw the foreground area */
scim_anthy_color_button_draw_rect (button,
- widget->window,
- widget->style->fg_gc[0],
+ gtk_widget_get_window (widget),
+ gtk_widget_get_style (widget)->fg_gc[0],
0, 0,
rect_w, rect_h,
&button->fg_color);
- gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
+ gtk_paint_shadow (gtk_widget_get_style (widget), gtk_widget_get_window (widget), GTK_STATE_NORMAL,
GTK_SHADOW_IN,
NULL, widget, NULL,
0, 0,
@@ -289,11 +298,22 @@ scim_anthy_color_button_target (ScimAnth
gint x,
gint y)
{
- gint width = GTK_WIDGET (button)->allocation.width;
- gint height = GTK_WIDGET (button)->allocation.height;
+ GtkAllocation *allocation = NULL;
+ gint width, height;
gint rect_w = button->rect_width;
gint rect_h = button->rect_height;
+ allocation = g_new0 (GtkAllocation, 1);
+ if (allocation == NULL)
+ return INVALID_AREA;
+
+ gtk_widget_get_allocation(GTK_WIDGET(button), allocation);
+ width = allocation->width;
+ height = allocation->height;
+
+ if (allocation != NULL)
+ g_free (allocation);
+
if (x > 0 && x < rect_w && y > 0 && y < rect_h)
return FOREGROUND_AREA;
else if (x > (width - rect_w) && x < width &&
@@ -322,7 +342,7 @@ scim_anthy_color_button_open_color_dialo
dialog = gtk_color_selection_dialog_new (title);
- gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel),
+ gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)),
color);
gtk_widget_show (dialog);
@@ -330,7 +350,7 @@ scim_anthy_color_button_open_color_dialo
switch (result) {
case GTK_RESPONSE_OK:
- gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel),
+ gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)),
color);
g_signal_emit (button, button_signals[COLOR_CHANGED], 0);
break;