Commit f53ed53c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c

2008-06-28  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpactionview.c
	* app/widgets/gimpblobeditor.c
	* app/widgets/gimpbrushfactoryview.c
	* app/widgets/gimpbrushselect.c
	* app/widgets/gimpcellrendererdashes.c
	* app/widgets/gimpcellrendererviewable.c
	* app/widgets/gimpcolorbar.c
	* app/widgets/gimpcoloreditor.c
	* app/widgets/gimpcolorframe.c
	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimpcontainerbox.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimpcurveview.c
	* app/widgets/gimpdasheditor.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpdock.c
	* app/widgets/gimpdockable.c
	* app/widgets/gimpdockseparator.c
	* app/widgets/gimpfgbgeditor.c
	* app/widgets/gimpfgbgview.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimphandlebar.c
	* app/widgets/gimphistogrambox.c
	* app/widgets/gimphistogramview.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimpmenudock.c
	* app/widgets/gimpmessagebox.c
	* app/widgets/gimppaletteview.c
	* app/widgets/gimpscalebutton.c
	* app/widgets/gimpsessioninfo-book.c
	* app/widgets/gimpsessioninfo-dock.c
	* app/widgets/gimpsettingseditor.c
	* app/widgets/gimpstrokeeditor.c
	* app/widgets/gimptemplateeditor.c
	* app/widgets/gimptemplateview.c
	* app/widgets/gimpthumbbox.c
	* app/widgets/gimptoolbox.c
	* app/widgets/gimptooloptionseditor.c
	* app/widgets/gimptoolview.c
	* app/widgets/gimpuimanager.c
	* app/widgets/gimpviewabledialog.c
	* app/widgets/gimpviewrenderervectors.c
	* app/widgets/gimpwidgets-utils.c: use accessors instead of
	accessing members of GTK+ widgets directly.


