generic-poky/openembedded/packages/gtk+/gtk+-2.6.4-1.osso7/gtktable.c.diff

96 lines
2.6 KiB
Diff

--- gtk+-2.6.4/gtk/gtktable.c 2004-08-09 19:59:52.000000000 +0300
+++ gtk+-2.6.4/gtk/gtktable.c 2005-04-06 16:19:37.974765320 +0300
@@ -28,6 +28,7 @@
#include "gtkalias.h"
#include "gtktable.h"
#include "gtkintl.h"
+#include "gtkbutton.h"
enum
{
@@ -507,6 +508,33 @@
return GTK_WIDGET (table);
}
+void osso_gtk_table_find_button_detail (GtkTable *table,
+ GtkTableChild *table_child)
+{
+ OssoGtkButtonAttachFlags attachflags = 0;
+ gboolean automatic_detail;
+
+ g_return_if_fail (GTK_IS_TABLE (table));
+ g_return_if_fail (table_child != NULL);
+ g_return_if_fail (GTK_IS_BUTTON (table_child->widget));
+
+ if (table_child->top_attach == 0)
+ attachflags |= OSSO_GTK_BUTTON_ATTACH_NORTH;
+
+ if (table_child->bottom_attach == table->nrows)
+ attachflags |= OSSO_GTK_BUTTON_ATTACH_SOUTH;
+
+ if (table_child->left_attach == 0)
+ attachflags |= OSSO_GTK_BUTTON_ATTACH_WEST;
+
+ if (table_child->right_attach == table->ncols)
+ attachflags |= OSSO_GTK_BUTTON_ATTACH_EAST;
+
+ g_object_get (G_OBJECT (table_child->widget), "automatic_detail", &automatic_detail, NULL);
+ if (automatic_detail == TRUE)
+ g_object_set (G_OBJECT (table_child->widget), "detail", osso_gtk_button_attach_details[attachflags], NULL);
+}
+
void
gtk_table_resize (GtkTable *table,
guint n_rows,
@@ -523,6 +551,18 @@
n_cols != table->ncols)
{
GList *list;
+ guint recalc_column = -1;
+ guint recalc_row = -1;
+
+ if (n_rows > table->nrows)
+ recalc_row = table->nrows;
+ else
+ recalc_row = n_rows;
+
+ if (n_cols > table->ncols)
+ recalc_column = table->ncols;
+ else
+ recalc_column = n_cols;
for (list = table->children; list; list = list->next)
{
@@ -577,6 +617,20 @@
g_object_notify (G_OBJECT (table), "n_columns");
}
+
+ if ((recalc_column != -1) || (recalc_row != -1))
+ for (list = table->children; list; list = list->next)
+ {
+ GtkTableChild *child;
+
+ child = list->data;
+
+ if (GTK_IS_BUTTON (child->widget) &&
+ ((child->bottom_attach == recalc_row) ||
+ (child->right_attach == recalc_column)))
+
+ osso_gtk_table_find_button_detail (table, child);
+ }
}
}
@@ -623,6 +677,10 @@
table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
table_child->yfill = (yoptions & GTK_FILL) != 0;
table_child->ypadding = ypadding;
+
+
+ if (GTK_IS_BUTTON (table_child->widget))
+ osso_gtk_table_find_button_detail (table, table_child);
table->children = g_list_prepend (table->children, table_child);