void gnc_table_refresh_gui (Table * table, gboolean do_scroll) { GnucashSheet *sheet; if (!table) return; if (!table->ui_data) return; g_return_if_fail (GNUCASH_IS_SHEET (table->ui_data)); sheet = GNUCASH_SHEET(table->ui_data); gnucash_sheet_styles_recompile (sheet); gnucash_sheet_table_load (sheet, do_scroll); gnucash_sheet_redraw_all (sheet); }
void gnc_table_init_gui (GtkWidget *widget, gchar * state_key) { GNCHeaderWidths widths; GnucashSheet *sheet; GnucashRegister *greg; Table *table; GList *node; gchar *key; guint value; // Stuff for per-register settings load. g_return_if_fail (widget != NULL); g_return_if_fail (GNUCASH_IS_REGISTER (widget)); PINFO("state_key=%s",state_key); ENTER("widget=%p, data=%p", widget, ""); greg = GNUCASH_REGISTER (widget); sheet = GNUCASH_SHEET (greg->sheet); table = sheet->table; table->gui_handlers.redraw_help = table_ui_redraw_cb; table->gui_handlers.destroy = table_destroy_cb; table->ui_data = sheet; g_object_ref (sheet); /* config the cell-block styles */ widths = gnc_header_widths_new (); if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { node = gnc_table_layout_get_cells (table->layout); for (; node; node = node->next) { BasicCell *cell = node->data; if (cell->expandable) continue; /* Remember whether the column is visible */ key = g_strdup_printf("%s_width", cell->cell_name); // FIXME the actual state loading is currently not implemented value = 0; if (value != 0) gnc_header_widths_set_width (widths, cell->cell_name, value); g_free(key); } } gnucash_sheet_create_styles (sheet); gnucash_sheet_set_header_widths (sheet, widths); gnucash_sheet_compile_styles (sheet); gnucash_sheet_table_load (sheet, TRUE); gnucash_sheet_cursor_set_from_table (sheet, TRUE); gnucash_sheet_redraw_all (sheet); gnc_header_widths_destroy (widths); LEAVE(" "); }
static void gnucash_register_configure (GnucashSheet *sheet, gchar * state_section) { GNCHeaderWidths widths; Table *table; GList *node; gchar *key; guint value; GKeyFile *state_file = gnc_state_get_current(); // Stuff for per-register settings load. g_return_if_fail (sheet != NULL); g_return_if_fail (GNUCASH_IS_SHEET (sheet)); PINFO("state_section=%s",state_section); ENTER("sheet=%p, data=%p", sheet, ""); table = sheet->table; gnc_table_init_gui (table); table->ui_data = sheet; g_object_ref (sheet); /* config the cell-block styles */ widths = gnc_header_widths_new (); if (state_section && gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { node = gnc_table_layout_get_cells (table->layout); for (; node; node = node->next) { BasicCell *cell = node->data; if (cell->expandable) continue; /* Remember whether the column is visible */ key = g_strdup_printf("%s_width", cell->cell_name); value = g_key_file_get_integer (state_file, state_section, key, NULL); if (value != 0) gnc_header_widths_set_width (widths, cell->cell_name, value); g_free(key); } } gnucash_sheet_create_styles (sheet); gnucash_sheet_set_header_widths (sheet, widths); gnucash_sheet_compile_styles (sheet); gnucash_sheet_table_load (sheet, TRUE); gnucash_sheet_cursor_set_from_table (sheet, TRUE); gnucash_sheet_redraw_all (sheet); gnc_header_widths_destroy (widths); LEAVE(" "); }