VISIBLE SCM scm_anchor_point_coords_2 (SCM anchor_point) { const char *who = "scm_anchor_point_coords_2"; SCM p = anchor_point; scm_c_assert_list_does_not_end_here (who, anchor_point, p); scm_c_assert_can_be_alist_link (who, anchor_point, p); while (!scm_is_eq (SCM_CAAR (p), scm_symbol__coords ())) { p = SCM_CDR (p); scm_c_assert_list_does_not_end_here (who, anchor_point, p); scm_c_assert_can_be_alist_link (who, anchor_point, p); } return SCM_CDAR (p); }
inline tmscm tmscm_caar (tmscm obj) { return SCM_CAAR (obj); }
static void update_display_lists(gnc_column_view_edit * view) { SCM get_names = scm_c_eval_string("gnc:all-report-template-names"); SCM template_menu_name = scm_c_eval_string("gnc:report-template-menu-name/report-guid"); SCM report_menu_name = scm_c_eval_string("gnc:report-menu-name"); SCM names = scm_call_0(get_names); SCM contents = gnc_option_db_lookup_option(view->odb, "__general", "report-list", SCM_BOOL_F); SCM this_report; SCM selection; const gchar *name; int row, i, id; GtkListStore *store; GtkTreeIter iter; GtkTreePath *path; GtkTreeSelection *tree_selection; /* Update the list of available reports (left selection box). */ row = view->available_selected; if (scm_is_list(view->available_list) && !scm_is_null (view->available_list)) { row = MIN (row, scm_ilength (view->available_list) - 1); selection = scm_list_ref (view->available_list, scm_int2num (row)); } else { selection = SCM_UNDEFINED; } scm_gc_unprotect_object(view->available_list); view->available_list = names; scm_gc_protect_object(view->available_list); store = GTK_LIST_STORE(gtk_tree_view_get_model(view->available)); gtk_list_store_clear(store); if (scm_is_list(names)) { for (i = 0; !scm_is_null(names); names = SCM_CDR(names), i++) { char * str; if (scm_is_equal (SCM_CAR(names), selection)) row = i; scm_dynwind_begin (0); str = scm_to_locale_string (scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F)); name = _(g_strdup (str)); scm_dynwind_free (str); scm_dynwind_end (); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, AVAILABLE_COL_NAME, name, AVAILABLE_COL_ROW, i, -1); } } tree_selection = gtk_tree_view_get_selection(view->available); path = gtk_tree_path_new_from_indices(row, -1); gtk_tree_selection_select_path(tree_selection, path); gtk_tree_path_free(path); /* Update the list of selected reports (right selection box). */ row = view->contents_selected; if (scm_is_list(view->contents_list) && !scm_is_null (view->contents_list)) { row = MIN (row, scm_ilength (view->contents_list) - 1); selection = scm_list_ref (view->contents_list, scm_int2num (row)); } else { selection = SCM_UNDEFINED; } scm_gc_unprotect_object(view->contents_list); view->contents_list = contents; scm_gc_protect_object(view->contents_list); store = GTK_LIST_STORE(gtk_tree_view_get_model(view->contents)); gtk_list_store_clear(store); if (scm_is_list(contents)) { for (i = 0; !scm_is_null(contents); contents = SCM_CDR(contents), i++) { char * str; if (scm_is_equal (SCM_CAR(contents), selection)) row = i; id = scm_num2int(SCM_CAAR(contents), SCM_ARG1, G_STRFUNC); this_report = gnc_report_find(id); scm_dynwind_begin (0); str = scm_to_locale_string (scm_call_1(report_menu_name, this_report)); name = _(g_strdup (str)); scm_dynwind_free (str); scm_dynwind_end (); gtk_list_store_append(store, &iter); gtk_list_store_set (store, &iter, CONTENTS_COL_NAME, name, CONTENTS_COL_ROW, i, CONTENTS_COL_REPORT_COLS, scm_num2int(SCM_CADR(SCM_CAR(contents)), SCM_ARG1, G_STRFUNC), CONTENTS_COL_REPORT_ROWS, scm_num2int(SCM_CADDR(SCM_CAR(contents)), SCM_ARG1, G_STRFUNC), -1); } } tree_selection = gtk_tree_view_get_selection(view->contents); path = gtk_tree_path_new_from_indices(row, -1); gtk_tree_selection_select_path(tree_selection, path); // gtk_tree_view_scroll_to_cell(view->contents, path, NULL, TRUE, 0.5, 0.0); gtk_tree_path_free(path); }