From a9a8dfa0b45fd3fa2623a66eeac0f655d7ac1884 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Fri, 22 Dec 2000 08:42:48 +0000 Subject: [PATCH] Make sure register column sizes are saved. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3342 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome/window-register.c | 4 +++- src/register/table-allgui.h | 1 + src/register/table-gnome.c | 41 ++++++++++++++++++++++++------------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index 2b2edeea17..5bccd0c692 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -1135,7 +1135,7 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar) { GNOMEUIINFO_RADIOLIST(style_list), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_TOGGLEITEM(N_("Double Line"), + GNOMEUIINFO_TOGGLEITEM(N_("_Double Line"), N_("Show two lines of information for each " "transaction"), gnc_register_double_line_cb, NULL), @@ -2031,6 +2031,8 @@ regDestroy (xaccLedgerDisplay *ledger) if (regData) { gnc_reg_save_size (regData); + if (ledger->reg && ledger->reg->table) + gnc_table_save_state (ledger->reg->table); gtk_widget_destroy (regData->window); } diff --git a/src/register/table-allgui.h b/src/register/table-allgui.h index 6e886b40b0..4bfa7f8ef7 100644 --- a/src/register/table-allgui.h +++ b/src/register/table-allgui.h @@ -258,6 +258,7 @@ Table * gnc_table_new (TableGetEntryHandler entry_handler, VirtCellDataDeallocator deallocator, VirtCellDataCopy copy); +void gnc_table_save_state (Table *table); void gnc_table_destroy (Table *table); /* These functions check the bounds of virtal locations in the table diff --git a/src/register/table-gnome.c b/src/register/table-gnome.c index 7aad619851..2ba4791862 100644 --- a/src/register/table-gnome.c +++ b/src/register/table-gnome.c @@ -1,5 +1,5 @@ /********************************************************************\ - * table-gnome.c -- implemntation of table object in GNOME * + * table-gnome.c -- implementation of table object in GNOME * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -36,37 +36,36 @@ * Copyright (c) 2000 Dave Peticolas */ +#include "config.h" +#include +#include #include #include #include -#include -#include - #include "global-options.h" -#include "table-allgui.h" -#include "splitreg.h" - #include "gnucash-sheet.h" #include "gnucash-style.h" +#include "splitreg.h" +#include "table-allgui.h" -static void -table_destroy_cb(Table *table) +void +gnc_table_save_state (Table *table) { - int header_widths[CELL_TYPE_COUNT]; GnucashSheet *sheet; + int header_widths[CELL_TYPE_COUNT]; SCM alist; int i; - if (table == NULL) + if (!table) return; if (table->ui_data == NULL) return; - sheet = GNUCASH_SHEET(table->ui_data); + sheet = GNUCASH_SHEET (table->ui_data); for (i = 0; i < CELL_TYPE_COUNT; i++) header_widths[i] = -1; @@ -91,10 +90,24 @@ table_destroy_cb(Table *table) alist = gh_cons (assoc, alist); } - if (!gh_null_p(alist)) + if (!gh_null_p (alist)) gnc_set_option ("__gui", "reg_column_widths", alist); +} - gtk_widget_unref(GTK_WIDGET(sheet)); +static void +table_destroy_cb(Table *table) +{ + GnucashSheet *sheet; + + if (table == NULL) + return; + + if (table->ui_data == NULL) + return; + + sheet = GNUCASH_SHEET (table->ui_data); + + gtk_widget_unref (GTK_WIDGET(sheet)); table->ui_data = NULL; }