aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-20 07:32:50 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-20 07:32:50 +0800
commit862d1f25dea4fde774aca9b8e849f22b2e0b9d93 (patch)
treeed6266c92fbee21440085d1a71e258f2cbb18fb9 /widgets/e-table
parent668e92af992e05e58c714d71943a66a60eb49965 (diff)
downloadgsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar.gz
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar.bz2
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar.lz
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar.xz
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.tar.zst
gsoc2013-evolution-862d1f25dea4fde774aca9b8e849f22b2e0b9d93.zip
Made background colors alternate.
2000-08-19 Christopher James Lahey <clahey@helixcode.com> * e-cell-text.c: Made background colors alternate. * e-table-click-to-add.c: Made tabbing off the right edge of the click to add commit the new values. * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group.h, e-table-sorted-variable.c, e-table-subset-variable.c, e-table-subset-variable.h: Added a decrement method. Made the add and remove methods not automatically increment and decrement. * e-table-item.c: Fixed some view vs model issues for both rows and columns. * e-table-model.c: Added debugging code. Removed automatic signalling of changes by the ETableModel set_value_at function (the model should send these signals itself.) * e-table.c: Added increment and decrement calls when a row is removed or added from the source model. svn path=/trunk/; revision=4881
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog23
-rw-r--r--widgets/e-table/e-cell-text.c5
-rw-r--r--widgets/e-table/e-table-click-to-add.c5
-rw-r--r--widgets/e-table/e-table-group-container.c12
-rw-r--r--widgets/e-table/e-table-group-leaf.c8
-rw-r--r--widgets/e-table/e-table-group.c13
-rw-r--r--widgets/e-table/e-table-group.h4
-rw-r--r--widgets/e-table/e-table-item.c17
-rw-r--r--widgets/e-table/e-table-model.c49
-rw-r--r--widgets/e-table/e-table-sorted-variable.c13
-rw-r--r--widgets/e-table/e-table-subset-variable.c38
-rw-r--r--widgets/e-table/e-table-subset-variable.h3
-rw-r--r--widgets/e-table/e-table.c6
13 files changed, 151 insertions, 45 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 316e470c83..4f54a05d26 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,26 @@
+2000-08-19 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-cell-text.c: Made background colors alternate.
+
+ * e-table-click-to-add.c: Made tabbing off the right edge of the
+ click to add commit the new values.
+
+ * e-table-group-container.c, e-table-group-leaf.c,
+ e-table-group.c, e-table-group.h, e-table-sorted-variable.c,
+ e-table-subset-variable.c, e-table-subset-variable.h: Added a
+ decrement method. Made the add and remove methods not
+ automatically increment and decrement.
+
+ * e-table-item.c: Fixed some view vs model issues for both rows
+ and columns.
+
+ * e-table-model.c: Added debugging code. Removed automatic
+ signalling of changes by the ETableModel set_value_at function
+ (the model should send these signals itself.)
+
+ * e-table.c: Added increment and decrement calls when a row is
+ removed or added from the source model.
+
2000-08-09 Christopher James Lahey <clahey@helixcode.com>
* e-table-item.c, e-table-selection-model.c,
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index dafc8f4675..209a505738 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -464,7 +464,10 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
background = &canvas->style->bg [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_SELECTED];
} else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
+ if (row % 2)
+ background = &canvas->style->base [GTK_STATE_NORMAL];
+ else
+ background = &canvas->style->base [GTK_STATE_SELECTED];
foreground = &canvas->style->text [GTK_STATE_NORMAL];
}
diff --git a/widgets/e-table/e-table-click-to-add.c b/widgets/e-table/e-table-click-to-add.c
index d111df1cd9..ba38078b2c 100644
--- a/widgets/e-table/e-table-click-to-add.c
+++ b/widgets/e-table/e-table-click-to-add.c
@@ -317,6 +317,11 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_KP_Enter:
case GDK_ISO_Enter:
case GDK_3270_Enter:
+
+ case GDK_Tab:
+ case GDK_KP_Tab:
+ case GDK_ISO_Left_Tab:
+
if (etcta->row) {
ETableModel *one;
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index dbf492d091..3a68bc044b 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -480,6 +480,17 @@ etgc_increment (ETableGroup *etg, gint position, gint amount)
}
static void
+etgc_decrement (ETableGroup *etg, gint position, gint amount)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+ GList *list = etgc->children;
+
+ for (list = etgc->children ; list; list = g_list_next (list))
+ e_table_group_decrement (((ETableGroupContainerChildNode *)list->data)->child,
+ position, amount);
+}
+
+static void
etgc_set_cursor_row (ETableGroup *etg, gint row)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
@@ -703,6 +714,7 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->add_all = etgc_add_all;
e_group_class->remove = etgc_remove;
e_group_class->increment = etgc_increment;
+ e_group_class->decrement = etgc_decrement;
e_group_class->row_count = etgc_row_count;
e_group_class->set_focus = etgc_set_focus;
e_group_class->set_cursor_row = etgc_set_cursor_row;
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index fa52e91d9d..c4792eb87e 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -187,6 +187,13 @@ etgl_increment (ETableGroup *etg, gint position, gint amount)
e_table_subset_variable_increment (etgl->subset, position, amount);
}
+static void
+etgl_decrement (ETableGroup *etg, gint position, gint amount)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ e_table_subset_variable_decrement (etgl->subset, position, amount);
+}
+
static int
etgl_row_count (ETableGroup *etg)
{
@@ -363,6 +370,7 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->add_all = etgl_add_all;
e_group_class->remove = etgl_remove;
e_group_class->increment = etgl_increment;
+ e_group_class->decrement = etgl_decrement;
e_group_class->row_count = etgl_row_count;
e_group_class->set_focus = etgl_set_focus;
e_group_class->set_cursor_row = etgl_set_cursor_row;
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
index b47d01e151..fbd9026096 100644
--- a/widgets/e-table/e-table-group.c
+++ b/widgets/e-table/e-table-group.c
@@ -156,6 +156,18 @@ e_table_group_increment (ETableGroup *etg,
}
void
+e_table_group_decrement (ETableGroup *etg,
+ gint position,
+ gint amount)
+{
+ g_return_if_fail (etg != NULL);
+ g_return_if_fail (E_IS_TABLE_GROUP (etg));
+
+ if (ETG_CLASS (etg)->decrement)
+ ETG_CLASS (etg)->decrement (etg, position, amount);
+}
+
+void
e_table_group_set_focus (ETableGroup *etg,
EFocus direction,
gint row)
@@ -359,6 +371,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->get_count = NULL;
klass->row_count = NULL;
klass->increment = NULL;
+ klass->decrement = NULL;
klass->set_focus = NULL;
klass->set_cursor_row = NULL;
klass->get_cursor_row = NULL;
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
index 7714e18e9a..a3afe7f5e1 100644
--- a/widgets/e-table/e-table-group.h
+++ b/widgets/e-table/e-table-group.h
@@ -57,6 +57,7 @@ typedef struct {
gint (*get_count) (ETableGroup *etg);
gint (*row_count) (ETableGroup *etg);
void (*increment) (ETableGroup *etg, gint position, gint amount);
+ void (*decrement) (ETableGroup *etg, gint position, gint amount);
void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col);
void (*set_cursor_row) (ETableGroup *etg, gint row);
int (*get_cursor_row) (ETableGroup *etg);
@@ -78,6 +79,9 @@ gint e_table_group_get_count (ETableGroup *etg);
void e_table_group_increment (ETableGroup *etg,
gint position,
gint amount);
+void e_table_group_decrement (ETableGroup *etg,
+ gint position,
+ gint amount);
gint e_table_group_row_count (ETableGroup *etg);
void e_table_group_set_focus (ETableGroup *etg,
EFocus direction,
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 19a146de25..b394669110 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -1204,7 +1204,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, col_selected,
xd, yd, xd + ecol->width, yd + height);
- if (col == cursor_col && view_to_model_row(eti, row) == cursor_row){
+ if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row){
f_x1 = xd;
f_x2 = xd + ecol->width;
f_y1 = yd;
@@ -1245,11 +1245,8 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
* Draw focus
*/
if (f_found && eti->draw_focus){
-
- if (!eti_editing (eti))
- gdk_draw_rectangle (
- drawable, eti->focus_gc, FALSE,
- f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1);
+ gdk_draw_rectangle (drawable, eti->focus_gc, FALSE,
+ f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1);
}
}
@@ -1418,7 +1415,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
return TRUE;
- e_table_selection_model_maybe_do_something(eti->selection, row, col, 0);
+ e_table_selection_model_maybe_do_something(eti->selection, view_to_model_row(eti, row), view_to_model_col(eti, col), 0);
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RIGHT_CLICK],
row, col, e, &return_val);
@@ -1570,14 +1567,14 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_ISO_Left_Tab:
if ((e->key.state & GDK_SHIFT_MASK) != 0){
/* shift tab */
- if (cursor_col > 0)
+ if (cursor_col != view_to_model_col(eti, 0))
eti_cursor_move_left (eti);
else if (cursor_row != view_to_model_row(eti, 0))
eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, eti->cols - 1);
else
return_val = FALSE;
} else {
- if (cursor_col < eti->cols - 1)
+ if (cursor_col != view_to_model_col (eti, eti->cols - 1))
eti_cursor_move_right (eti);
else if (cursor_row != view_to_model_row(eti, eti->rows - 1))
eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, 0);
@@ -1589,7 +1586,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
"cursor_col", &cursor_col,
NULL);
- if (cursor_col > 0 && cursor_row > 0 && return_val &&
+ if (cursor_col >= 0 && cursor_row >= 0 && return_val &&
(!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) {
e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row));
}
diff --git a/widgets/e-table/e-table-model.c b/widgets/e-table/e-table-model.c
index f47fb7afb2..d9c0c4fd38 100644
--- a/widgets/e-table/e-table-model.c
+++ b/widgets/e-table/e-table-model.c
@@ -14,7 +14,11 @@
#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass)
#define PARENT_TYPE gtk_object_get_type ()
-
+
+#define d(x)
+
+d(static gint depth = 0);
+
static GtkObjectClass *e_table_model_parent_class;
@@ -66,15 +70,6 @@ e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, data);
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
-
- /*
- * Notice that "model_changed" is not emitted
- */
}
gboolean
@@ -264,14 +259,28 @@ e_table_model_get_type (void)
return type;
}
+#if d(!)0
+static void
+print_tabs (void)
+{
+ int i;
+ for (i = 0; i < depth; i++)
+ g_print("\t");
+}
+#endif
+
void
e_table_model_pre_change (ETableModel *e_table_model)
{
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting pre_change on model 0x%p.\n", e_table_model));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_PRE_CHANGE]);
+ d(depth--);
}
void
@@ -280,8 +289,12 @@ e_table_model_changed (ETableModel *e_table_model)
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting model_changed on model 0x%p.\n", e_table_model));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_CHANGED]);
+ d(depth--);
}
void
@@ -290,8 +303,12 @@ e_table_model_row_changed (ETableModel *e_table_model, int row)
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting row_changed on model 0x%p, row %d.\n", e_table_model, row));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_ROW_CHANGED], row);
+ d(depth--);
}
void
@@ -300,8 +317,12 @@ e_table_model_cell_changed (ETableModel *e_table_model, int col, int row)
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting cell_changed on model 0x%p, row %d, col %d.\n", e_table_model, row, col));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_CELL_CHANGED], col, row);
+ d(depth--);
}
void
@@ -310,8 +331,12 @@ e_table_model_row_inserted (ETableModel *e_table_model, int row)
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting row_inserted on model 0x%p, row %d.\n", e_table_model, row));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_ROW_INSERTED], row);
+ d(depth--);
}
void
@@ -320,6 +345,10 @@ e_table_model_row_deleted (ETableModel *e_table_model, int row)
g_return_if_fail (e_table_model != NULL);
g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
+ d(print_tabs());
+ d(g_print("Emitting row_deleted on model 0x%p, row %d.\n", e_table_model, row));
+ d(depth++);
gtk_signal_emit (GTK_OBJECT (e_table_model),
e_table_model_signals [MODEL_ROW_DELETED], row);
+ d(depth--);
}
diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c
index 958daca1de..7584b31a74 100644
--- a/widgets/e-table/e-table-sorted-variable.c
+++ b/widgets/e-table/e-table-sorted-variable.c
@@ -21,8 +21,10 @@
static ETableSubsetVariableClass *etsv_parent_class;
static void etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv);
+#if 0
static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv);
static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv);
+#endif
static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv);
static void etsv_sort (ETableSortedVariable *etsv);
static void etsv_add (ETableSubsetVariable *etssv, gint row);
@@ -36,10 +38,12 @@ etsv_destroy (GtkObject *object)
gtk_signal_disconnect (GTK_OBJECT (etss->source),
etsv->table_model_changed_id);
+#if 0
gtk_signal_disconnect (GTK_OBJECT (etss->source),
etsv->table_model_row_changed_id);
gtk_signal_disconnect (GTK_OBJECT (etss->source),
etsv->table_model_cell_changed_id);
+#endif
gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info),
etsv->sort_info_changed_id);
@@ -146,10 +150,6 @@ etsv_add (ETableSubsetVariable *etssv,
etssv->n_vals_allocated += INCREMENT_AMOUNT;
etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated) * sizeof(int));
}
- if (row < e_table_model_row_count(etss->source) - 1)
- for ( i = 0; i < etss->n_map; i++ )
- if (etss->map_table[i] >= row)
- etss->map_table[i] ++;
i = etss->n_map;
if (etsv->sort_idle_id == 0) {
i = 0;
@@ -208,10 +208,12 @@ e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETa
etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed",
GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv);
+#if 0
etsv->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed",
GTK_SIGNAL_FUNC (etsv_proxy_model_row_changed), etsv);
etsv->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed",
GTK_SIGNAL_FUNC (etsv_proxy_model_cell_changed), etsv);
+#endif
etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv);
@@ -223,7 +225,7 @@ etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv)
{
/* FIXME: do_resort (); */
}
-
+#if 0
static void
etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv)
{
@@ -241,6 +243,7 @@ etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedV
if (e_table_subset_variable_remove(etssv, row))
e_table_subset_variable_add (etssv, row);
}
+#endif
static void
etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv)
diff --git a/widgets/e-table/e-table-subset-variable.c b/widgets/e-table/e-table-subset-variable.c
index f418337092..d429604301 100644
--- a/widgets/e-table/e-table-subset-variable.c
+++ b/widgets/e-table/e-table-subset-variable.c
@@ -28,7 +28,6 @@ etssv_add (ETableSubsetVariable *etssv,
{
ETableModel *etm = E_TABLE_MODEL(etssv);
ETableSubset *etss = E_TABLE_SUBSET(etssv);
- int i;
e_table_model_pre_change(etm);
@@ -36,10 +35,7 @@ etssv_add (ETableSubsetVariable *etssv,
etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated + INCREMENT_AMOUNT) * sizeof(int));
etssv->n_vals_allocated += INCREMENT_AMOUNT;
}
- if (row < e_table_model_row_count(etss->source) - 1)
- for ( i = 0; i < etss->n_map; i++ )
- if (etss->map_table[i] >= row)
- etss->map_table[i] ++;
+
etss->map_table[etss->n_map++] = row;
e_table_model_row_inserted (etm, etss->n_map - 1);
@@ -73,27 +69,18 @@ etssv_remove (ETableSubsetVariable *etssv,
ETableModel *etm = E_TABLE_MODEL(etssv);
ETableSubset *etss = E_TABLE_SUBSET(etssv);
int i;
- int ret_val = FALSE;
for (i = 0; i < etss->n_map; i++){
if (etss->map_table[i] == row) {
e_table_model_pre_change (etm);
memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int));
etss->n_map --;
-
- e_table_model_changed (etm);
- ret_val = TRUE;
- break;
- }
- }
-
- for (i = 0; i < etss->n_map; i++){
- if (etss->map_table[i] > row) {
- etss->map_table[i] --;
+
+ e_table_model_row_deleted (etm, i);
+ return TRUE;
}
}
-
- return ret_val;
+ return FALSE;
}
static void
@@ -174,13 +161,26 @@ e_table_subset_variable_increment (ETableSubsetVariable *etssv,
{
int i;
ETableSubset *etss = E_TABLE_SUBSET(etssv);
- for (i = 0; i < etss->n_map; i++){
+ for (i = 0; i < etss->n_map; i++) {
if (etss->map_table[i] > position)
etss->map_table[i] += amount;
}
}
void
+e_table_subset_variable_decrement (ETableSubsetVariable *etssv,
+ gint position,
+ gint amount)
+{
+ int i;
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ for (i = 0; i < etss->n_map; i++) {
+ if (etss->map_table[i] > position)
+ etss->map_table[i] -= amount;
+ }
+}
+
+void
e_table_subset_variable_set_allocation (ETableSubsetVariable *etssv,
gint total)
{
diff --git a/widgets/e-table/e-table-subset-variable.h b/widgets/e-table/e-table-subset-variable.h
index da932e6c05..9d44828728 100644
--- a/widgets/e-table/e-table-subset-variable.h
+++ b/widgets/e-table/e-table-subset-variable.h
@@ -39,6 +39,9 @@ gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets,
void e_table_subset_variable_increment (ETableSubsetVariable *ets,
gint position,
gint amount);
+void e_table_subset_variable_decrement (ETableSubsetVariable *ets,
+ gint position,
+ gint amount);
void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets,
gint total);
#endif /* _E_TABLE_SUBSET_VARIABLE_H_ */
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index ca26678607..e2f7edec5e 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -394,7 +394,10 @@ et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *
static void
et_table_row_inserted (ETableModel *table_model, int row, ETable *et)
{
+ int row_count = e_table_model_row_count(table_model);
if (!et->need_rebuild) {
+ if (row != row_count - 1)
+ e_table_group_increment(et->group, row, 1);
e_table_group_add (et->group, row);
}
}
@@ -402,8 +405,11 @@ et_table_row_inserted (ETableModel *table_model, int row, ETable *et)
static void
et_table_row_deleted (ETableModel *table_model, int row, ETable *et)
{
+ int row_count = e_table_model_row_count(table_model);
if (!et->need_rebuild) {
e_table_group_remove (et->group, row);
+ if (row != row_count - 1)
+ e_table_group_decrement(et->group, row, 1);
}
}