Bug 668349 - Scroll to selected accounts in QIF import tree views

This commit is contained in:
Robert Fewell
2019-05-07 15:51:25 +01:00
parent d7b40c788b
commit 35b3d6d187
2 changed files with 11 additions and 11 deletions

View File

@@ -288,7 +288,6 @@ static void
update_account_picker_page (QIFImportWindow * wind, SCM make_display,
GtkWidget *view, SCM map_info, SCM * display_info)
{
SCM get_qif_name = scm_c_eval_string ("qif-map-entry:qif-name");
SCM get_gnc_name = scm_c_eval_string ("qif-map-entry:gnc-name");
SCM get_new = scm_c_eval_string ("qif-map-entry:new-acct?");
@@ -339,20 +338,19 @@ update_account_picker_page (QIFImportWindow * wind, SCM make_display,
/* move to the old selected row */
prev_row = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(store), PREV_ROW));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
if (prev_row != -1)
{
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
path = gtk_tree_path_new_from_indices (prev_row, -1);
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
}
else
{
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
path = gtk_tree_path_new_from_indices (0, -1);
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
}
gtk_tree_selection_select_path (selection, path);
/* scroll the tree view so the selection is visable if there are rows */
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL(store), NULL) > 0)
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), path, NULL, TRUE, 0.5, 0.0);
gtk_tree_path_free (path);
}

View File

@@ -202,6 +202,8 @@ build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
{
gtk_tree_view_expand_to_path(picker->treeview, path);
gtk_tree_selection_select_path(selection, path);
gtk_tree_view_scroll_to_cell (picker->treeview, path,
NULL, TRUE, 0.5, 0.0);
gtk_tree_path_free(path);
}
gtk_tree_row_reference_free(reference);