diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2001-01-30 19:14:18 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-01-30 19:14:18 +0800 |
commit | 8ee392b8a3cea8965d3cc250c9e679d48f5d4aed (patch) | |
tree | f9f8ead9e5ea44d74d0c3e20c77180eac33aaabe | |
parent | 292149afa56873fe4dbc48a19f6645f1a8f2aa81 (diff) | |
download | gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar.gz gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar.bz2 gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar.lz gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar.xz gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.tar.zst gsoc2013-evolution-8ee392b8a3cea8965d3cc250c9e679d48f5d4aed.zip |
Made carriage return finish editing.
2001-01-30 Christopher James Lahey <clahey@helixcode.com>
* e-table-click-to-add.c (etcta_event): Made carriage return
finish editing.
* e-table-item.c (eti_event): Made carriage return key press
signal go out before sending it to the selection model.
svn path=/trunk/; revision=7909
-rw-r--r-- | widgets/table/e-table-click-to-add.c | 78 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 9 |
2 files changed, 56 insertions, 31 deletions
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 70a82a3bc2..0948ad1eb0 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -263,6 +263,55 @@ etcta_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, return 0.0; } +static void finish_editing (ETableClickToAdd *etcta); + +static int +item_key_press (ETableItem *item, int row, int col, GdkEvent *event, ETableClickToAdd *etcta) +{ + switch (event->key.keyval) { + case GDK_Return: + case GDK_KP_Enter: + case GDK_ISO_Enter: + case GDK_3270_Enter: + finish_editing(etcta); + return TRUE; + } + return FALSE; +} + +static void +finish_editing (ETableClickToAdd *etcta) +{ + if (etcta->row) { + ETableModel *one; + + e_table_one_commit(E_TABLE_ONE(etcta->one)); + etcta_drop_one (etcta); + gtk_object_destroy(GTK_OBJECT(etcta->row)); + etcta->row = NULL; + + one = e_table_one_new(etcta->model); + etcta_add_one (etcta, one); + gtk_object_unref(GTK_OBJECT(one)); + + e_table_selection_model_clear(etcta->selection); + + etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), + e_table_item_get_type(), + "ETableHeader", etcta->eth, + "ETableModel", etcta->one, + "minimum_width", etcta->width, + "drawgrid", TRUE, + "table_selection_model", etcta->selection, + NULL); + + gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", + GTK_SIGNAL_FUNC(item_key_press), etcta); + + e_table_item_set_cursor(E_TABLE_ITEM(etcta->row), 0, 0); + } +} + /* * Handles the events on the ETableClickToAdd, particularly it creates the ETableItem and passes in some events. */ @@ -300,6 +349,8 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) "table_selection_model", etcta->selection, NULL); + gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", + GTK_SIGNAL_FUNC(item_key_press), etcta); } /* Fall through. No break; */ case GDK_BUTTON_RELEASE: @@ -324,32 +375,7 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) case GDK_Tab: case GDK_KP_Tab: case GDK_ISO_Left_Tab: - - if (etcta->row) { - ETableModel *one; - - e_table_one_commit(E_TABLE_ONE(etcta->one)); - etcta_drop_one (etcta); - gtk_object_destroy(GTK_OBJECT(etcta->row)); - etcta->row = NULL; - - one = e_table_one_new(etcta->model); - etcta_add_one (etcta, one); - gtk_object_unref(GTK_OBJECT(one)); - - e_table_selection_model_clear(etcta->selection); - - etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - e_table_item_get_type(), - "ETableHeader", etcta->eth, - "ETableModel", etcta->one, - "minimum_width", etcta->width, - "drawgrid", TRUE, - "table_selection_model", etcta->selection, - NULL); - - e_table_item_set_cursor(E_TABLE_ITEM(etcta->row), 0, 0); - } + finish_editing (etcta); break; default: break; diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index dc40e57f76..c2aa4d1ffa 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1941,11 +1941,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) eti->editing_col, eti->editing_row, E_CELL_EDITING); #endif } - return_val = e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); - if (!return_val) { - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], - model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); - } + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); + if (!return_val) + return_val = e_table_selection_model_key_press(eti->selection, (GdkEventKey *) e); break; default: |