app/actions/layers-commands.c app/actions/view-actions.c

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

	* app/actions/layers-commands.c
	* app/actions/view-actions.c
	* app/dialogs/about-dialog.c
	* app/dialogs/layer-options-dialog.c
	* app/dialogs/preferences-dialog.c
	* app/display/gimpcanvas.c
	* app/display/gimpdisplayshell-appearance.c
	* app/display/gimpnavigationeditor.c
	* modules/colorsel_water.c: use accessors instead of accessing
	members of GTK+ widgets directly.


svn path=/trunk/; revision=26006
This commit is contained in:
Michael Natterer
2008-06-28 15:12:13 +00:00
committed by Michael Natterer
parent 58cfcd4f57
commit 8c66ea4b19
10 changed files with 61 additions and 35 deletions

View File

@ -1,3 +1,16 @@
2008-06-28 Michael Natterer <mitch@gimp.org>
* app/actions/layers-commands.c
* app/actions/view-actions.c
* app/dialogs/about-dialog.c
* app/dialogs/layer-options-dialog.c
* app/dialogs/preferences-dialog.c
* app/display/gimpcanvas.c
* app/display/gimpdisplayshell-appearance.c
* app/display/gimpnavigationeditor.c
* modules/colorsel_water.c: use accessors instead of accessing
members of GTK+ widgets directly.
2008-06-28 Michael Natterer <mitch@gimp.org>
* libgimp/gimpgradientselectbutton.c

View File

@ -988,7 +988,7 @@ layers_edit_layer_response (GtkWidget *widget,
{
g_object_set (layer,
"auto-rename",
GTK_TOGGLE_BUTTON (dialog->rename_toggle)->active,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->rename_toggle)),
NULL);
}
}

View File

