From 58cfcd4f57e1b6dc0f005e43ec77edd95f2393f9 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 28 Jun 2008 15:09:46 +0000 Subject: [PATCH] libgimp/gimpgradientselectbutton.c libgimp/gimpmenu.c 2008-06-28 Michael Natterer * libgimp/gimpgradientselectbutton.c * libgimp/gimpmenu.c * libgimpwidgets/gimpbrowser.c * libgimpwidgets/gimpcellrenderercolor.c * libgimpwidgets/gimpcellrenderertoggle.c * libgimpwidgets/gimpchainbutton.c * libgimpwidgets/gimpcolorarea.c * libgimpwidgets/gimpcolorscale.c * libgimpwidgets/gimpcolorscales.c * libgimpwidgets/gimpcolorselect.c * libgimpwidgets/gimpenumwidgets.c * libgimpwidgets/gimpframe.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppreviewarea.c * libgimpwidgets/gimppropwidgets.c * libgimpwidgets/gimpscrolledpreview.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26005 --- ChangeLog | 21 ++++++ libgimp/gimpgradientselectbutton.c | 5 +- libgimp/gimpmenu.c | 9 +-- libgimpwidgets/gimpbrowser.c | 4 +- libgimpwidgets/gimpcellrenderercolor.c | 7 +- libgimpwidgets/gimpcellrenderertoggle.c | 18 ++--- libgimpwidgets/gimpchainbutton.c | 3 +- libgimpwidgets/gimpcolorarea.c | 32 +++++---- libgimpwidgets/gimpcolorscale.c | 32 ++++----- libgimpwidgets/gimpcolorscales.c | 2 +- libgimpwidgets/gimpcolorselect.c | 2 +- libgimpwidgets/gimpenumwidgets.c | 8 ++- libgimpwidgets/gimpframe.c | 89 ++++++++++++++----------- libgimpwidgets/gimphelpui.c | 2 +- libgimpwidgets/gimpoffsetarea.c | 11 +-- libgimpwidgets/gimppreviewarea.c | 9 +-- libgimpwidgets/gimppropwidgets.c | 12 ++-- libgimpwidgets/gimpscrolledpreview.c | 5 +- 18 files changed, 162 insertions(+), 109 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5367f4939..242f366e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2008-06-28 Michael Natterer + + * libgimp/gimpgradientselectbutton.c + * libgimp/gimpmenu.c + * libgimpwidgets/gimpbrowser.c + * libgimpwidgets/gimpcellrenderercolor.c + * libgimpwidgets/gimpcellrenderertoggle.c + * libgimpwidgets/gimpchainbutton.c + * libgimpwidgets/gimpcolorarea.c + * libgimpwidgets/gimpcolorscale.c + * libgimpwidgets/gimpcolorscales.c + * libgimpwidgets/gimpcolorselect.c + * libgimpwidgets/gimpenumwidgets.c + * libgimpwidgets/gimpframe.c + * libgimpwidgets/gimphelpui.c + * libgimpwidgets/gimpoffsetarea.c + * libgimpwidgets/gimppreviewarea.c + * libgimpwidgets/gimppropwidgets.c + * libgimpwidgets/gimpscrolledpreview.c: use accessors instead of + accessing members of GTK+ widgets directly. + 2008-06-28 Michael Natterer * app/widgets/gimplanguagestore-parser.c: include diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c index 5058541514..bc5dd74833 100644 --- a/libgimp/gimpgradientselectbutton.c +++ b/libgimp/gimpgradientselectbutton.c @@ -528,10 +528,11 @@ gimp_gradient_select_preview_expose (GtkWidget *widget, for (y = event->area.y; y < event->area.y + event->area.height; y++) { - guchar *buf = ((y / GIMP_CHECK_SIZE_SM) & 1) ? odd : even; + GtkStyle *style = gtk_widget_get_style (widget); + guchar *buf = ((y / GIMP_CHECK_SIZE_SM) & 1) ? odd : even; gdk_draw_rgb_image_dithalign (widget->window, - widget->style->fg_gc[widget->state], + style->fg_gc[widget->state], event->area.x, y, event->area.width, 1, GDK_RGB_DITHER_MAX, diff --git a/libgimp/gimpmenu.c b/libgimp/gimpmenu.c index e31e5de170..a5b6708d2d 100644 --- a/libgimp/gimpmenu.c +++ b/libgimp/gimpmenu.c @@ -484,12 +484,13 @@ static void gimp_menu_callback (GtkWidget *widget, gpointer any_ID) { - GimpMenuCallback callback; - gpointer callback_data; + GtkWidget *parent = gtk_widget_get_parent (widget); + GimpMenuCallback callback; + gpointer callback_data; - callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (widget->parent), + callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (parent), "gimp-menu-callback"); - callback_data = g_object_get_data (G_OBJECT (widget->parent), + callback_data = g_object_get_data (G_OBJECT (parent), "gimp-menu-callback-data"); (* callback) (GPOINTER_TO_INT (any_ID), callback_data); diff --git a/libgimpwidgets/gimpbrowser.c b/libgimpwidgets/gimpbrowser.c index 49bd428637..95d37761e0 100644 --- a/libgimpwidgets/gimpbrowser.c +++ b/libgimpwidgets/gimpbrowser.c @@ -207,8 +207,8 @@ gimp_browser_add_search_types (GimpBrowser *browser, browser->search_type_combo = combo; browser->search_type = first_type_id; - gtk_box_pack_end (GTK_BOX (browser->search_entry->parent), combo, - FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (gtk_widget_get_parent (browser->search_entry)), + combo, FALSE, FALSE, 0); gtk_widget_show (combo); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), diff --git a/libgimpwidgets/gimpcellrenderercolor.c b/libgimpwidgets/gimpcellrenderercolor.c index ef68e49911..285c5c469a 100644 --- a/libgimpwidgets/gimpcellrenderercolor.c +++ b/libgimpwidgets/gimpcellrenderercolor.c @@ -237,7 +237,8 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell, if (rect.width > 2 && rect.height > 2) { - cairo_t *cr = gdk_cairo_create (window); + cairo_t *cr = gdk_cairo_create (window); + GtkStyle *style = gtk_widget_get_style (widget); GtkStateType state; cairo_rectangle (cr, @@ -285,13 +286,13 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell, } cairo_set_line_width (cr, 1); - gdk_cairo_set_source_color (cr, &widget->style->fg[state]); + gdk_cairo_set_source_color (cr, &style->fg[state]); cairo_stroke_preserve (cr); if (state == GTK_STATE_SELECTED && gimp_cairo_set_focus_line_pattern (cr, widget)) { - gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_STATE_NORMAL]); + gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]); cairo_stroke (cr); } diff --git a/libgimpwidgets/gimpcellrenderertoggle.c b/libgimpwidgets/gimpcellrenderertoggle.c index e1697fb20e..1447c95f10 100644 --- a/libgimpwidgets/gimpcellrenderertoggle.c +++ b/libgimpwidgets/gimpcellrenderertoggle.c @@ -220,6 +220,7 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, gint *height) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); + GtkStyle *style = gtk_widget_get_style (widget); gint calc_width; gint calc_height; gint pixbuf_width; @@ -242,9 +243,9 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf); calc_width = (pixbuf_width + - (gint) cell->xpad * 2 + widget->style->xthickness * 2); + (gint) cell->xpad * 2 + style->xthickness * 2); calc_height = (pixbuf_height + - (gint) cell->ypad * 2 + widget->style->ythickness * 2); + (gint) cell->ypad * 2 + style->ythickness * 2); if (width) *width = calc_width; @@ -280,6 +281,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, GtkCellRendererState flags) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); + GtkStyle *style = gtk_widget_get_style (widget); GdkRectangle toggle_rect; GdkRectangle draw_rect; GtkStateType state; @@ -328,7 +330,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) && (flags & GTK_CELL_RENDERER_PRELIT)) - gtk_paint_shadow (widget->style, + gtk_paint_shadow (style, window, state, active ? GTK_SHADOW_IN : GTK_SHADOW_OUT, @@ -339,14 +341,14 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (active) { - toggle_rect.x += widget->style->xthickness; - toggle_rect.y += widget->style->ythickness; - toggle_rect.width -= widget->style->xthickness * 2; - toggle_rect.height -= widget->style->ythickness * 2; + toggle_rect.x += style->xthickness; + toggle_rect.y += style->ythickness; + toggle_rect.width -= style->xthickness * 2; + toggle_rect.height -= style->ythickness * 2; if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect)) gdk_draw_pixbuf (window, - widget->style->black_gc, + style->black_gc, toggle->pixbuf, /* pixbuf 0, 0 is at toggle_rect.x, toggle_rect.y */ draw_rect.x - toggle_rect.x, diff --git a/libgimpwidgets/gimpchainbutton.c b/libgimpwidgets/gimpchainbutton.c index e9e9d3a57b..b3392f173d 100644 --- a/libgimpwidgets/gimpchainbutton.c +++ b/libgimpwidgets/gimpchainbutton.c @@ -443,7 +443,8 @@ gimp_chain_line_expose_event (GtkWidget *widget, points[2] = buf; } - gtk_paint_polygon (widget->style, widget->window, GTK_STATE_NORMAL, + gtk_paint_polygon (gtk_widget_get_style (widget), + widget->window, GTK_STATE_NORMAL, shadow, &event->area, widget, diff --git a/libgimpwidgets/gimpcolorarea.c b/libgimpwidgets/gimpcolorarea.c index f74b96eab7..5b056e3993 100644 --- a/libgimpwidgets/gimpcolorarea.c +++ b/libgimpwidgets/gimpcolorarea.c @@ -323,7 +323,8 @@ static gboolean gimp_color_area_expose (GtkWidget *widget, GdkEventExpose *event) { - GimpColorArea *area = GIMP_COLOR_AREA (widget); + GimpColorArea *area = GIMP_COLOR_AREA (widget); + GtkStyle *style = gtk_widget_get_style (widget); guchar *buf; if (! area->buf || ! GTK_WIDGET_DRAWABLE (widget)) @@ -335,7 +336,7 @@ gimp_color_area_expose (GtkWidget *widget, buf = area->buf + event->area.y * area->rowstride + event->area.x * 3; gdk_draw_rgb_image_dithalign (widget->window, - widget->style->black_gc, + style->black_gc, event->area.x, event->area.y, event->area.width, @@ -348,7 +349,7 @@ gimp_color_area_expose (GtkWidget *widget, if (area->draw_border) gdk_draw_rectangle (widget->window, - widget->style->fg_gc[widget->state], + style->fg_gc[widget->state], FALSE, 0, 0, area->width - 1, area->height - 1); @@ -505,19 +506,22 @@ _gimp_color_area_render_buf (GtkWidget *widget, guint rowstride, GimpRGB *color) { - guint x, y; - guint check_size = 0; - guchar light[3]; - guchar dark[3]; - guchar opaque[3]; - guchar insens[3]; - guchar *p; - gdouble frac; + GtkStyle *style; + guint x, y; + guint check_size = 0; + guchar light[3]; + guchar dark[3]; + guchar opaque[3]; + guchar insens[3]; + guchar *p; + gdouble frac; g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (buf != NULL); g_return_if_fail (color != NULL); + style = gtk_widget_get_style (widget); + switch (type) { case GIMP_COLOR_AREA_FLAT: @@ -535,9 +539,9 @@ _gimp_color_area_render_buf (GtkWidget *widget, gimp_rgb_get_uchar (color, opaque, opaque + 1, opaque + 2); - insens[0] = widget->style->bg[GTK_STATE_INSENSITIVE].red >> 8; - insens[1] = widget->style->bg[GTK_STATE_INSENSITIVE].green >> 8; - insens[2] = widget->style->bg[GTK_STATE_INSENSITIVE].blue >> 8; + insens[0] = style->bg[GTK_STATE_INSENSITIVE].red >> 8; + insens[1] = style->bg[GTK_STATE_INSENSITIVE].green >> 8; + insens[2] = style->bg[GTK_STATE_INSENSITIVE].blue >> 8; if (insensitive || check_size == 0 || color->a == 1.0) { diff --git a/libgimpwidgets/gimpcolorscale.c b/libgimpwidgets/gimpcolorscale.c index 5729a412e6..94592a2dc1 100644 --- a/libgimpwidgets/gimpcolorscale.c +++ b/libgimpwidgets/gimpcolorscale.c @@ -235,7 +235,8 @@ gimp_color_scale_expose (GtkWidget *widget, GdkEventExpose *event) { GimpColorScale *scale = GIMP_COLOR_SCALE (widget); - GtkRange *range; + GtkRange *range = GTK_RANGE (widget); + GtkStyle *style = gtk_widget_get_style (widget); GdkRectangle expose_area; /* Relative to widget->allocation */ GdkRectangle area; gint focus = 0; @@ -247,8 +248,6 @@ gimp_color_scale_expose (GtkWidget *widget, if (! scale->buf || ! GTK_WIDGET_DRAWABLE (widget)) return FALSE; - range = GTK_RANGE (scale); - /* 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. @@ -304,19 +303,19 @@ gimp_color_scale_expose (GtkWidget *widget, area.x += widget->allocation.x; area.y += widget->allocation.y; - gtk_paint_box (widget->style, widget->window, + gtk_paint_box (style, widget->window, sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, &area, widget, "trough", x, y, w, h); - gdk_gc_set_clip_rectangle (widget->style->black_gc, &area); + gdk_gc_set_clip_rectangle (style->black_gc, &area); switch (range->orientation) { case GTK_ORIENTATION_HORIZONTAL: gdk_draw_rgb_image_dithalign (widget->window, - widget->style->black_gc, + style->black_gc, x + trough_border + slider_size, y + trough_border + 1, scale->width, @@ -329,7 +328,7 @@ gimp_color_scale_expose (GtkWidget *widget, case GTK_ORIENTATION_VERTICAL: gdk_draw_rgb_image_dithalign (widget->window, - widget->style->black_gc, + style->black_gc, x + trough_border + 1, y + trough_border + slider_size, scale->width, @@ -341,11 +340,11 @@ gimp_color_scale_expose (GtkWidget *widget, break; } - gdk_gc_set_clip_rectangle (widget->style->black_gc, NULL); + gdk_gc_set_clip_rectangle (style->black_gc, NULL); } if (GTK_WIDGET_IS_SENSITIVE (widget) && GTK_WIDGET_HAS_FOCUS (range)) - gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), + gtk_paint_focus (style, widget->window, GTK_WIDGET_STATE (widget), &area, widget, "trough", widget->allocation.x + range->range_rect.x, widget->allocation.y + range->range_rect.y, @@ -374,8 +373,8 @@ gimp_color_scale_expose (GtkWidget *widget, GdkGC *gc; gc = (GTK_WIDGET_IS_SENSITIVE (widget) ? - widget->style->black_gc : - widget->style->dark_gc[GTK_STATE_INSENSITIVE]); + style->black_gc : + style->dark_gc[GTK_STATE_INSENSITIVE]); gdk_gc_set_clip_rectangle (gc, &expose_area); switch (range->orientation) @@ -394,8 +393,8 @@ gimp_color_scale_expose (GtkWidget *widget, gdk_gc_set_clip_rectangle (gc, NULL); gc = (GTK_WIDGET_IS_SENSITIVE (widget) ? - widget->style->white_gc : - widget->style->light_gc[GTK_STATE_INSENSITIVE]); + style->white_gc : + style->light_gc[GTK_STATE_INSENSITIVE]); gdk_gc_set_clip_rectangle (gc, &expose_area); switch (range->orientation) @@ -739,6 +738,7 @@ static void gimp_color_scale_render_stipple (GimpColorScale *scale) { GtkWidget *widget = GTK_WIDGET (scale); + GtkStyle *style = gtk_widget_get_style (widget); guchar *buf; guchar insensitive[3]; guint x, y; @@ -746,9 +746,9 @@ gimp_color_scale_render_stipple (GimpColorScale *scale) if ((buf = scale->buf) == NULL) return; - insensitive[0] = widget->style->bg[GTK_STATE_INSENSITIVE].red >> 8; - insensitive[1] = widget->style->bg[GTK_STATE_INSENSITIVE].green >> 8; - insensitive[2] = widget->style->bg[GTK_STATE_INSENSITIVE].blue >> 8; + insensitive[0] = style->bg[GTK_STATE_INSENSITIVE].red >> 8; + insensitive[1] = style->bg[GTK_STATE_INSENSITIVE].green >> 8; + insensitive[2] = style->bg[GTK_STATE_INSENSITIVE].blue >> 8; for (y = 0; y < scale->height; y++, buf += scale->rowstride) { diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c index 12f2b54530..cb747f2c41 100644 --- a/libgimpwidgets/gimpcolorscales.c +++ b/libgimpwidgets/gimpcolorscales.c @@ -325,7 +325,7 @@ gimp_color_scales_toggle_update (GtkWidget *widget, { GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales); - if (GTK_TOGGLE_BUTTON (widget)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { gint i; diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c index 0178c10ed2..b6e447022a 100644 --- a/libgimpwidgets/gimpcolorselect.c +++ b/libgimpwidgets/gimpcolorselect.c @@ -440,7 +440,7 @@ static void gimp_color_select_channel_toggled (GtkWidget *widget, GimpColorSelect *select) { - if (GTK_TOGGLE_BUTTON (widget)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select); GimpColorSelectorChannel channel; diff --git a/libgimpwidgets/gimpenumwidgets.c b/libgimpwidgets/gimpenumwidgets.c index 13ba428e14..901781ac4f 100644 --- a/libgimpwidgets/gimpenumwidgets.c +++ b/libgimpwidgets/gimpenumwidgets.c @@ -419,10 +419,14 @@ gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box, if (GTK_IS_MISC (child)) { GtkMisc *misc = GTK_MISC (child); + gint misc_xpad; + gint misc_ypad; + + gtk_misc_get_padding (misc, &misc_xpad, &misc_ypad); gtk_misc_set_padding (misc, - xpad < 0 ? misc->xpad : xpad, - ypad < 0 ? misc->ypad : ypad); + xpad < 0 ? misc_xpad : xpad, + ypad < 0 ? misc_ypad : ypad); } } diff --git a/libgimpwidgets/gimpframe.c b/libgimpwidgets/gimpframe.c index 6fbbad067b..ef9589d11f 100644 --- a/libgimpwidgets/gimpframe.c +++ b/libgimpwidgets/gimpframe.c @@ -98,13 +98,15 @@ static void gimp_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkFrame *frame = GTK_FRAME (widget); - GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); + GtkFrame *frame = GTK_FRAME (widget); + GtkWidget *label_widget = gtk_frame_get_label_widget (frame); + GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); GtkRequisition child_requisition; + gint border_width; - if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) + if (label_widget && GTK_WIDGET_VISIBLE (label_widget)) { - gtk_widget_size_request (frame->label_widget, requisition); + gtk_widget_size_request (label_widget, requisition); } else { @@ -125,16 +127,19 @@ gimp_frame_size_request (GtkWidget *widget, requisition->height += child_requisition.height; } - requisition->width += 2 * GTK_CONTAINER (widget)->border_width; - requisition->height += 2 * GTK_CONTAINER (widget)->border_width; + border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); + + requisition->width += 2 * border_width; + requisition->height += 2 * border_width; } static void gimp_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkFrame *frame = GTK_FRAME (widget); - GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); + GtkFrame *frame = GTK_FRAME (widget); + GtkWidget *label_widget = gtk_frame_get_label_widget (frame); + GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); widget->allocation = *allocation; @@ -143,22 +148,23 @@ gimp_frame_size_allocate (GtkWidget *widget, if (child && GTK_WIDGET_VISIBLE (child)) gtk_widget_size_allocate (child, &frame->child_allocation); - if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) + if (label_widget && GTK_WIDGET_VISIBLE (label_widget)) { GtkAllocation label_allocation; GtkRequisition label_requisition; - gint border = GTK_CONTAINER (widget)->border_width; + gint border_width; - gtk_widget_get_child_requisition (frame->label_widget, - &label_requisition); + border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - label_allocation.x = allocation->x + border; - label_allocation.y = allocation->y + border; + gtk_widget_get_child_requisition (label_widget, &label_requisition); + + label_allocation.x = allocation->x + border_width; + label_allocation.y = allocation->y + border_width; label_allocation.width = MAX (label_requisition.width, - allocation->width - 2 * border); + allocation->width - 2 * border_width); label_allocation.height = label_requisition.height; - gtk_widget_size_allocate (frame->label_widget, &label_allocation); + gtk_widget_size_allocate (label_widget, &label_allocation); } } @@ -166,34 +172,36 @@ static void gimp_frame_child_allocate (GtkFrame *frame, GtkAllocation *child_allocation) { - GtkWidget *widget = GTK_WIDGET (frame); - GtkAllocation *allocation = &widget->allocation; - gint border = GTK_CONTAINER (frame)->border_width; - gint spacing = 0; - gint indent = gimp_frame_get_indent (widget); + GtkWidget *widget = GTK_WIDGET (frame); + GtkWidget *label_widget = gtk_frame_get_label_widget (frame); + GtkAllocation *allocation = &widget->allocation; + gint border_width; + gint spacing = 0; + gint indent = gimp_frame_get_indent (widget); - if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) + border_width = gtk_container_get_border_width (GTK_CONTAINER (frame)); + + if (label_widget && GTK_WIDGET_VISIBLE (label_widget)) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (frame->label_widget, - &child_requisition); + gtk_widget_get_child_requisition (label_widget, &child_requisition); spacing += child_requisition.height; } spacing += gimp_frame_get_label_spacing (frame); if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - child_allocation->x = border + indent; + child_allocation->x = border_width + indent; else - child_allocation->x = border; + child_allocation->x = border_width; - child_allocation->y = border + spacing; + child_allocation->y = border_width + spacing; child_allocation->width = MAX (1, - allocation->width - 2 * border - indent); + allocation->width - 2 * border_width - indent); child_allocation->height = MAX (1, allocation->height - - child_allocation->y - border); + child_allocation->y - border_width); child_allocation->x += allocation->x; child_allocation->y += allocation->y; @@ -227,20 +235,24 @@ gimp_frame_expose_event (GtkWidget *widget, static void gimp_frame_label_widget_notify (GtkFrame *frame) { - if (frame->label_widget) + GtkWidget *label_widget = gtk_frame_get_label_widget (frame); + + if (label_widget) { GtkLabel *label = NULL; - if (GTK_IS_LABEL (frame->label_widget)) + if (GTK_IS_LABEL (label_widget)) { - label = GTK_LABEL (frame->label_widget); + gfloat xalign, yalign; - gtk_misc_set_alignment (GTK_MISC (label), - frame->label_xalign, frame->label_yalign); + label = GTK_LABEL (label_widget); + + gtk_frame_get_label_align (frame, &xalign, &yalign); + gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); } - else if (GTK_IS_BIN (frame->label_widget)) + else if (GTK_IS_BIN (label_widget)) { - GtkWidget *child = gtk_bin_get_child (GTK_BIN (frame->label_widget)); + GtkWidget *child = gtk_bin_get_child (GTK_BIN (label_widget)); if (GTK_IS_LABEL (child)) label = GTK_LABEL (child); @@ -293,9 +305,10 @@ gimp_frame_get_indent (GtkWidget *widget) static gint gimp_frame_get_label_spacing (GtkFrame *frame) { - gint spacing = 0; + GtkWidget *label_widget = gtk_frame_get_label_widget (frame); + gint spacing = 0; - if ((frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) || + if ((label_widget && GTK_WIDGET_VISIBLE (label_widget)) || (g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY))) { gtk_widget_style_get (GTK_WIDGET (frame), diff --git a/libgimpwidgets/gimphelpui.c b/libgimpwidgets/gimphelpui.c index 23774910bd..bfddc09504 100644 --- a/libgimpwidgets/gimphelpui.c +++ b/libgimpwidgets/gimphelpui.c @@ -306,7 +306,7 @@ gimp_help_get_help_data (GtkWidget *widget, const gchar *help_id = NULL; gpointer help_data = NULL; - for (; widget; widget = widget->parent) + for (; widget; widget = gtk_widget_get_parent (widget)) { help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID); help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data"); diff --git a/libgimpwidgets/gimpoffsetarea.c b/libgimpwidgets/gimpoffsetarea.c index 8ec5171fd3..ae93569bde 100644 --- a/libgimpwidgets/gimpoffsetarea.c +++ b/libgimpwidgets/gimpoffsetarea.c @@ -389,7 +389,8 @@ static gboolean gimp_offset_area_expose_event (GtkWidget *widget, GdkEventExpose *eevent) { - GimpOffsetArea *area = GIMP_OFFSET_AREA (widget); + GimpOffsetArea *area = GIMP_OFFSET_AREA (widget); + GtkStyle *style = gtk_widget_get_style (widget); GdkPixbuf *pixbuf; gint w, h; gint x, y; @@ -414,14 +415,14 @@ gimp_offset_area_expose_event (GtkWidget *widget, if (pixbuf) { - gdk_draw_pixbuf (widget->window, widget->style->black_gc, + gdk_draw_pixbuf (widget->window, style->black_gc, pixbuf, 0, 0, x, y, w, h, GDK_RGB_DITHER_NORMAL, 0, 0); - gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE, + gdk_draw_rectangle (widget->window, style->black_gc, FALSE, x, y, w - 1, h - 1); } else { - gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL, + gtk_paint_shadow (style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, NULL, x, y, w, h); @@ -474,7 +475,7 @@ gimp_offset_area_expose_event (GtkWidget *widget, } else { - gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE, + gdk_draw_rectangle (widget->window, style->black_gc, FALSE, x, y, w, h); } } diff --git a/libgimpwidgets/gimppreviewarea.c b/libgimpwidgets/gimppreviewarea.c index 8d1f0b1d9c..8db75bfd83 100644 --- a/libgimpwidgets/gimppreviewarea.c +++ b/libgimpwidgets/gimppreviewarea.c @@ -238,12 +238,13 @@ gimp_preview_area_expose (GtkWidget *widget, if (gdk_rectangle_intersect (&rect, &event->area, &render)) { - gint x = render.x - rect.x; - gint y = render.y - rect.y; - guchar *buf = area->buf + x * 3 + y * area->rowstride; + GtkStyle *style = gtk_widget_get_style (widget); + gint x = render.x - rect.x; + gint y = render.y - rect.y; + guchar *buf = area->buf + x * 3 + y * area->rowstride; gdk_draw_rgb_image_dithalign (widget->window, - widget->style->fg_gc[widget->state], + style->fg_gc[widget->state], render.x, render.y, render.width, diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c index a148b439b7..31aed0c672 100644 --- a/libgimpwidgets/gimppropwidgets.c +++ b/libgimpwidgets/gimppropwidgets.c @@ -137,7 +137,8 @@ gimp_prop_check_button_callback (GtkWidget *widget, return; g_object_set (config, - param_spec->name, GTK_TOGGLE_BUTTON (widget)->active, + param_spec->name, + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)), NULL); gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget)); @@ -154,7 +155,7 @@ gimp_prop_check_button_notify (GObject *config, param_spec->name, &value, NULL); - if (GTK_TOGGLE_BUTTON (button)->active != value) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) != value) { g_signal_handlers_block_by_func (button, gimp_prop_check_button_callback, @@ -260,7 +261,8 @@ gimp_prop_enum_check_button_callback (GtkWidget *widget, g_object_set (config, param_spec->name, - GTK_TOGGLE_BUTTON (widget)->active ? true_value : false_value, + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ? + true_value : false_value, NULL); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), FALSE); @@ -296,7 +298,7 @@ gimp_prop_enum_check_button_notify (GObject *config, gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), inconsistent); - if (GTK_TOGGLE_BUTTON (button)->active != active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) != active) { g_signal_handlers_block_by_func (button, gimp_prop_enum_check_button_callback, @@ -954,7 +956,7 @@ static void gimp_prop_radio_button_callback (GtkWidget *widget, GObject *config) { - if (GTK_TOGGLE_BUTTON (widget)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { GParamSpec *param_spec; gint value; diff --git a/libgimpwidgets/gimpscrolledpreview.c b/libgimpwidgets/gimpscrolledpreview.c index 040f36ccaf..48645d8653 100644 --- a/libgimpwidgets/gimpscrolledpreview.c +++ b/libgimpwidgets/gimpscrolledpreview.c @@ -565,6 +565,7 @@ gimp_scrolled_preview_nav_button_press (GtkWidget *widget, if (event->type == GDK_BUTTON_PRESS && event->button == 1) { + GtkStyle *style = gtk_widget_get_style (widget); GtkWidget *outer; GtkWidget *inner; GtkWidget *area; @@ -625,8 +626,8 @@ gimp_scrolled_preview_nav_button_press (GtkWidget *widget, y += event->y - v * (gdouble) GIMP_PREVIEW_AREA (area)->height; gtk_window_move (GTK_WINDOW (preview->nav_popup), - x - 2 * widget->style->xthickness, - y - 2 * widget->style->ythickness); + x - 2 * style->xthickness, + y - 2 * style->ythickness); gtk_widget_show (preview->nav_popup);