From: Ben Pfaff Date: Fri, 9 Nov 2012 06:51:08 +0000 (-0800) Subject: psppire-data-sheet: Set cursor on row in psppire_data_sheet_show_variable(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67af165ac29e2daadf950a84b536b6b7b408a31;p=pspp psppire-data-sheet: Set cursor on row in psppire_data_sheet_show_variable(). psppire_data_sheet_show_variable() only ensured that the variable in question was visible in the data sheet. This commit makes it also put the cursor on the variable's column. This affects the function's two callers: the Find Dialog now selects a cell instead of an entire row, and double-clicking a row number in the variable sheet now does likewise. This solves a problem reported by John Darrington, who reported that double-clicking on a row number in the variable sheet did not change the selected cell but only switched to the data sheet. --- diff --git a/src/ui/gui/psppire-data-sheet.c b/src/ui/gui/psppire-data-sheet.c index 6714bfb90e..4960a83836 100644 --- a/src/ui/gui/psppire-data-sheet.c +++ b/src/ui/gui/psppire-data-sheet.c @@ -1056,8 +1056,17 @@ psppire_data_sheet_show_variable (PsppireDataSheet *data_sheet, column = psppire_data_sheet_find_column_for_variable (data_sheet, dict_index); if (column != NULL) - pspp_sheet_view_scroll_to_cell (sheet_view, NULL, column, - FALSE, 0.0, 0.0); + { + GtkTreePath *path; + + gint row = psppire_data_sheet_get_current_case (data_sheet); + path = gtk_tree_path_new_from_indices (row >= 0 ? row : 0, -1); + + pspp_sheet_view_scroll_to_cell (sheet_view, path, column, + FALSE, 0.0, 0.0); + pspp_sheet_view_set_cursor (sheet_view, path, column, FALSE); + gtk_tree_path_free (path); + } } struct variable *