@ -633,11 +633,11 @@ view_actions_update (GimpActionGroup *group,
if (shell->canvas)
{
GimpRGB color;
GtkStyle *style = gtk_widget_get_style (shell->canvas);
GimpRGB color;
gtk_widget_ensure_style (shell->canvas);
gimp_rgb_set_gdk_color (&color,
shell->canvas->style->bg + GTK_STATE_NORMAL);
gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
gimp_rgb_set_alpha (&color, GIMP_OPACITY_OPAQUE);
SET_COLOR ("view-padding-color-theme", &color);

View File

@ -288,14 +288,15 @@ about_dialog_anim_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpAboutDialog *dialog)
{
GdkGC *text_gc;
gint x, y;
gint width, height;
GtkStyle *style = gtk_widget_get_style (widget);
GdkGC *text_gc;
gint x, y;
gint width, height;
if (! dialog->visible)
return FALSE;
text_gc = widget->style->text_gc[GTK_STATE_NORMAL];
text_gc = style->text_gc[GTK_STATE_NORMAL];
pango_layout_get_pixel_size (dialog->layout, &width, &height);
@ -366,6 +367,7 @@ decorate_text (GimpAboutDialog *dialog,
gint anim_type,
gdouble time)
{
GtkStyle *style = gtk_widget_get_style (dialog->anim_area);
const gchar *text;
const gchar *ptr;
gint letter_count = 0;
@ -379,8 +381,8 @@ decorate_text (GimpAboutDialog *dialog,
PangoRectangle lrect = {0, 0, 0, 0};
GdkColor mix;
mix_colors (dialog->anim_area->style->bg + GTK_STATE_NORMAL,
dialog->anim_area->style->fg + GTK_STATE_NORMAL, &mix, time);
mix_colors (style->bg + GTK_STATE_NORMAL,
style->fg + GTK_STATE_NORMAL, &mix, time);
text = pango_layout_get_text (dialog->layout);
g_return_if_fail (text != NULL);
@ -476,8 +478,8 @@ decorate_text (GimpAboutDialog *dialog,
else
pos = ((gdouble) (letter_count - border)) / 15;
mix_colors (dialog->anim_area->style->fg + GTK_STATE_NORMAL,
dialog->anim_area->style->bg + GTK_STATE_NORMAL,
mix_colors (style->fg + GTK_STATE_NORMAL,
style->bg + GTK_STATE_NORMAL,
&mix, pos);
ptr = g_utf8_next_char (ptr);

View File

@ -239,7 +239,7 @@ static void
layer_options_dialog_toggle_rename (GtkWidget *widget,
LayerOptionsDialog *options)
{
if (GTK_TOGGLE_BUTTON (widget)->active &&
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
gimp_drawable_is_text_layer (GIMP_DRAWABLE (options->layer)))
{
GimpTextLayer *text_layer = GIMP_TEXT_LAYER (options->layer);

View File

@ -437,7 +437,7 @@ prefs_resolution_source_callback (GtkWidget *widget,
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
from_gdk = GTK_TOGGLE_BUTTON (widget)->active;
from_gdk = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (from_gdk)
{

View File

@ -828,6 +828,7 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (canvas);
GtkStyle *style = gtk_widget_get_style (widget);
gdouble wilber_width;
gdouble wilber_height;
gdouble width;
@ -857,9 +858,9 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
widget->allocation.height / factor - wilber_height * 1.1);
cairo_set_source_rgba (cr,
widget->style->fg[widget->state].red / 65535.0,
widget->style->fg[widget->state].green / 65535.0,
widget->style->fg[widget->state].blue / 65535.0,
style->fg[widget->state].red / 65535.0,
style->fg[widget->state].green / 65535.0,
style->fg[widget->state].blue / 65535.0,
0.15);
cairo_fill (cr);
}

View File

@ -180,7 +180,7 @@ gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
g_object_set (options, "show-rulers", show, NULL);
table = GTK_TABLE (GTK_WIDGET (shell->canvas)->parent);
table = GTK_TABLE (gtk_widget_get_parent (GTK_WIDGET (shell->canvas)));
if (show)
{
@ -220,6 +220,7 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
GtkWidget *parent;
GtkBox *hbox;
GtkBox *vbox;
@ -229,8 +230,11 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
g_object_set (options, "show-scrollbars", show, NULL);
hbox = GTK_BOX (shell->vsb->parent->parent);
vbox = GTK_BOX (shell->hsb->parent->parent);
parent = gtk_widget_get_parent (shell->vsb);
hbox = GTK_BOX (gtk_widget_get_parent (parent));
parent = gtk_widget_get_parent (shell->hsb);
vbox = GTK_BOX (gtk_widget_get_parent (parent));
if (show)
{
@ -585,9 +589,13 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell,
case GIMP_CANVAS_PADDING_MODE_DEFAULT:
if (shell->canvas)
{
GtkStyle *style;
gtk_widget_ensure_style (shell->canvas);
gimp_rgb_set_gdk_color (&color,
shell->canvas->style->bg + GTK_STATE_NORMAL);
style = gtk_widget_get_style (shell->canvas);
gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
}
break;

View File

@ -220,6 +220,7 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
gint click_x,
gint click_y)
{
GtkStyle *style = gtk_widget_get_style (widget);
GimpNavigationEditor *editor;
GimpNavigationView *view;
GdkScreen *screen;
@ -271,12 +272,12 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
x = (x_org + click_x -
view->p_x -
0.5 * (view->p_width - BORDER_PEN_WIDTH) -
2 * widget->style->xthickness);
2 * style->xthickness);
y = (y_org + click_y -
view->p_y -
0.5 * (view->p_height - BORDER_PEN_WIDTH) -
2 * widget->style->ythickness);
2 * style->ythickness);
/* If the popup doesn't fit into the screen, we have a problem.
* We move the popup onscreen and risk that the pointer is not
@ -290,10 +291,10 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
x = CLAMP (x, 0, (gdk_screen_get_width (screen) -
GIMP_VIEW (view)->renderer->width -
4 * widget->style->xthickness));
4 * style->xthickness));
y = CLAMP (y, 0, (gdk_screen_get_height (screen) -
GIMP_VIEW (view)->renderer->height -
4 * widget->style->ythickness));
4 * style->ythickness));
gtk_window_move (GTK_WINDOW (shell->nav_popup), x, y);
gtk_widget_show (shell->nav_popup);

View File

@ -204,14 +204,15 @@ static void
select_area_expose (GtkWidget *widget,
GdkEventExpose *event)
{
gdouble width = widget->allocation.width;
gdouble height = widget->allocation.height;
gdouble dx = 1.0 / width;
gdouble dy = 1.0 / height;
guchar *buf = g_alloca (3 * event->area.width * event->area.height);
guchar *dest = buf;
gdouble y;
gint i, j;
GtkStyle *style = gtk_widget_get_style (widget);
gdouble width = widget->allocation.width;
gdouble height = widget->allocation.height;
gdouble dx = 1.0 / width;
gdouble dy = 1.0 / height;
guchar *buf = g_alloca (3 * event->area.width * event->area.height);
guchar *dest = buf;
gdouble y;
gint i, j;
for (j = 0, y = event->area.y / height; j < event->area.height; j++, y += dy)
{
@ -246,7 +247,7 @@ select_area_expose (GtkWidget *widget,
}
gdk_draw_rgb_image_dithalign (widget->window,
widget->style->fg_gc[widget->state],
style->fg_gc[widget->state],
event->area.x, event->area.y,
event->area.width, event->area.height,
GDK_RGB_DITHER_MAX,