svn path=/trunk/; revision=26008
parent 6c9e6c7c
2008-06-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpactionview.c
* app/widgets/gimpblobeditor.c
* app/widgets/gimpbrushfactoryview.c
* app/widgets/gimpbrushselect.c
* app/widgets/gimpcellrendererdashes.c
* app/widgets/gimpcellrendererviewable.c
* app/widgets/gimpcolorbar.c
* app/widgets/gimpcoloreditor.c
* app/widgets/gimpcolorframe.c
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimpcontainertreeview.c
* app/widgets/gimpcurveview.c
* app/widgets/gimpdasheditor.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpdock.c
* app/widgets/gimpdockable.c
* app/widgets/gimpdockseparator.c
* app/widgets/gimpfgbgeditor.c
* app/widgets/gimpfgbgview.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimphandlebar.c
* app/widgets/gimphistogrambox.c
* app/widgets/gimphistogramview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimpmenudock.c
* app/widgets/gimpmessagebox.c
* app/widgets/gimppaletteview.c
* app/widgets/gimpscalebutton.c
* app/widgets/gimpsessioninfo-book.c
* app/widgets/gimpsessioninfo-dock.c
* app/widgets/gimpsettingseditor.c
* app/widgets/gimpstrokeeditor.c
* app/widgets/gimptemplateeditor.c
* app/widgets/gimptemplateview.c
* app/widgets/gimpthumbbox.c
* app/widgets/gimptoolbox.c
* app/widgets/gimptooloptionseditor.c
* app/widgets/gimptoolview.c
* app/widgets/gimpuimanager.c
* app/widgets/gimpviewabledialog.c
* app/widgets/gimpviewrenderervectors.c
* app/widgets/gimpwidgets-utils.c: use accessors instead of
accessing members of GTK+ widgets directly.
2008-06-28 Michael Natterer <mitch@gimp.org>
* plug-ins/uri/uri-backend-gvfs.c (uri_progress_callback): fix
......
......@@ -341,8 +341,10 @@ gimp_action_view_new (GimpUIManager *manager,
gtk_tree_view_column_set_title (column, _("Shortcut"));
cell = gtk_cell_renderer_accel_new ();
cell->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
GTK_CELL_RENDERER_TEXT (cell)->editable = TRUE;
g_object_set (cell,
"mode", GTK_CELL_RENDERER_MODE_EDITABLE,
"editable", TRUE,
NULL);
gtk_tree_view_column_pack_start (column, cell, TRUE);
gtk_tree_view_column_set_attributes (column, cell,
"accel-key",
......
......@@ -188,6 +188,7 @@ gimp_blob_editor_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr;
GdkRectangle rect;
gint r0;
......@@ -208,10 +209,10 @@ gimp_blob_editor_expose (GtkWidget *widget,
cairo_rectangle (cr,
rect.x + 0.5, rect.y + 0.5, rect.width - 1, rect.width - 1);
gdk_cairo_set_source_color (cr, &widget->style->light[widget->state]);
gdk_cairo_set_source_color (cr, &style->light[widget->state]);
cairo_fill_preserve (cr);
gdk_cairo_set_source_color (cr, &widget->style->dark[widget->state]);
gdk_cairo_set_source_color (cr, &style->dark[widget->state]);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
......@@ -319,6 +320,7 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
gdouble radius)
{
GtkWidget *widget = GTK_WIDGET (editor);
GtkStyle *style = gtk_widget_get_style (widget);
Blob *blob;
BlobFunc function = blob_ellipse;
gint i;
......@@ -373,6 +375,6 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
g_free (blob);
gdk_cairo_set_source_color (cr, &widget->style->fg[widget->state]);
gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
cairo_fill (cr);
}
......@@ -155,7 +155,7 @@ gimp_brush_factory_view_new (GimpViewType view_type,
/* eek */
gtk_box_pack_end (GTK_BOX (editor->view),
factory_view->spacing_scale->parent,
gtk_widget_get_parent (factory_view->spacing_scale),
FALSE, FALSE, 0);
factory_view->spacing_changed_handler_id =
......
......@@ -168,7 +168,7 @@ gimp_brush_select_constructor (GType type,
gtk_widget_show (dialog->view);
/* Create the frame and the table for the options */
table = GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_scale->parent;
table = gtk_widget_get_parent (GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_scale);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
......
......@@ -191,6 +191,7 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
GimpCellRendererDashes *dashes = GIMP_CELL_RENDERER_DASHES (cell);
GtkStyle *style = gtk_widget_get_style (widget);
GtkStateType state;
cairo_t *cr;
gint width;
......@@ -240,7 +241,7 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
}
}
gdk_cairo_set_source_color (cr, &widget->style->text[state]);
gdk_cairo_set_source_color (cr, &style->text[state]);
cairo_fill (cr);
cairo_destroy (cr);
......
......@@ -123,7 +123,9 @@ gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass)
static void
gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cellviewable)
{
GTK_CELL_RENDERER (cellviewable)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
g_object_set (cellviewable,
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
NULL);
}
static void
......
......@@ -154,15 +154,15 @@ static gboolean
gimp_color_bar_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
guchar *buf;
guchar *b;
gint x, y;
gint width, height;
gint i, j;
x = GTK_CONTAINER (bar)->border_width;
y = GTK_CONTAINER (bar)->border_width;
x = y = gtk_container_get_border_width (GTK_CONTAINER (bar));
width = widget->allocation.width - 2 * x;
height = widget->allocation.height - 2 * y;
......@@ -205,7 +205,7 @@ gimp_color_bar_expose (GtkWidget *widget,
break;
}
gdk_draw_rgb_image (widget->window, widget->style->black_gc,
gdk_draw_rgb_image (widget->window, style->black_gc,
widget->allocation.x + x, widget->allocation.y + y,
width, height,
GDK_RGB_DITHER_NORMAL,
......
......@@ -582,7 +582,7 @@ static void
gimp_color_editor_tab_toggled (GtkWidget *widget,
GimpColorEditor *editor)
{
if (GTK_TOGGLE_BUTTON (widget)->active)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
GtkWidget *selector;
......
......@@ -271,13 +271,14 @@ gimp_color_frame_expose (GtkWidget *widget,
if (frame->has_number)
{
cairo_t *cr;
gchar buf[8];
gint w, h;
gdouble scale;
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr;
gchar buf[8];
gint w, h;
gdouble scale;
cr = gdk_cairo_create (widget->window);
gdk_cairo_set_source_color (cr, &widget->style->light[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
g_snprintf (buf, sizeof (buf), "%d", frame->number);
......
......@@ -286,6 +286,7 @@ gimp_component_editor_set_view_size (GimpComponentEditor *editor,
gint view_size)
{
GtkWidget *tree_widget;
GtkStyle *tree_style;
GtkIconSize icon_size;
GtkTreeIter iter;
gboolean iter_valid;
......@@ -295,14 +296,15 @@ gimp_component_editor_set_view_size (GimpComponentEditor *editor,
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
tree_widget = GTK_WIDGET (editor->view);
tree_style = gtk_widget_get_style (tree_widget);
icon_size = gimp_get_icon_size (tree_widget,
GIMP_STOCK_VISIBLE,
GTK_ICON_SIZE_BUTTON,
view_size -
2 * tree_widget->style->xthickness,
2 * tree_style->xthickness,
view_size -
2 * tree_widget->style->ythickness);
2 * tree_style->ythickness);
g_object_set (editor->eye_cell,
"stock-size", icon_size,
......
......@@ -106,6 +106,7 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
{
GimpContainerView *view;
GtkScrolledWindowClass *sw_class;
GtkStyle *sw_style;
GtkRequisition req;
gint view_size;
gint scrollbar_width;
......@@ -134,11 +135,12 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
&req);
scrollbar_width += req.width;
border_x = GTK_CONTAINER (box)->border_width;
border_y = GTK_CONTAINER (box)->border_width;
border_x = border_y = gtk_container_get_border_width (GTK_CONTAINER (box));
border_x += box->scrolled_win->style->xthickness * 2 + scrollbar_width;
border_y += box->scrolled_win->style->ythickness * 2;
sw_style = gtk_widget_get_style (box->scrolled_win);
border_x += sw_style->xthickness * 2 + scrollbar_width;
border_y += sw_style->ythickness * 2;
gtk_widget_set_size_request (box->scrolled_win,
width > 0 ? width + border_x : -1,
......
......@@ -179,6 +179,7 @@ static void
gimp_container_grid_view_init (GimpContainerGridView *grid_view)
{
GimpContainerBox *box = GIMP_CONTAINER_BOX (grid_view);
GtkWidget *viewport;
grid_view->rows = 1;
grid_view->columns = 1;
......@@ -195,14 +196,14 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
grid_view->wrap_box = gtk_hwrap_box_new (FALSE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (box->scrolled_win),
grid_view->wrap_box);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (grid_view->wrap_box->parent),
GTK_SHADOW_NONE);
viewport = gtk_widget_get_parent (grid_view->wrap_box);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
gtk_widget_show (grid_view->wrap_box);
g_signal_connect (grid_view->wrap_box->parent, "size-allocate",
g_signal_connect (viewport, "size-allocate",
G_CALLBACK (gimp_container_grid_view_viewport_resized),
grid_view);
g_signal_connect (grid_view->wrap_box->parent, "button-press-event",
g_signal_connect (viewport, "button-press-event",
G_CALLBACK (gimp_container_grid_view_button_press),
grid_view);
......@@ -374,8 +375,10 @@ gimp_container_grid_view_menu_position (GtkMenu *menu,
}
else
{
*x += widget->style->xthickness;
*y += widget->style->ythickness;
GtkStyle *style = gtk_widget_get_style (widget);
*x += style->xthickness;
*y += style->ythickness;
}
gimp_menu_position (menu, x, y);
......
......@@ -588,7 +588,7 @@ static void
gimp_container_popup_view_type_toggled (GtkWidget *button,
GimpContainerPopup *popup)
{
if (GTK_TOGGLE_BUTTON (button)->active)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
GimpViewType view_type;
......
......@@ -350,8 +350,10 @@ gimp_container_tree_view_menu_position (GtkMenu *menu,
}
else
{
*x += widget->style->xthickness;
*y += widget->style->ythickness;
GtkStyle *style = gtk_widget_get_style (widget);
*x += style->xthickness;
*y += style->ythickness;
}
gimp_menu_position (menu, x, y);
......@@ -761,13 +763,15 @@ gimp_container_tree_view_set_view_size (GimpContainerView *view)
if (stock_id)
{
GtkStyle *style = gtk_widget_get_style (tree_widget);
icon_size = gimp_get_icon_size (tree_widget,
stock_id,
GTK_ICON_SIZE_BUTTON,
view_size -
2 * tree_widget->style->xthickness,
2 * style->xthickness,
view_size -
2 * tree_widget->style->ythickness);
2 * style->ythickness);
g_object_set (list->data, "stock-size", icon_size, NULL);
......
......@@ -339,7 +339,7 @@ gimp_curve_view_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GtkStyle *style = widget->style;
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr;
gint border;
gint width;
......
......@@ -238,6 +238,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GimpDashEditor *editor = GIMP_DASH_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr = gdk_cairo_create (widget->window);
gint x;
gint w, h;
......@@ -249,7 +250,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
/* draw the background */
gdk_cairo_set_source_color (cr, &widget->style->base[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
cairo_paint (cr);
w = editor->block_width;
......@@ -273,7 +274,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
cairo_rectangle (cr, x, editor->y0, w, h);
}
gdk_cairo_set_source_color (cr, &widget->style->text_aa[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->text_aa[GTK_STATE_NORMAL]);
cairo_fill (cr);
for (; x < editor->x0 + editor->n_segments * w; x += w)
......@@ -284,7 +285,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
cairo_rectangle (cr, x, editor->y0, w, h);
}
gdk_cairo_set_source_color (cr, &widget->style->text[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
cairo_fill (cr);
for (; x < widget->allocation.width + w; x += w)
......@@ -295,7 +296,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
cairo_rectangle (cr, x, editor->y0, w, h);
}
gdk_cairo_set_source_color (cr, &widget->style->text_aa[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->text_aa[GTK_STATE_NORMAL]);
cairo_fill (cr);
/* draw rulers */
......@@ -330,7 +331,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
cairo_move_to (cr, editor->x0 - 0.5, editor->y0 - 1);
cairo_move_to (cr, editor->x0 - 0.5, editor->y0 + h);
gdk_cairo_set_source_color (cr, &widget->style->text_aa[GTK_STATE_NORMAL]);
gdk_cairo_set_source_color (cr, &style->text_aa[GTK_STATE_NORMAL]);
cairo_set_line_width (cr, 1.0);
cairo_stroke (cr);
......
......@@ -158,8 +158,10 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
tree_view = GIMP_CONTAINER_TREE_VIEW (editor->view);
tree_view->name_cell->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
GTK_CELL_RENDERER_TEXT (tree_view->name_cell)->editable = TRUE;
g_object_set (tree_view->name_cell,
"mode", GTK_CELL_RENDERER_MODE_EDITABLE,
"editable", TRUE,
NULL);
tree_view->editable_cells = g_list_prepend (tree_view->editable_cells,
tree_view->name_cell);
......
......@@ -465,13 +465,13 @@ gimp_dock_add_book (GimpDock *dock,
else
old_book = g_list_nth_data (dock->dockbooks, index - 1);
parent = old_book->parent;
parent = gtk_widget_get_parent (old_book);
if ((old_length > 1) && (index > 0))
{
GtkWidget *grandparent;
grandparent = parent->parent;
grandparent = gtk_widget_get_parent (parent);
old_book = parent;
parent = grandparent;
......@@ -553,8 +553,8 @@ gimp_dock_remove_book (GimpDock *dock,
GtkWidget *parent;
GtkWidget *grandparent;
parent = GTK_WIDGET (dockbook)->parent;
grandparent = parent->parent;
parent = gtk_widget_get_parent (GTK_WIDGET (dockbook));
grandparent = gtk_widget_get_parent (parent);
if (index == 0)
other_book = gtk_paned_get_child2 (GTK_PANED (parent));
......
......@@ -312,9 +312,12 @@ gimp_dockable_size_request (GtkWidget *widget,
GimpDockable *dockable = GIMP_DOCKABLE (widget);
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
GtkRequisition child_requisition;
gint border_width;
requisition->width = container->border_width * 2;
requisition->height = container->border_width * 2;
border_width = gtk_container_get_border_width (container);
requisition->width = border_width * 2;
requisition->height = border_width * 2;
if (dockable->menu_button && GTK_WIDGET_VISIBLE (dockable->menu_button))
{
......@@ -345,9 +348,12 @@ gimp_dockable_size_allocate (GtkWidget *widget,
GtkRequisition button_requisition = { 0, };
GtkAllocation child_allocation;
gint border_width;
widget->allocation = *allocation;
border_width = gtk_container_get_border_width (container);
if (dockable->menu_button && GTK_WIDGET_VISIBLE (dockable->menu_button))
{
gtk_widget_size_request (dockable->menu_button, &button_requisition);
......@@ -355,12 +361,12 @@ gimp_dockable_size_allocate (GtkWidget *widget,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
child_allocation.x = (allocation->x +
allocation->width -
container->border_width -
border_width -
button_requisition.width);
else
child_allocation.x = allocation->x + container->border_width;
child_allocation.x = allocation->x + border_width;
child_allocation.y = allocation->y + container->border_width;
child_allocation.y = allocation->y + border_width;
child_allocation.width = button_requisition.width;
child_allocation.height = button_requisition.height;
......@@ -369,13 +375,13 @@ gimp_dockable_size_allocate (GtkWidget *widget,
if (child && GTK_WIDGET_VISIBLE (child))
{
child_allocation.x = allocation->x + container->border_width;
child_allocation.y = allocation->y + container->border_width;
child_allocation.x = allocation->x + border_width;
child_allocation.y = allocation->y + border_width;
child_allocation.width = MAX (allocation->width -
container->border_width * 2,
border_width * 2,
0);
child_allocation.height = MAX (allocation->height -
container->border_width * 2 -
border_width * 2 -
button_requisition.height,
0);
......@@ -541,6 +547,7 @@ gimp_dockable_expose_event (GtkWidget *widget,
if (GTK_WIDGET_DRAWABLE (widget))
{
GimpDockable *dockable = GIMP_DOCKABLE (widget);
GtkStyle *style = gtk_widget_get_style (widget);
GdkRectangle title_area;
GdkRectangle expose_area;
......@@ -555,7 +562,7 @@ gimp_dockable_expose_event (GtkWidget *widget,
if (dockable->blink_counter & 1)
{
gtk_paint_box (widget->style, widget->window,
gtk_paint_box (style, widget->window,
GTK_STATE_SELECTED, GTK_SHADOW_NONE,
&expose_area, widget, "",
title_area.x, title_area.y,
......@@ -583,7 +590,7 @@ gimp_dockable_expose_event (GtkWidget *widget,
text_y = title_area.y + (title_area.height - layout_height) / 2;
gtk_paint_layout (widget->style, widget->window,
gtk_paint_layout (style, widget->window,
(dockable->blink_counter & 1) ?
GTK_STATE_SELECTED : widget->state, TRUE,
&expose_area, widget, NULL,
......@@ -1062,7 +1069,7 @@ gimp_dockable_get_title_area (GimpDockable *dockable,
GdkRectangle *area)
{
GtkWidget *widget = GTK_WIDGET (dockable);
gint border = GTK_CONTAINER (dockable)->border_width;
gint border = gtk_container_get_border_width (GTK_CONTAINER (dockable));
area->x = widget->allocation.x + border;
area->y = widget->allocation.y + border;
......
......@@ -196,13 +196,16 @@ gimp_dock_separator_drag_drop (GtkWidget *widget,
if (dockable)
{
GtkWidget *dockbook;
GtkWidget *parent;
GList *children;
gint index;
g_object_set_data (G_OBJECT (dockable),
"gimp-dock-drag-widget", NULL);
children = gtk_container_get_children (GTK_CONTAINER (widget->parent));
parent = gtk_widget_get_parent (widget);
children = gtk_container_get_children (GTK_CONTAINER (parent));
index = g_list_index (children, widget);
g_list_free (children);
......
......@@ -286,6 +286,7 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
GdkEventExpose *eevent)
{
GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
gint width, height;
gint default_w, default_h;
gint swap_w, swap_h;
......@@ -348,14 +349,14 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
gimp_context_get_background (editor->context, &color);
gimp_fg_bg_editor_draw_rect (editor,
widget->window,
widget->style->fg_gc[0],
style->fg_gc[0],
(width - rect_w),
(height - rect_h),
rect_w, rect_h,
&color);
}
gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
gtk_paint_shadow (style, widget->window, GTK_STATE_NORMAL,
editor->active_color == GIMP_ACTIVE_COLOR_FOREGROUND ?
GTK_SHADOW_OUT : GTK_SHADOW_IN,
NULL, widget, NULL,
......@@ -371,13 +372,13 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
gimp_context_get_foreground (editor->context, &color);
gimp_fg_bg_editor_draw_rect (editor,
widget->window,
widget->style->fg_gc[0],
style->fg_gc[0],
0, 0,
rect_w, rect_h,
&color);
}
gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
gtk_paint_shadow (style, widget->window, GTK_STATE_NORMAL,
editor->active_color == GIMP_ACTIVE_COLOR_BACKGROUND ?
GTK_SHADOW_OUT : GTK_SHADOW_IN,
NULL, widget, NULL,
......
......@@ -206,7 +206,8 @@ static gboolean
gimp_fg_bg_view_expose (GtkWidget *widget,
GdkEventExpose *eevent)
{
GimpFgBgView *view = GIMP_FG_BG_VIEW (widget);
GimpFgBgView *view = GIMP_FG_BG_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget);
gint x, y;
gint width, height;
gint rect_w, rect_h;
......@@ -230,14 +231,14 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
gimp_context_get_background (view->context, &color);
gimp_fg_bg_view_draw_rect (view,
widget->window,
widget->style->fg_gc[0],
style->fg_gc[0],
x + width - rect_w + 1,
y + height - rect_h + 1,
rect_w - 2, rect_h - 2,
&color);
}
gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
gtk_paint_shadow (style, widget->window, GTK_STATE_NORMAL,
GTK_SHADOW_IN,
NULL, widget, NULL,
x + width - rect_w, y + height - rect_h, rect_w, rect_h);
......@@ -249,13 +250,13 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
gimp_context_get_foreground (view->context, &color);
gimp_fg_bg_view_draw_rect (view,
widget->window,
widget->style->fg_gc[0],
style->fg_gc[0],
x + 1, y + 1,
rect_w - 2, rect_h - 2,
&color);
}
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, rect_w, rect_h);
......
......@@ -798,7 +798,7 @@ static void
gradient_editor_instant_update_update (GtkWidget *widget,
GimpGradientEditor *editor)
{
if (GTK_TOGGLE_BUTTON (widget)->active)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
editor->instant_update = TRUE;
gtk_range_set_update_policy (GTK_RANGE (editor->scrollbar),
......@@ -1746,6 +1746,7 @@ control_draw (GimpGradientEditor *editor,
gdouble left,
gdouble right)
{
GtkStyle *control_style;
GimpGradientSegment *seg;
GradientEditorDragMode handle;
gint sel_l;
......@@ -1758,16 +1759,18 @@ control_draw (GimpGradientEditor *editor,
/* Draw selection */
control_style = gtk_widget_get_style (editor->control);
sel_l = control_calc_p_pos (editor, editor->control_sel_l->left);
sel_r = control_calc_p_pos (editor, editor->control_sel_r->right);
gdk_cairo_set_source_color (cr,
&editor->control->style->base[GTK_STATE_NORMAL]);
&control_style->base[GTK_STATE_NORMAL]);
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
gdk_cairo_set_source_color (cr,
&editor->control->style->base[GTK_STATE_SELECTED]);
&control_style->base[GTK_STATE_SELECTED]);
cairo_rectangle (cr, sel_l, 0, sel_r - sel_l + 1, height);
cairo_fill (cr);
......@@ -1835,11 +1838,12 @@ control_draw_normal_handle (GimpGradientEditor *editor,
gint height,
gboolean selected)
{
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
GtkStyle *style = gtk_widget_get_style (editor->control);
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
control_draw_handle (cr,
&editor->control->style->text_aa[state],
&editor->control->style->black,
&style->text_aa[state],
&style->black,
control_calc_p_pos (editor, pos), height);
}
......@@ -1850,11 +1854,12 @@ control_draw_middle_handle (GimpGradientEditor *editor,
gint height,
gboolean selected)
{
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
GtkStyle *style = gtk_widget_get_style (editor->control);
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
control_draw_handle (cr,
&editor->control->style->text_aa[state],
&editor->control->style->white,
&style->text_aa[state],
&style->white,
control_calc_p_pos (editor, pos), height);