app: port one more file to GSEAL_ENABLE

Use accessors instad of widget->parent and widget->allocation
This commit is contained in:
Michael Natterer
2010-01-16 11:23:53 +01:00
parent 038ea9474d
commit fa6fc65fbf

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -535,10 +533,15 @@ gimp_palette_editor_zoom (GimpPaletteEditor *editor,
case GIMP_ZOOM_OUT_MAX: case GIMP_ZOOM_OUT_MAX:
case GIMP_ZOOM_TO: /* abused as ZOOM_ALL */ case GIMP_ZOOM_TO: /* abused as ZOOM_ALL */
{ {
gint height = editor->view->parent->parent->parent->allocation.height; GtkWidget *scrolled_win = GIMP_DATA_EDITOR (editor)->view;
gint columns = palette->n_columns ? palette->n_columns : COLUMNS; GtkWidget *viewport = gtk_bin_get_child (GTK_BIN (scrolled_win));
GtkAllocation allocation;
gint columns;
gint rows; gint rows;
gtk_widget_get_allocation (viewport, &allocation);
columns = palette->n_columns ? palette->n_columns : COLUMNS;
rows = palette->n_colors / columns; rows = palette->n_colors / columns;
if (palette->n_colors % columns) if (palette->n_colors % columns)
@ -546,7 +549,7 @@ gimp_palette_editor_zoom (GimpPaletteEditor *editor,
rows = MAX (1, rows); rows = MAX (1, rows);
zoom_factor = (((gdouble) height - 2 * SPACING) / zoom_factor = (((gdouble) allocation.height - 2 * SPACING) /
(gdouble) rows - SPACING) / ENTRY_HEIGHT; (gdouble) rows - SPACING) / ENTRY_HEIGHT;
} }
break; break;
@ -651,9 +654,9 @@ palette_editor_viewport_size_allocate (GtkWidget *widget,
GtkAllocation *allocation, GtkAllocation *allocation,
GimpPaletteEditor *editor) GimpPaletteEditor *editor)
{ {
if (widget->allocation.width != editor->last_width) if (allocation->width != editor->last_width)
{ {
palette_editor_resize (editor, widget->allocation.width, palette_editor_resize (editor, allocation->width,
editor->zoom_factor); editor->zoom_factor);
} }
} }