aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-table-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-08 04:49:02 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-08 04:49:02 +0800
commit56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff (patch)
tree1b90f791be6fcb52dc21e44c44b45099317df91d /widgets/e-table/e-table-item.c
parent271cb81264219225420332375135c74857e035e7 (diff)
downloadgsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar.gz
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar.bz2
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar.lz
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar.xz
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.tar.zst
gsoc2013-evolution-56f9196ac4e30fd0f5e0bd79bab0dcfc9856c8ff.zip
Handle row_inserted and row_deleted signals properly.
2000-05-07 Christopher James Lahey <clahey@helixcode.com> * e-table-item.c, e-table-item.h, e-table.c, e-table.h: Handle row_inserted and row_deleted signals properly. * e-table-model.c, e-table-model.h: Created the row_inserted and row_deleted signals. * e-table-sorted-variable.c, e-table-subset-variable.c: Emit the row_inserted and row_deleted signals as appropriate. svn path=/trunk/; revision=2879
Diffstat (limited to 'widgets/e-table/e-table-item.c')
-rw-r--r--widgets/e-table/e-table-item.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index cae22ec081..13699e1d91 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -49,6 +49,7 @@ enum {
static int eti_get_height (ETableItem *eti);
static int eti_row_height (ETableItem *eti, int row);
+#define ETI_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
static gboolean
eti_editing (ETableItem *eti)
@@ -235,11 +236,17 @@ eti_remove_table_model (ETableItem *eti)
eti->table_model_row_change_id);
gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
eti->table_model_cell_change_id);
+ gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ eti->table_model_row_inserted_id);
+ gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ eti->table_model_row_deleted_id);
gtk_object_unref (GTK_OBJECT (eti->table_model));
eti->table_model_change_id = 0;
eti->table_model_row_change_id = 0;
eti->table_model_cell_change_id = 0;
+ eti->table_model_row_inserted_id = 0;
+ eti->table_model_row_deleted_id = 0;
eti->table_model = NULL;
}
@@ -545,6 +552,18 @@ eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETable
eti_request_region_redraw (eti, 0, row, eti->cols, row, 0);
}
+static void
+eti_table_model_row_inserted (ETableModel *table_model, int row, ETableItem *eti)
+{
+ eti_table_model_changed (table_model, eti);
+}
+
+static void
+eti_table_model_row_deleted (ETableModel *table_model, int row, ETableItem *eti)
+{
+ eti_table_model_changed (table_model, eti);
+}
+
void
e_table_item_redraw_range (ETableItem *eti,
int start_col, int start_row,
@@ -586,6 +605,14 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
GTK_OBJECT (table_model), "model_cell_changed",
GTK_SIGNAL_FUNC (eti_table_model_cell_changed), eti);
+ eti->table_model_row_inserted_id = gtk_signal_connect (
+ GTK_OBJECT (table_model), "model_row_inserted",
+ GTK_SIGNAL_FUNC (eti_table_model_row_inserted), eti);
+
+ eti->table_model_row_deleted_id = gtk_signal_connect (
+ GTK_OBJECT (table_model), "model_row_deleted",
+ GTK_SIGNAL_FUNC (eti_table_model_row_deleted), eti);
+
if (eti->header) {
eti_detach_cell_views (eti);
eti_attach_cell_views (eti);
@@ -893,7 +920,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
y1 = y2 = floor (eti_base.y) + 1;
for (row = 0; row < rows; row++, y1 = y2){
- y2 += eti_row_height (eti, row) + 1;
+ y2 += ETI_ROW_HEIGHT (eti, row) + 1;
if (y1 > y + height)
break;
@@ -929,7 +956,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
int xd, height;
gboolean selected;
- height = eti_row_height (eti, row);
+ height = ETI_ROW_HEIGHT (eti, row);
xd = x_offset;
/* printf ("paint: %d %d\n", yd, yd + height); */
@@ -1037,7 +1064,7 @@ find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, doub
if (y < y1)
return FALSE;
- y2 += eti_row_height (eti, row) + 1;
+ y2 += ETI_ROW_HEIGHT (eti, row) + 1;
if (y > y2)
continue;