diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-11-15 04:47:31 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-11-15 04:47:31 +0800 |
commit | 6c92a88fc703026682269bc5ab0f60f42ee14215 (patch) | |
tree | 956d18372fea312bfe855dd4b0b6975669369d49 /widgets | |
parent | 2829e1602b1d53832d6e6ff441bdeb36c778a70d (diff) | |
download | gsoc2013-evolution-6c92a88fc703026682269bc5ab0f60f42ee14215.tar.gz gsoc2013-evolution-6c92a88fc703026682269bc5ab0f60f42ee14215.tar.zst gsoc2013-evolution-6c92a88fc703026682269bc5ab0f60f42ee14215.zip |
Handle the case where page up or page down goes off the end of the table
2001-11-10 Christopher James Lahey <clahey@ximian.com>
* e-table.c (group_key_press), e-tree.c (item_key_press): Handle
the case where page up or page down goes off the end of the table
or tree.
svn path=/trunk/; revision=14702
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-table.c | 8 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 8724e15dd5..8aceac1332 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -522,6 +522,10 @@ group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper); y -= vadj->value; e_table_get_cell_at (et, 30, y, &row_local, &col_local); + + if (row_local == -1) + row_local = e_table_model_row_count (et->model) - 1; + row_local = e_table_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->selection)); e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->selection), row_local, col_local, key->state); @@ -533,6 +537,10 @@ group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper); y -= vadj->value; e_table_get_cell_at (et, 30, y, &row_local, &col_local); + + if (row_local == -1) + row_local = 0; + row_local = e_table_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->selection)); e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->selection), row_local, col_local, key->state); diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 24db734e2b..2a41c08c93 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -595,9 +595,14 @@ item_key_press (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et) y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper); y -= vadj->value; e_tree_get_cell_at (et, 30, y, &row_local, &col_local); + + if (row_local == -1) + row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1; + row_local = e_tree_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection)); e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); + return_val = 1; break; case GDK_Page_Up: @@ -606,9 +611,14 @@ item_key_press (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et) y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper); y -= vadj->value; e_tree_get_cell_at (et, 30, y, &row_local, &col_local); + + if (row_local == -1) + row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1; + row_local = e_tree_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection)); e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state); + return_val = 1; break; case '=': |