[gimp] app: port one more file to GSEAL_ENABLE
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: port one more file to GSEAL_ENABLE
- Date: Sat, 16 Jan 2010 10:26:01 +0000 (UTC)
commit fa6fc65fbf9016161e3e6b6ccbfd9561258ead20
Author: Michael Natterer <mitch gimp org>
Date: Sat Jan 16 11:23:53 2010 +0100
app: port one more file to GSEAL_ENABLE
Use accessors instad of widget->parent and widget->allocation
app/widgets/gimppaletteeditor.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c
index 9b984fe..1faee0d 100644
--- a/app/widgets/gimppaletteeditor.c
+++ b/app/widgets/gimppaletteeditor.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gtk/gtk.h>
@@ -535,18 +533,23 @@ gimp_palette_editor_zoom (GimpPaletteEditor *editor,
case GIMP_ZOOM_OUT_MAX:
case GIMP_ZOOM_TO: /* abused as ZOOM_ALL */
{
- gint height = editor->view->parent->parent->parent->allocation.height;
- gint columns = palette->n_columns ? palette->n_columns : COLUMNS;
- gint rows;
+ GtkWidget *scrolled_win = GIMP_DATA_EDITOR (editor)->view;
+ GtkWidget *viewport = gtk_bin_get_child (GTK_BIN (scrolled_win));
+ GtkAllocation allocation;
+ gint columns;
+ gint rows;
+
+ gtk_widget_get_allocation (viewport, &allocation);
- rows = palette->n_colors / columns;
+ columns = palette->n_columns ? palette->n_columns : COLUMNS;
+ rows = palette->n_colors / columns;
if (palette->n_colors % columns)
rows += 1;
rows = MAX (1, rows);
- zoom_factor = (((gdouble) height - 2 * SPACING) /
+ zoom_factor = (((gdouble) allocation.height - 2 * SPACING) /
(gdouble) rows - SPACING) / ENTRY_HEIGHT;
}
break;
@@ -651,9 +654,9 @@ palette_editor_viewport_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]