aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-table-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-03 00:56:26 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-03 00:56:26 +0800
commit5fbcc4828efb084344e9c5fd42ebccb288ee492f (patch)
treeba3fe53ec556c7548b6517c24925ada769d3c079 /widgets/e-table/e-table-item.c
parent2c7ed49b25b0ab36e003427083b331bd5bc4a61f (diff)
downloadgsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar.gz
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar.bz2
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar.lz
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar.xz
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.tar.zst
gsoc2013-evolution-5fbcc4828efb084344e9c5fd42ebccb288ee492f.zip
Add a handler for "model_pre_change" and properly stop editing.
2000-08-02 Christopher James Lahey <clahey@helixcode.com> * e-table-item.c, e-table-item.h: Add a handler for "model_pre_change" and properly stop editing. * e-table-model.c, e-table-model.h: Added a "model_pre_change" signal that gets sent before any row numbers are changed. * e-table-sorted-variable.c, e-table-subset-variable.c: Emit "model_pre_change" signals as appropriate. * e-table-subset.c, e-table-subset.h: Proxy "model_pre_changed" signals. svn path=/trunk/; revision=4472
Diffstat (limited to 'widgets/e-table/e-table-item.c')
-rw-r--r--widgets/e-table/e-table-item.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 4eac94ed41..1ecd119133 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -303,6 +303,8 @@ eti_remove_table_model (ETableItem *eti)
return;
gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ eti->table_model_pre_change_id);
+ gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
eti->table_model_change_id);
gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
eti->table_model_row_change_id);
@@ -316,6 +318,7 @@ eti_remove_table_model (ETableItem *eti)
if (eti->source_model)
gtk_object_unref (GTK_OBJECT (eti->source_model));
+ eti->table_model_pre_change_id = 0;
eti->table_model_change_id = 0;
eti->table_model_row_change_id = 0;
eti->table_model_cell_change_id = 0;
@@ -559,6 +562,16 @@ eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
}
/*
+ * Callback routine: invoked before the ETableModel has suffers a change
+ */
+static void
+eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti)
+{
+ if (eti_editing (eti))
+ e_table_item_leave_edit (eti);
+}
+
+/*
* Callback routine: invoked when the ETableModel has suffered a change
*/
static void
@@ -720,7 +733,11 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
eti->table_model = table_model;
gtk_object_ref (GTK_OBJECT (eti->table_model));
-
+
+ eti->table_model_pre_change_id = gtk_signal_connect (
+ GTK_OBJECT (table_model), "model_pre_change",
+ GTK_SIGNAL_FUNC (eti_table_model_pre_change), eti);
+
eti->table_model_change_id = gtk_signal_connect (
GTK_OBJECT (table_model), "model_changed",
GTK_SIGNAL_FUNC (eti_table_model_changed), eti);
@@ -841,12 +858,12 @@ eti_destroy (GtkObject *object)
if (eti->selection)
gtk_object_unref(GTK_OBJECT(eti->selection));
-
+
if (eti->height_cache_idle_id)
g_source_remove(eti->height_cache_idle_id);
-
+
g_free (eti->height_cache);
-
+
if (GTK_OBJECT_CLASS (eti_parent_class)->destroy)
(*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object);
}
@@ -1033,6 +1050,9 @@ eti_unrealize (GnomeCanvasItem *item)
{
ETableItem *eti = E_TABLE_ITEM (item);
+ if (eti_editing (eti))
+ e_table_item_leave_edit (eti);
+
gdk_gc_unref (eti->fill_gc);
eti->fill_gc = NULL;
gdk_gc_unref (eti->grid_gc);
@@ -1844,18 +1864,26 @@ e_table_item_enter_edit (ETableItem *eti, int col, int row)
void
e_table_item_leave_edit (ETableItem *eti)
{
+ int col, row;
+ void *edit_ctx;
+
g_return_if_fail (eti != NULL);
g_return_if_fail (E_IS_TABLE_ITEM (eti));
if (!eti_editing (eti))
return;
- e_cell_leave_edit (eti->cell_views [eti->editing_col],
- view_to_model_col(eti, eti->editing_col), eti->editing_col, eti->editing_row,
- eti->edit_ctx);
+ col = eti->editing_col;
+ row = eti->editing_row;
+ edit_ctx = eti->edit_ctx;
+
eti->editing_col = -1;
eti->editing_row = -1;
eti->edit_ctx = NULL;
+
+ e_cell_leave_edit (eti->cell_views [col],
+ view_to_model_col(eti, col),
+ col, row, edit_ctx);
}
typedef struct {