From 4d311889344a6106f5ca8913c6d107cc47119862 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Fri, 9 May 2003 17:14:17 +0000 Subject: don't return on col == -1. update the adjustment to center the cursor. 2003-05-09 Mike Kestner * e-table-item.c (eti_cursor_change): don't return on col == -1. * e-tree.c (tree_canvas_size_allocate): update the adjustment to center the cursor. (hover_timeout): remove unused variable to fix warning svn path=/trunk/; revision=21142 --- widgets/table/e-table-item.c | 2 +- widgets/table/e-tree.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 44aeecebb2..30c03d0c90 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -3121,7 +3121,7 @@ eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti if (eti->old_cursor_row != -1 && view_row != eti->old_cursor_row) e_table_item_redraw_row (eti, eti->old_cursor_row); - if (view_row == -1 || view_col == -1) { + if (view_row == -1) { e_table_item_leave_edit_(eti); eti->old_cursor_row = -1; return; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index bb7e0f44cc..b0c20a4b09 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -747,6 +747,9 @@ tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gdouble width; gdouble height; gdouble item_height; + GtkAdjustment *adj = GTK_LAYOUT(e_tree->priv->table_canvas)->vadjustment; + ETreePath path = e_tree_get_cursor (e_tree); + gint x, y, w, h; GValue *val = g_new0 (GValue, 1); g_value_init (val, G_TYPE_DOUBLE); @@ -763,6 +766,15 @@ tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, NULL); g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val); g_free (val); + + if (path) + e_tree_get_cell_geometry (e_tree, e_tree_row_of_node(e_tree, path), 0, &x, &y, &w, &h); + else + y = h = 0; + + if (y < adj->value || y + h > adj->value + adj->page_size) + gtk_adjustment_set_value(adj, CLAMP(y - adj->page_size / 2, adj->lower, adj->upper - adj->page_size)); + if (e_tree->priv->reflow_idle_id) g_source_remove(e_tree->priv->reflow_idle_id); tree_canvas_reflow_idle(e_tree); @@ -2716,7 +2728,6 @@ static gboolean hover_timeout (gpointer data) { ETree *et = data; - GtkWidget *widget = data; int x = et->priv->hover_x; int y = et->priv->hover_y; int row, col; -- cgit