[patch] fix eel-wrap-table size
- From: Jan Arne Petersen <jpetersen gnome-de org>
- To: "nautilus-list [ML]" <nautilus-list gnome org>
- Subject: [patch] fix eel-wrap-table size
- Date: 02 Nov 2002 17:30:04 +0100
Hi,
this patch fixes the wrong requested size (too long scrollbar) of
eel-wrap-tables.
Jan Arne Petersen
Index: eel-wrap-table.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-wrap-table.c,v
retrieving revision 1.18
diff -u -r1.18 eel-wrap-table.c
--- eel-wrap-table.c 22 Mar 2002 13:20:00 -0000 1.18
+++ eel-wrap-table.c 2 Nov 2002 16:27:49 -0000
@@ -56,6 +56,7 @@
GList *children;
gboolean is_scrolled : 1;
+ guint cols;
};
static void eel_wrap_table_class_init (EelWrapTableClass *wrap_table_class);
@@ -79,6 +80,7 @@
GtkAllocation *allocation);
static void eel_wrap_table_map (GtkWidget *widget);
static void eel_wrap_table_unmap (GtkWidget *widget);
+static void eel_wrap_table_realize (GtkWidget *widget);
/* GtkContainerClass methods */
static void eel_wrap_table_add (GtkContainer *container,
@@ -129,6 +131,7 @@
widget_class->expose_event = eel_wrap_table_expose_event;
widget_class->map = eel_wrap_table_map;
widget_class->unmap = eel_wrap_table_unmap;
+ widget_class->realize = eel_wrap_table_realize;
/* GtkContainerClass */
container_class->add = eel_wrap_table_add;
@@ -183,6 +186,7 @@
wrap_table->details = g_new0 (EelWrapTableDetails, 1);
wrap_table->details->x_justification = EEL_JUSTIFICATION_BEGINNING;
wrap_table->details->y_justification = EEL_JUSTIFICATION_END;
+ wrap_table->details->cols = 1;
}
static void
@@ -383,6 +387,16 @@
}
}
+static void
+eel_wrap_table_realize (GtkWidget *widget)
+{
+ g_return_if_fail (EEL_IS_WRAP_TABLE (widget));
+
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+ gtk_widget_queue_resize (widget);
+}
+
/* GtkContainerClass methods */
static void
eel_wrap_table_add (GtkContainer *container,
@@ -476,6 +490,23 @@
}
/* Private EelWrapTable methods */
+static int
+wrap_table_get_num_fitting (int available,
+ int spacing,
+ int max_child_size)
+{
+ int num;
+
+ g_return_val_if_fail (available >= 0, 0);
+ g_return_val_if_fail (max_child_size > 0, 0);
+ g_return_val_if_fail (spacing >= 0, 0);
+
+ num = (available + spacing) / (max_child_size + spacing);
+ num = MAX (num, 1);
+
+ return num;
+}
+
static void
wrap_table_layout (EelWrapTable *wrap_table)
{
@@ -483,6 +514,7 @@
EelArtIPoint pos;
EelDimensions max_child_dimensions;
ArtIRect content_bounds;
+ guint num_cols;
g_return_if_fail (EEL_IS_WRAP_TABLE (wrap_table));
@@ -491,6 +523,15 @@
pos.x = content_bounds.x0;
pos.y = content_bounds.y0;
+ num_cols = wrap_table_get_num_fitting (GTK_WIDGET (wrap_table)->allocation.width,
+ wrap_table->details->x_spacing,
+ max_child_dimensions.width);
+ if (num_cols != wrap_table->details->cols) {
+ wrap_table->details->cols = num_cols;
+ gtk_widget_queue_resize (GTK_WIDGET (wrap_table));
+ return;
+ }
+
for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) {
GtkWidget *item;
@@ -607,23 +648,6 @@
}
return max_dimensions;
-}
-
-static int
-wrap_table_get_num_fitting (int available,
- int spacing,
- int max_child_size)
-{
- int num;
-
- g_return_val_if_fail (available >= 0, 0);
- g_return_val_if_fail (max_child_size > 0, 0);
- g_return_val_if_fail (spacing >= 0, 0);
-
- num = (available + spacing) / (max_child_size + spacing);
- num = MAX (num, 1);
-
- return num;
}
static EelDimensions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]