aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/e-table/ChangeLog7
-rw-r--r--widgets/e-table/e-table-header-item.c4
-rw-r--r--widgets/e-table/e-table.c33
-rw-r--r--widgets/e-table/table-test.c2
-rw-r--r--widgets/e-table/test-table.c8
-rw-r--r--widgets/table/e-table-header-item.c4
-rw-r--r--widgets/table/e-table.c33
-rw-r--r--widgets/table/table-test.c2
-rw-r--r--widgets/table/test-table.c8
9 files changed, 67 insertions, 34 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 58dc500e8d..2796a1033a 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,10 @@
+2000-02-07 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table.c (e_table_setup_table): Setup the scroll region of the
+ table canvas on size allocation.
+ (e_table_canvas_realize): Do not set the scrollregion here.
+ (e_table_canvas_init): Move root initialization here.
+
2000-01-30 Miguel de Icaza <miguel@gnu.org>
* e-table-simple.c (e_table_simple_new): Add data field back in.
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
index 5f23f06fa3..e8f73fc432 100644
--- a/widgets/e-table/e-table-header-item.c
+++ b/widgets/e-table/e-table-header-item.c
@@ -364,8 +364,10 @@ ethi_realize (GnomeCanvasItem *item)
ethi->normal_cursor = gdk_cursor_new (GDK_ARROW);
- if (!ethi->font)
+ if (!ethi->font){
+ g_warning ("Font had not been set for this ETableHeader");
ethi_font_load (ethi, "fixed");
+ }
/*
* Now, configure DnD
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index a42aaf111b..c9a85b87b6 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -434,23 +434,11 @@ e_table_canvas_realize (GtkWidget *widget)
groups = group_spec_to_desc (e_table->group_spec);
- e_table->root = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (e_table->table_canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0.0,
- "y", 0.0,
- NULL);
-
leaf = e_table_create_nodes (
e_table, e_table->model,
e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table_canvas),
- 0, 0,
- e_table_header_total_width (e_table->header) + 200,
- leaf_height (leaf));
-
+
if (groups)
g_free (groups);
}
@@ -482,6 +470,14 @@ static void
e_table_canvas_init (GtkObject *canvas)
{
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
+
+ e_table->root = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (e_table->table_canvas->root),
+ gnome_canvas_group_get_type (),
+ "x", 0.0,
+ "y", 0.0,
+ NULL);
+
}
GtkType e_table_canvas_get_type (void);
@@ -501,9 +497,20 @@ e_table_canvas_new (ETable *e_table)
}
static void
+table_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
+{
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_table->table_canvas),
+ 0, 0, alloc->width, alloc->height);
+}
+
+static void
e_table_setup_table (ETable *e_table)
{
e_table->table_canvas = e_table_canvas_new (e_table);
+ gtk_signal_connect (
+ GTK_OBJECT (e_table->table_canvas), "size_allocate",
+ GTK_SIGNAL_FUNC (table_canvas_size_alocate), e_table);
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
gtk_table_attach (
diff --git a/widgets/e-table/table-test.c b/widgets/e-table/table-test.c
index e18f38c5ec..3009297906 100644
--- a/widgets/e-table/table-test.c
+++ b/widgets/e-table/table-test.c
@@ -31,9 +31,11 @@ main (int argc, char *argv [])
gnome_init ("TableTest", "TableTest", argc, argv);
e_cursors_init ();
+#if 0
table_browser_test ();
multi_cols_test ();
check_test ();
+#endif
e_table_test ();
gtk_main ();
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
index 053f81cfa6..428bb52c52 100644
--- a/widgets/e-table/test-table.c
+++ b/widgets/e-table/test-table.c
@@ -255,7 +255,7 @@ table_browser_test (void)
static void
do_e_table_demo (const char *col_spec, const char *group_spec)
{
- GtkWidget *e_table, *window;
+ GtkWidget *e_table, *window, *frame;
ETableModel *e_table_model;
ECell *cell_left_just;
ETableHeader *full_header;
@@ -282,12 +282,14 @@ do_e_table_demo (const char *col_spec, const char *group_spec)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ frame = gtk_frame_new (NULL);
e_table = e_table_new (full_header, e_table_model, col_spec, group_spec);
-
- gtk_container_add (GTK_CONTAINER (window), e_table);
+ gtk_container_add (GTK_CONTAINER (frame), e_table);
+ gtk_container_add (GTK_CONTAINER (window), frame);
gtk_widget_set_usize (window, 200, 200);
gtk_widget_show (e_table);
+ gtk_widget_show (frame);
gtk_widget_show (window);
}
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 5f23f06fa3..e8f73fc432 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -364,8 +364,10 @@ ethi_realize (GnomeCanvasItem *item)
ethi->normal_cursor = gdk_cursor_new (GDK_ARROW);
- if (!ethi->font)
+ if (!ethi->font){
+ g_warning ("Font had not been set for this ETableHeader");
ethi_font_load (ethi, "fixed");
+ }
/*
* Now, configure DnD
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index a42aaf111b..c9a85b87b6 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -434,23 +434,11 @@ e_table_canvas_realize (GtkWidget *widget)
groups = group_spec_to_desc (e_table->group_spec);
- e_table->root = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (e_table->table_canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0.0,
- "y", 0.0,
- NULL);
-
leaf = e_table_create_nodes (
e_table, e_table->model,
e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table_canvas),
- 0, 0,
- e_table_header_total_width (e_table->header) + 200,
- leaf_height (leaf));
-
+
if (groups)
g_free (groups);
}
@@ -482,6 +470,14 @@ static void
e_table_canvas_init (GtkObject *canvas)
{
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
+
+ e_table->root = gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP (e_table->table_canvas->root),
+ gnome_canvas_group_get_type (),
+ "x", 0.0,
+ "y", 0.0,
+ NULL);
+
}
GtkType e_table_canvas_get_type (void);
@@ -501,9 +497,20 @@ e_table_canvas_new (ETable *e_table)
}
static void
+table_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
+{
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (e_table->table_canvas),
+ 0, 0, alloc->width, alloc->height);
+}
+
+static void
e_table_setup_table (ETable *e_table)
{
e_table->table_canvas = e_table_canvas_new (e_table);
+ gtk_signal_connect (
+ GTK_OBJECT (e_table->table_canvas), "size_allocate",
+ GTK_SIGNAL_FUNC (table_canvas_size_alocate), e_table);
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
gtk_table_attach (
diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c
index e18f38c5ec..3009297906 100644
--- a/widgets/table/table-test.c
+++ b/widgets/table/table-test.c
@@ -31,9 +31,11 @@ main (int argc, char *argv [])
gnome_init ("TableTest", "TableTest", argc, argv);
e_cursors_init ();
+#if 0
table_browser_test ();
multi_cols_test ();
check_test ();
+#endif
e_table_test ();
gtk_main ();
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
index 053f81cfa6..428bb52c52 100644
--- a/widgets/table/test-table.c
+++ b/widgets/table/test-table.c
@@ -255,7 +255,7 @@ table_browser_test (void)
static void
do_e_table_demo (const char *col_spec, const char *group_spec)
{
- GtkWidget *e_table, *window;
+ GtkWidget *e_table, *window, *frame;
ETableModel *e_table_model;
ECell *cell_left_just;
ETableHeader *full_header;
@@ -282,12 +282,14 @@ do_e_table_demo (const char *col_spec, const char *group_spec)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ frame = gtk_frame_new (NULL);
e_table = e_table_new (full_header, e_table_model, col_spec, group_spec);
-
- gtk_container_add (GTK_CONTAINER (window), e_table);
+ gtk_container_add (GTK_CONTAINER (frame), e_table);
+ gtk_container_add (GTK_CONTAINER (window), frame);
gtk_widget_set_usize (window, 200, 200);
gtk_widget_show (e_table);
+ gtk_widget_show (frame);
gtk_widget_show (window);
}