diff options
author | Chris Lahey <clahey@src.gnome.org> | 2000-03-21 10:50:04 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-03-21 10:50:04 +0800 |
commit | 5fe5e0f7431c00d4438eaed35825cb6a33dbe05f (patch) | |
tree | 58d4d2c17a7f3459af6f0b33f3e84032cb8379d2 | |
parent | cd47194eb72fbe291bbd0a04e3aa174c60eb7961 (diff) | |
download | gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar.gz gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar.bz2 gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar.lz gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar.xz gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.tar.zst gsoc2013-evolution-5fe5e0f7431c00d4438eaed35825cb6a33dbe05f.zip |
i2000-03-20 Christopher James Lahey <clahey@helixcode.com>
* e-table-group-container.c, e-table-group-container.h,
e-table-group-leaf.c: Updated these to use the new ECanvas reflow
infrastructure.
* e-table-item.c, e-table-item.h: Updated these to use the new
ECanvas reflow infrastructure. Fixed the bounding box.
* e-table.c, e-table.h: Made the header have no extra space around it.
svn path=/trunk/; revision=2124
-rw-r--r-- | widgets/e-table/ChangeLog | 11 | ||||
-rw-r--r-- | widgets/e-table/e-table-group-container.c | 55 | ||||
-rw-r--r-- | widgets/e-table/e-table-group-container.h | 5 | ||||
-rw-r--r-- | widgets/e-table/e-table-group-leaf.c | 22 | ||||
-rw-r--r-- | widgets/e-table/e-table-group.c | 20 | ||||
-rw-r--r-- | widgets/e-table/e-table-group.h | 2 | ||||
-rw-r--r-- | widgets/e-table/e-table-item.c | 79 | ||||
-rw-r--r-- | widgets/e-table/e-table-item.h | 5 | ||||
-rw-r--r-- | widgets/e-table/e-table.c | 31 | ||||
-rw-r--r-- | widgets/e-table/e-table.h | 4 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.c | 55 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.h | 5 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 22 | ||||
-rw-r--r-- | widgets/table/e-table-group.c | 20 | ||||
-rw-r--r-- | widgets/table/e-table-group.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 79 | ||||
-rw-r--r-- | widgets/table/e-table-item.h | 5 | ||||
-rw-r--r-- | widgets/table/e-table.c | 31 | ||||
-rw-r--r-- | widgets/table/e-table.h | 4 |
19 files changed, 183 insertions, 274 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index ad3b798140..6b281a5964 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,14 @@ +2000-03-20 Christopher James Lahey <clahey@helixcode.com> + + * e-table-group-container.c, e-table-group-container.h, + e-table-group-leaf.c, e-table-group.c, e-table-group.h: Updated + these to use the new ECanvas reflow infrastructure. + + * e-table-item.c, e-table-item.h: Updated these to use the new + ECanvas reflow infrastructure. Fixed the bounding box. + + * e-table.c, e-table.h: Made the header have no extra space around it. + 2000-03-19 Christopher James Lahey <clahey@helixcode.com> * e-table-header.c: Fixed a crashing bug when you close an diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c index 4f11c75f41..ebe832c29f 100644 --- a/widgets/e-table/e-table-group-container.c +++ b/widgets/e-table/e-table-group-container.c @@ -14,6 +14,7 @@ #include "e-table-item.h" #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" +#include "e-util/e-canvas.h" #include "e-util/e-canvas-utils.h" #include "widgets/e-text/e-text.h" @@ -47,9 +48,7 @@ static gboolean etgc_remove (ETableGroup *etg, gint row); static void etgc_increment (ETableGroup *etg, gint position, gint amount); static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col); -static void etgc_child_resize (GtkObject *object, gpointer data); - -static void etgc_queue_reposition (ETableGroupContainer *etgc); +static void etgc_reflow (GnomeCanvasItem *item, gint flags); typedef struct { ETableGroup *child; @@ -506,6 +505,8 @@ etgc_realize (GnomeCanvasItem *item) (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item); etgc = E_TABLE_GROUP_CONTAINER (item); + + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); } /* Unrealize handler for the etgc item */ @@ -580,9 +581,6 @@ static void etgc_add (ETableGroup *etg, gint row) GTK_SIGNAL_FUNC(child_row_selection), etgc); child_node->child = child; child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val); - - gtk_signal_connect(GTK_OBJECT(child), "resize", - etgc_child_resize, etgc); child_node->count = 1; e_table_group_add(child, row); if ( list ) { @@ -591,7 +589,7 @@ static void etgc_add (ETableGroup *etg, gint row) else etgc->children = g_list_append(etgc->children, child_node); compute_text(etgc, child_node); - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); } static gboolean etgc_remove (ETableGroup *etg, gint row) @@ -610,11 +608,11 @@ static gboolean etgc_remove (ETableGroup *etg, gint row) } else { compute_text(etgc, child_node); } + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); return TRUE; } } return FALSE; - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static void etgc_increment (ETableGroup *etg, gint position, gint amount) @@ -624,7 +622,6 @@ static void etgc_increment (ETableGroup *etg, gint position, gint amount) for ( ; list; list = g_list_next(list) ) { e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount); } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) @@ -637,7 +634,6 @@ static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col); } } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static gint @@ -659,7 +655,7 @@ etgc_get_focus_column (ETableGroup *etg) static void etgc_thaw (ETableGroup *etg) { - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etg)); } static void @@ -720,12 +716,16 @@ static void etgc_set_width (ETableGroup *etg, gdouble width) for ( ; list; list = g_list_next(list) ) { gdouble child_width = width - GROUP_INDENT; - gtk_object_set(GTK_OBJECT(((ETableGroupContainerChildNode *)list->data)->child), + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + gtk_object_set(GTK_OBJECT(child_node->child), "width", child_width, NULL); - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + gnome_canvas_item_set(GNOME_CANVAS_ITEM(child_node->rect), + "x1", (double) 0, + "x2", (double) etgc->width, + NULL); + } } static gdouble etgc_get_width (ETableGroup *etg) @@ -780,18 +780,21 @@ etgc_init (GtkObject *object) { ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); container->children = FALSE; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow); } -static gboolean -etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) +static void +etgc_reflow (GnomeCanvasItem *item, gint flags) { + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); gboolean frozen; gtk_object_get(GTK_OBJECT(etgc), "frozen", &frozen, NULL); if ( frozen ) { etgc->idle = 0; - return FALSE; + return; } if ( GTK_OBJECT_FLAGS( etgc ) & GNOME_CANVAS_ITEM_REALIZED ) { gdouble old_height; @@ -840,27 +843,11 @@ etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) running_height -= extra_height; if ( running_height != old_height) { etgc->height = running_height; - gtk_signal_emit_by_name (GTK_OBJECT (etgc), "resize"); + e_canvas_item_request_parent_reflow(item); } } } etgc->idle = 0; - return FALSE; -} - -static void -etgc_queue_reposition (ETableGroupContainer *etgc) -{ - if (etgc->idle == 0) - etgc->idle = g_idle_add((GSourceFunc)etgc_update_positioning, etgc); -} - -static void -etgc_child_resize (GtkObject *object, gpointer data) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(data); - etgc_queue_reposition (etgc); } E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); - diff --git a/widgets/e-table/e-table-group-container.h b/widgets/e-table/e-table-group-container.h index 2234e77ac1..4070624456 100644 --- a/widgets/e-table/e-table-group-container.h +++ b/widgets/e-table/e-table-group-container.h @@ -41,11 +41,6 @@ typedef struct { gint idle; /* - * Update booleans: - */ - guint need_resize : 1; - - /* * State: the ETableGroup is open or closed */ guint open:1; diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c index 9d5f858c16..1746d4f075 100644 --- a/widgets/e-table/e-table-group-leaf.c +++ b/widgets/e-table/e-table-group-leaf.c @@ -14,6 +14,7 @@ #include "e-table-item.h" #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" +#include "e-util/e-canvas.h" #define TITLE_HEIGHT 16 #define GROUP_INDENT 10 @@ -76,23 +77,22 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_heade } static void -etgl_resize (GtkObject *object, gpointer data) +etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupLeaf *etgl) { - e_table_group_resize (E_TABLE_GROUP(data)); + if ( row < E_TABLE_SUBSET(etgl->subset)->n_map ) + e_table_group_row_selection (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], selected); } static void -etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupLeaf *etgl) +etgl_reflow (GnomeCanvasItem *item, gint flags) { - if ( row < E_TABLE_SUBSET(etgl->subset)->n_map ) - e_table_group_row_selection (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], selected); + e_canvas_item_request_parent_reflow(item); } static void etgl_realize (GnomeCanvasItem *item) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); - gdouble height; if ( GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize ) GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); @@ -109,13 +109,7 @@ etgl_realize (GnomeCanvasItem *item) gtk_signal_connect(GTK_OBJECT(etgl->item), "row_selection", GTK_SIGNAL_FUNC(etgl_row_selection), etgl); - gtk_signal_connect(GTK_OBJECT(etgl->item), - "resize", etgl_resize, etgl); - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - if ( height != 1 ) - e_table_group_resize(E_TABLE_GROUP(etgl)); + e_canvas_item_request_parent_reflow(item); } static int @@ -303,6 +297,8 @@ etgl_init (GtkObject *object) etgl->width = 1; etgl->subset = NULL; etgl->item = NULL; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgl_reflow); } E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c index ce7f1945f6..3729f41293 100644 --- a/widgets/e-table/e-table-group.c +++ b/widgets/e-table/e-table-group.c @@ -30,7 +30,6 @@ static GnomeCanvasGroupClass *etg_parent_class; enum { ROW_SELECTION, - RESIZE, LAST_SIGNAL }; @@ -220,16 +219,6 @@ e_table_group_get_ecol (ETableGroup *etg) } void -e_table_group_resize (ETableGroup *e_table_group) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [RESIZE]); -} - -void e_table_group_row_selection (ETableGroup *e_table_group, gint row, gboolean selected) { g_return_if_fail (e_table_group != NULL); @@ -350,7 +339,6 @@ etg_class_init (GtkObjectClass *object_class) item_class->event = etg_event; - klass->resize = NULL; klass->row_selection = NULL; klass->add = NULL; @@ -376,14 +364,6 @@ etg_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - etg_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h index 820c17007e..35b3069b20 100644 --- a/widgets/e-table/e-table-group.h +++ b/widgets/e-table/e-table-group.h @@ -41,7 +41,6 @@ typedef struct { typedef struct { GnomeCanvasGroupClass parent_class; - void (*resize) (ETableGroup *etg); void (*row_selection) (ETableGroup *etg, int row, gboolean selected); void (*add) (ETableGroup *etg, gint row); @@ -87,7 +86,6 @@ void e_table_group_construct (GnomeCanvasGroup *parent, ETableModel *model); /* For emitting the signals */ -void e_table_group_resize (ETableGroup *etg); void e_table_group_row_selection (ETableGroup *etg, gint row, gboolean selected); diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index 59df09e5bb..0df506cfae 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -18,6 +18,7 @@ #include <math.h> #include "e-table-item.h" #include "e-cell.h" +#include "e-util/e-canvas.h" #define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () @@ -27,7 +28,6 @@ static GnomeCanvasItemClass *eti_parent_class; enum { ROW_SELECTION, - RESIZE, LAST_SIGNAL }; @@ -47,6 +47,8 @@ enum { ARG_HAS_FOCUS }; +static int eti_get_height (ETableItem *eti); + static gboolean eti_editing (ETableItem *eti) { @@ -74,8 +76,6 @@ eti_realize_cell_views (ETableItem *eti) eti->cell_views_realized = 1; } -static void eti_compute_height (ETableItem *eti); - static void eti_attach_cell_views (ETableItem *eti) { @@ -96,7 +96,10 @@ eti_attach_cell_views (ETableItem *eti) eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti); } - eti_compute_height (eti); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } /* @@ -136,6 +139,19 @@ eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y { } +static void +eti_reflow (GnomeCanvasItem *item, gint flags) +{ + ETableItem *eti = E_TABLE_ITEM (item); + if ( eti->needs_compute_height ) { + int new_height = eti_get_height (eti); + if ( new_height != eti->height ) { + eti->height = new_height; + e_canvas_item_request_parent_reflow(GNOME_CANVAS_ITEM(eti)); + } + eti->needs_compute_height = 0; + } +} /* * GnomeCanvasItem::update method @@ -162,14 +178,14 @@ eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); if ( item->x1 != c1.x || item->y1 != c1.y || - item->x2 != c2.x || - item->y2 != c2.y ) + item->x2 != c2.x + 1 || + item->y2 != c2.y + 1 ) { gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2); item->x1 = c1.x; item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; + item->x2 = c2.x + 1; + item->y2 = c2.y + 1; eti->needs_redraw = 1; } if ( eti->needs_redraw ) { @@ -297,22 +313,6 @@ eti_get_height (ETableItem *eti) } static void -eti_compute_height (ETableItem *eti) -{ - int new_height = eti_get_height (eti); - - if (new_height != eti->height){ - /* double x1, y1, x2, y2;*/ - printf ("Emitting!\n"); - - eti->height = new_height; - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RESIZE]); - } -} - -static void eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); @@ -342,12 +342,10 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti) eti->focused_row = eti->rows - 1; } - if (eti->cell_views) - eti_compute_height (eti); - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } /* Unused. */ @@ -569,7 +567,8 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg); break; } - eti_update (item, NULL, NULL, 0); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } static void @@ -610,6 +609,9 @@ eti_init (GnomeCanvasItem *item) eti->selection_mode = GTK_SELECTION_SINGLE; eti->needs_redraw = 0; + eti->needs_compute_height = 0; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(eti), eti_reflow); } #define gray50_width 2 @@ -655,9 +657,10 @@ eti_realize (GnomeCanvasItem *item) eti_realize_cell_views (eti); - eti_compute_height (eti); - - eti_update (item, NULL, NULL, 0); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } static void @@ -1162,14 +1165,6 @@ eti_class_init (GtkObjectClass *object_class) GTK_SIGNAL_OFFSET (ETableItemClass, row_selection), gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - eti_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h index d8f458a212..b5c5980f2c 100644 --- a/widgets/e-table/e-table-item.h +++ b/widgets/e-table/e-table-item.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #ifndef _E_TABLE_ITEM_H_ #define _E_TABLE_ITEM_H_ @@ -63,14 +64,14 @@ typedef struct { int editing_col, editing_row; void *edit_ctx; - guint needs_redraw : 1; + guint needs_redraw : 1; + guint needs_compute_height : 1; } ETableItem; typedef struct { GnomeCanvasItemClass parent_class; void (*row_selection) (ETableItem *eti, int row, gboolean selected); - void (*resize) (ETableItem *eti); } ETableItemClass; GtkType e_table_item_get_type (void); diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index ed1260fa44..43d3ba6e89 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -20,6 +20,7 @@ #include <gnome-xml/parser.h> #include "e-util/e-util.h" #include "e-util/e-xml-utils.h" +#include "e-util/e-canvas.h" #include "e-table.h" #include "e-table-header-item.h" #include "e-table-subset.h" @@ -30,7 +31,7 @@ #define TITLE_HEIGHT 16 #define GROUP_INDENT 10 -#define PARENT_TYPE gtk_table_get_type () +#define PARENT_TYPE gtk_hbox_get_type () static GtkObjectClass *e_table_parent_class; @@ -173,11 +174,6 @@ e_table_setup_header (ETable *e_table) GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table); gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT); - - gtk_table_attach ( - GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas), - 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - } #if 0 @@ -630,7 +626,7 @@ changed_idle (gpointer data) e_table_fill_table(et, et->model); } else if (et->need_row_changes) { g_hash_table_foreach(et->row_changes_list, change_row, et); - } + } et->need_rebuild = 0; et->need_row_changes = 0; if (et->row_changes_list) @@ -681,9 +677,6 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); - gtk_table_attach ( - GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas), - 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), full_header, @@ -732,10 +725,7 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, xmlNode *xmlGrouping; GtkWidget *vscrollbar; - - GTK_TABLE (e_table)->homogeneous = FALSE; - - gtk_table_resize (GTK_TABLE (e_table), 2, 2); + GtkWidget *vbox; e_table->full_header = full_header; gtk_object_ref (GTK_OBJECT (full_header)); @@ -756,12 +746,19 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, e_table_setup_header (e_table); e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping); e_table_fill_table (e_table, etm); + + vbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 ); + + gtk_widget_show(vbox); + + gtk_box_pack_start( GTK_BOX(e_table), vbox, TRUE, TRUE, 0); vscrollbar = gtk_vscrollbar_new(gtk_layout_get_vadjustment(GTK_LAYOUT(e_table->table_canvas))); gtk_widget_show (vscrollbar); - gtk_table_attach ( - GTK_TABLE (e_table), vscrollbar, - 1, 2, 0, 2, 0, GTK_FILL | GTK_EXPAND, 0, 0); + gtk_box_pack_start( GTK_BOX(e_table), vscrollbar, FALSE, FALSE, 0 ); gtk_widget_pop_colormap (); gtk_widget_pop_visual (); diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h index 8f31a1df70..8d7fda340e 100644 --- a/widgets/e-table/e-table.h +++ b/widgets/e-table/e-table.h @@ -19,7 +19,7 @@ BEGIN_GNOME_DECLS #define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE)) typedef struct { - GtkTable parent; + GtkHBox parent; ETableModel *model; @@ -53,7 +53,7 @@ typedef struct { } ETable; typedef struct { - GtkTableClass parent_class; + GtkHBoxClass parent_class; void (*row_selection) (ETable *et, int row, gboolean selected); } ETableClass; diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 4f11c75f41..ebe832c29f 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -14,6 +14,7 @@ #include "e-table-item.h" #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" +#include "e-util/e-canvas.h" #include "e-util/e-canvas-utils.h" #include "widgets/e-text/e-text.h" @@ -47,9 +48,7 @@ static gboolean etgc_remove (ETableGroup *etg, gint row); static void etgc_increment (ETableGroup *etg, gint position, gint amount); static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col); -static void etgc_child_resize (GtkObject *object, gpointer data); - -static void etgc_queue_reposition (ETableGroupContainer *etgc); +static void etgc_reflow (GnomeCanvasItem *item, gint flags); typedef struct { ETableGroup *child; @@ -506,6 +505,8 @@ etgc_realize (GnomeCanvasItem *item) (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item); etgc = E_TABLE_GROUP_CONTAINER (item); + + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); } /* Unrealize handler for the etgc item */ @@ -580,9 +581,6 @@ static void etgc_add (ETableGroup *etg, gint row) GTK_SIGNAL_FUNC(child_row_selection), etgc); child_node->child = child; child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val); - - gtk_signal_connect(GTK_OBJECT(child), "resize", - etgc_child_resize, etgc); child_node->count = 1; e_table_group_add(child, row); if ( list ) { @@ -591,7 +589,7 @@ static void etgc_add (ETableGroup *etg, gint row) else etgc->children = g_list_append(etgc->children, child_node); compute_text(etgc, child_node); - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); } static gboolean etgc_remove (ETableGroup *etg, gint row) @@ -610,11 +608,11 @@ static gboolean etgc_remove (ETableGroup *etg, gint row) } else { compute_text(etgc, child_node); } + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc)); return TRUE; } } return FALSE; - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static void etgc_increment (ETableGroup *etg, gint position, gint amount) @@ -624,7 +622,6 @@ static void etgc_increment (ETableGroup *etg, gint position, gint amount) for ( ; list; list = g_list_next(list) ) { e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount); } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) @@ -637,7 +634,6 @@ static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col); } } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); } static gint @@ -659,7 +655,7 @@ etgc_get_focus_column (ETableGroup *etg) static void etgc_thaw (ETableGroup *etg) { - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etg)); } static void @@ -720,12 +716,16 @@ static void etgc_set_width (ETableGroup *etg, gdouble width) for ( ; list; list = g_list_next(list) ) { gdouble child_width = width - GROUP_INDENT; - gtk_object_set(GTK_OBJECT(((ETableGroupContainerChildNode *)list->data)->child), + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + gtk_object_set(GTK_OBJECT(child_node->child), "width", child_width, NULL); - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); + gnome_canvas_item_set(GNOME_CANVAS_ITEM(child_node->rect), + "x1", (double) 0, + "x2", (double) etgc->width, + NULL); + } } static gdouble etgc_get_width (ETableGroup *etg) @@ -780,18 +780,21 @@ etgc_init (GtkObject *object) { ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); container->children = FALSE; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow); } -static gboolean -etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) +static void +etgc_reflow (GnomeCanvasItem *item, gint flags) { + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); gboolean frozen; gtk_object_get(GTK_OBJECT(etgc), "frozen", &frozen, NULL); if ( frozen ) { etgc->idle = 0; - return FALSE; + return; } if ( GTK_OBJECT_FLAGS( etgc ) & GNOME_CANVAS_ITEM_REALIZED ) { gdouble old_height; @@ -840,27 +843,11 @@ etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) running_height -= extra_height; if ( running_height != old_height) { etgc->height = running_height; - gtk_signal_emit_by_name (GTK_OBJECT (etgc), "resize"); + e_canvas_item_request_parent_reflow(item); } } } etgc->idle = 0; - return FALSE; -} - -static void -etgc_queue_reposition (ETableGroupContainer *etgc) -{ - if (etgc->idle == 0) - etgc->idle = g_idle_add((GSourceFunc)etgc_update_positioning, etgc); -} - -static void -etgc_child_resize (GtkObject *object, gpointer data) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(data); - etgc_queue_reposition (etgc); } E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); - diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index 2234e77ac1..4070624456 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -41,11 +41,6 @@ typedef struct { gint idle; /* - * Update booleans: - */ - guint need_resize : 1; - - /* * State: the ETableGroup is open or closed */ guint open:1; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 9d5f858c16..1746d4f075 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -14,6 +14,7 @@ #include "e-table-item.h" #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" +#include "e-util/e-canvas.h" #define TITLE_HEIGHT 16 #define GROUP_INDENT 10 @@ -76,23 +77,22 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_heade } static void -etgl_resize (GtkObject *object, gpointer data) +etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupLeaf *etgl) { - e_table_group_resize (E_TABLE_GROUP(data)); + if ( row < E_TABLE_SUBSET(etgl->subset)->n_map ) + e_table_group_row_selection (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], selected); } static void -etgl_row_selection (GtkObject *object, gint row, gboolean selected, ETableGroupLeaf *etgl) +etgl_reflow (GnomeCanvasItem *item, gint flags) { - if ( row < E_TABLE_SUBSET(etgl->subset)->n_map ) - e_table_group_row_selection (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], selected); + e_canvas_item_request_parent_reflow(item); } static void etgl_realize (GnomeCanvasItem *item) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); - gdouble height; if ( GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize ) GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); @@ -109,13 +109,7 @@ etgl_realize (GnomeCanvasItem *item) gtk_signal_connect(GTK_OBJECT(etgl->item), "row_selection", GTK_SIGNAL_FUNC(etgl_row_selection), etgl); - gtk_signal_connect(GTK_OBJECT(etgl->item), - "resize", etgl_resize, etgl); - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - if ( height != 1 ) - e_table_group_resize(E_TABLE_GROUP(etgl)); + e_canvas_item_request_parent_reflow(item); } static int @@ -303,6 +297,8 @@ etgl_init (GtkObject *object) etgl->width = 1; etgl->subset = NULL; etgl->item = NULL; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgl_reflow); } E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index ce7f1945f6..3729f41293 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -30,7 +30,6 @@ static GnomeCanvasGroupClass *etg_parent_class; enum { ROW_SELECTION, - RESIZE, LAST_SIGNAL }; @@ -220,16 +219,6 @@ e_table_group_get_ecol (ETableGroup *etg) } void -e_table_group_resize (ETableGroup *e_table_group) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [RESIZE]); -} - -void e_table_group_row_selection (ETableGroup *e_table_group, gint row, gboolean selected) { g_return_if_fail (e_table_group != NULL); @@ -350,7 +339,6 @@ etg_class_init (GtkObjectClass *object_class) item_class->event = etg_event; - klass->resize = NULL; klass->row_selection = NULL; klass->add = NULL; @@ -376,14 +364,6 @@ etg_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - etg_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 820c17007e..35b3069b20 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -41,7 +41,6 @@ typedef struct { typedef struct { GnomeCanvasGroupClass parent_class; - void (*resize) (ETableGroup *etg); void (*row_selection) (ETableGroup *etg, int row, gboolean selected); void (*add) (ETableGroup *etg, gint row); @@ -87,7 +86,6 @@ void e_table_group_construct (GnomeCanvasGroup *parent, ETableModel *model); /* For emitting the signals */ -void e_table_group_resize (ETableGroup *etg); void e_table_group_row_selection (ETableGroup *etg, gint row, gboolean selected); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 59df09e5bb..0df506cfae 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -18,6 +18,7 @@ #include <math.h> #include "e-table-item.h" #include "e-cell.h" +#include "e-util/e-canvas.h" #define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () @@ -27,7 +28,6 @@ static GnomeCanvasItemClass *eti_parent_class; enum { ROW_SELECTION, - RESIZE, LAST_SIGNAL }; @@ -47,6 +47,8 @@ enum { ARG_HAS_FOCUS }; +static int eti_get_height (ETableItem *eti); + static gboolean eti_editing (ETableItem *eti) { @@ -74,8 +76,6 @@ eti_realize_cell_views (ETableItem *eti) eti->cell_views_realized = 1; } -static void eti_compute_height (ETableItem *eti); - static void eti_attach_cell_views (ETableItem *eti) { @@ -96,7 +96,10 @@ eti_attach_cell_views (ETableItem *eti) eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti); } - eti_compute_height (eti); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } /* @@ -136,6 +139,19 @@ eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y { } +static void +eti_reflow (GnomeCanvasItem *item, gint flags) +{ + ETableItem *eti = E_TABLE_ITEM (item); + if ( eti->needs_compute_height ) { + int new_height = eti_get_height (eti); + if ( new_height != eti->height ) { + eti->height = new_height; + e_canvas_item_request_parent_reflow(GNOME_CANVAS_ITEM(eti)); + } + eti->needs_compute_height = 0; + } +} /* * GnomeCanvasItem::update method @@ -162,14 +178,14 @@ eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); if ( item->x1 != c1.x || item->y1 != c1.y || - item->x2 != c2.x || - item->y2 != c2.y ) + item->x2 != c2.x + 1 || + item->y2 != c2.y + 1 ) { gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2); item->x1 = c1.x; item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; + item->x2 = c2.x + 1; + item->y2 = c2.y + 1; eti->needs_redraw = 1; } if ( eti->needs_redraw ) { @@ -297,22 +313,6 @@ eti_get_height (ETableItem *eti) } static void -eti_compute_height (ETableItem *eti) -{ - int new_height = eti_get_height (eti); - - if (new_height != eti->height){ - /* double x1, y1, x2, y2;*/ - printf ("Emitting!\n"); - - eti->height = new_height; - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RESIZE]); - } -} - -static void eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); @@ -342,12 +342,10 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti) eti->focused_row = eti->rows - 1; } - if (eti->cell_views) - eti_compute_height (eti); - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } /* Unused. */ @@ -569,7 +567,8 @@ eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg); break; } - eti_update (item, NULL, NULL, 0); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } static void @@ -610,6 +609,9 @@ eti_init (GnomeCanvasItem *item) eti->selection_mode = GTK_SELECTION_SINGLE; eti->needs_redraw = 0; + eti->needs_compute_height = 0; + + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(eti), eti_reflow); } #define gray50_width 2 @@ -655,9 +657,10 @@ eti_realize (GnomeCanvasItem *item) eti_realize_cell_views (eti); - eti_compute_height (eti); - - eti_update (item, NULL, NULL, 0); + eti->needs_compute_height = 1; + e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti)); + eti->needs_redraw = 1; + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); } static void @@ -1162,14 +1165,6 @@ eti_class_init (GtkObjectClass *object_class) GTK_SIGNAL_OFFSET (ETableItemClass, row_selection), gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - eti_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index d8f458a212..b5c5980f2c 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #ifndef _E_TABLE_ITEM_H_ #define _E_TABLE_ITEM_H_ @@ -63,14 +64,14 @@ typedef struct { int editing_col, editing_row; void *edit_ctx; - guint needs_redraw : 1; + guint needs_redraw : 1; + guint needs_compute_height : 1; } ETableItem; typedef struct { GnomeCanvasItemClass parent_class; void (*row_selection) (ETableItem *eti, int row, gboolean selected); - void (*resize) (ETableItem *eti); } ETableItemClass; GtkType e_table_item_get_type (void); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index ed1260fa44..43d3ba6e89 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -20,6 +20,7 @@ #include <gnome-xml/parser.h> #include "e-util/e-util.h" #include "e-util/e-xml-utils.h" +#include "e-util/e-canvas.h" #include "e-table.h" #include "e-table-header-item.h" #include "e-table-subset.h" @@ -30,7 +31,7 @@ #define TITLE_HEIGHT 16 #define GROUP_INDENT 10 -#define PARENT_TYPE gtk_table_get_type () +#define PARENT_TYPE gtk_hbox_get_type () static GtkObjectClass *e_table_parent_class; @@ -173,11 +174,6 @@ e_table_setup_header (ETable *e_table) GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table); gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT); - - gtk_table_attach ( - GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas), - 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - } #if 0 @@ -630,7 +626,7 @@ changed_idle (gpointer data) e_table_fill_table(et, et->model); } else if (et->need_row_changes) { g_hash_table_foreach(et->row_changes_list, change_row, et); - } + } et->need_rebuild = 0; et->need_row_changes = 0; if (et->row_changes_list) @@ -681,9 +677,6 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); - gtk_table_attach ( - GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas), - 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), full_header, @@ -732,10 +725,7 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, xmlNode *xmlGrouping; GtkWidget *vscrollbar; - - GTK_TABLE (e_table)->homogeneous = FALSE; - - gtk_table_resize (GTK_TABLE (e_table), 2, 2); + GtkWidget *vbox; e_table->full_header = full_header; gtk_object_ref (GTK_OBJECT (full_header)); @@ -756,12 +746,19 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, e_table_setup_header (e_table); e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping); e_table_fill_table (e_table, etm); + + vbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 ); + + gtk_widget_show(vbox); + + gtk_box_pack_start( GTK_BOX(e_table), vbox, TRUE, TRUE, 0); vscrollbar = gtk_vscrollbar_new(gtk_layout_get_vadjustment(GTK_LAYOUT(e_table->table_canvas))); gtk_widget_show (vscrollbar); - gtk_table_attach ( - GTK_TABLE (e_table), vscrollbar, - 1, 2, 0, 2, 0, GTK_FILL | GTK_EXPAND, 0, 0); + gtk_box_pack_start( GTK_BOX(e_table), vscrollbar, FALSE, FALSE, 0 ); gtk_widget_pop_colormap (); gtk_widget_pop_visual (); diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 8f31a1df70..8d7fda340e 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -19,7 +19,7 @@ BEGIN_GNOME_DECLS #define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE)) typedef struct { - GtkTable parent; + GtkHBox parent; ETableModel *model; @@ -53,7 +53,7 @@ typedef struct { } ETable; typedef struct { - GtkTableClass parent_class; + GtkHBoxClass parent_class; void (*row_selection) (ETable *et, int row, gboolean selected); } ETableClass; |