* src/gnome/dialog-tax-info.c: more work

* src/gnome/dialog-options.c: set apply button sensitivity
	appropriately

	* src/scm/report/average-balance.scm: use option-utilities

	* src/scm/report/transaction-report.scm: use option-utilities

	* src/scm/options-utilities.scm: remove superfluous (begin)'s

	* src/gnome/gnc-html.c: fix compiler warning

	* src/scm/prefs.scm: add new liability/equity debit/credit labels

	* src/register/gnome/pricecell-gnome.c (PriceDirect): don't use
	key stroke if cell value doesn't change

	* src/register/pricecell.c (xaccSetPriceCellValue): return TRUE
	if cell value actually changed


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3842 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-03-27 10:14:19 +00:00
parent eb30788e02
commit 855ecde047
14 changed files with 495 additions and 234 deletions

View File

@ -1,3 +1,28 @@
2001-03-27 Dave Peticolas <dave@krondo.com>
* src/gnome/dialog-tax-info.c: more work
* src/gnome/dialog-options.c: set apply button sensitivity
appropriately
* src/scm/report/average-balance.scm: use option-utilities
* src/scm/report/transaction-report.scm: use option-utilities
* src/scm/options-utilities.scm: remove superfluous (begin)'s
2001-03-26 Dave Peticolas <dave@krondo.com>
* src/gnome/gnc-html.c: fix compiler warning
* src/scm/prefs.scm: add new liability/equity debit/credit labels
* src/register/gnome/pricecell-gnome.c (PriceDirect): don't use
key stroke if cell value doesn't change
* src/register/pricecell.c (xaccSetPriceCellValue): return TRUE
if cell value actually changed
2001-03-27 James LewisMoss <jimdres@mindspring.com>
* src/engine/io-gncxml-v2.c (add_account_local): duh. currency

View File

@ -1108,7 +1108,7 @@ gnc_account_tree_fill(GNCAccountTree *tree,
Account *account = n->data;
PINFO ("acct=%p guid=%s\n",
account, guid_to_string(xaccAccountGetGUID(account)));
account, guid_to_string(xaccAccountGetGUID(account)));
if (tree->view_filter != NULL)
if (!tree->view_filter(account, tree->view_filter_data))

View File

@ -69,6 +69,20 @@ typedef enum {
GNC_RD_WID_REL_BUTTON_POS,
GNC_RD_WID_REL_WIDGET_POS} GNCRdPositions;
static void
gnc_option_dialog_changed (GtkWidget *dialog)
{
GtkWidget *button;
button = gtk_object_get_data (GTK_OBJECT (dialog),
"gnc_option_apply_button");
if (!button)
return;
gtk_widget_set_sensitive (button, TRUE);
}
static void
gnc_option_changed_cb(GtkEditable *editable, gpointer data)
{
@ -81,7 +95,7 @@ gnc_option_changed_cb(GtkEditable *editable, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(raw);
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -94,7 +108,7 @@ gnc_date_option_changed_cb(GtkWidget *dummy, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(option->widget);
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -695,7 +709,7 @@ default_button_cb(GtkButton *button, gpointer data)
option->changed = TRUE;
pbox = gtk_widget_get_toplevel(GTK_WIDGET(button));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static GtkWidget *
@ -725,7 +739,7 @@ gnc_option_toggled_cb(GtkToggleButton *button, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(button));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
@ -754,7 +768,7 @@ gnc_option_multichoice_cb(GtkWidget *w, gint index, gpointer data)
omenu = gtk_object_get_data(GTK_OBJECT(w), "gnc_option_menu");
pbox = gtk_widget_get_toplevel(omenu);
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -787,7 +801,7 @@ gnc_option_rd_combo_cb(GtkWidget *w, gint index, gpointer data)
omenu = gtk_object_get_data(GTK_OBJECT(w), "gnc_option_menu");
pbox = gtk_widget_get_toplevel(omenu);
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static GtkWidget *
@ -971,7 +985,7 @@ gnc_option_account_cb(GNCAccountTree *tree, Account * account, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(tree));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -987,7 +1001,7 @@ gnc_option_account_select_all_cb(GtkWidget *widget, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));*/
gnc_option_dialog_changed (pbox);
}
static void
@ -1003,7 +1017,7 @@ gnc_option_account_clear_all_cb(GtkWidget *widget, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
@ -1089,7 +1103,7 @@ gnc_option_list_select_cb(GtkCList *clist, gint row, gint column,
gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(TRUE));
pbox = gtk_widget_get_toplevel(GTK_WIDGET(clist));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -1106,7 +1120,7 @@ gnc_option_list_unselect_cb(GtkCList *clist, gint row, gint column,
gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(FALSE));
pbox = gtk_widget_get_toplevel(GTK_WIDGET(clist));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -1122,7 +1136,7 @@ gnc_option_list_select_all_cb(GtkWidget *widget, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));*/
gnc_option_dialog_changed (pbox);
}
static void
@ -1138,7 +1152,7 @@ gnc_option_list_clear_all_cb(GtkWidget *widget, gpointer data)
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(widget));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static GtkWidget *
@ -1240,7 +1254,7 @@ gnc_option_color_changed_cb(GnomeColorPicker *picker, guint arg1, guint arg2,
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(picker));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox));*/
gnc_option_dialog_changed (pbox);
}
static void
@ -1255,7 +1269,7 @@ gnc_option_font_changed_cb(GnomeFontPicker *picker, gchar *font_name,
gnc_option_call_option_widget_changed_proc(option);
pbox = gtk_widget_get_toplevel(GTK_WIDGET(picker));
/* gnome_property_box_changed(GNOME_PROPERTY_BOX(pbox)); */
gnc_option_dialog_changed (pbox);
}
static void
@ -1803,15 +1817,23 @@ gnc_options_dialog_notebook(GNCOptionWin * win) {
}
static int
gnc_options_dialog_apply_stub_cb(GtkWidget * w, gpointer data) {
gnc_options_dialog_apply_stub_cb(GtkWidget * w, gpointer data)
{
GNCOptionWin * window = data;
if(window->apply_cb) {
(window->apply_cb)(window, window->apply_cb_data);
GtkWidget *button;
button = gtk_object_get_data (GTK_OBJECT (window->container),
"gnc_option_apply_button");
if (button)
gtk_widget_set_sensitive (button, FALSE);
if (window->apply_cb)
{
window->apply_cb (window, window->apply_cb_data);
return TRUE;
}
else {
else
return FALSE;
}
}
static int
@ -1884,6 +1906,11 @@ gnc_options_dialog_new(gboolean make_toplevel) {
ok_button = gnome_stock_button (GNOME_STOCK_BUTTON_OK);
close_button = gnome_stock_button (GNOME_STOCK_BUTTON_CLOSE);
gtk_widget_set_sensitive (apply_button, FALSE);
gtk_object_set_data (GTK_OBJECT (retval->container),
"gnc_option_apply_button", apply_button);
gtk_signal_connect(GTK_OBJECT(apply_button), "clicked",
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_stub_cb),
retval);

View File

@ -30,6 +30,7 @@
#include "glade-gnc-dialogs.h"
#include "glade-support.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-ui.h"
#include "messages.h"
@ -51,6 +52,7 @@ static struct
typedef struct
{
char *code;
char *payer_name_source;
char *form;
char *description;
@ -68,8 +70,11 @@ typedef struct
GtkWidget * txf_help_text;
GtkWidget * current_account_button;
GHashTable * income_txf_info;
GHashTable * expense_txf_info;
GList * income_txf_infos;
GList * expense_txf_infos;
gboolean income;
gboolean changed;
} TaxInfoDialog;
@ -93,12 +98,12 @@ initialize_getters (void)
}
static void
destroy_txf_info_helper (gpointer key, gpointer value, gpointer data)
destroy_txf_info (gpointer data, gpointer user_data)
{
char *code = key;
TXFInfo *txf_info = value;
TXFInfo *txf_info = data;
g_free (key);
g_free (txf_info->code);
txf_info->code = NULL;
g_free (txf_info->payer_name_source);
txf_info->payer_name_source = NULL;
@ -116,36 +121,45 @@ destroy_txf_info_helper (gpointer key, gpointer value, gpointer data)
}
static void
destroy_txf_info (GHashTable *info)
destroy_txf_infos (GList *infos)
{
g_hash_table_foreach (info, destroy_txf_info_helper, NULL);
g_hash_table_destroy (info);
g_list_foreach (infos, destroy_txf_info, NULL);
g_list_free (infos);
}
static GHashTable *
static void
gnc_tax_info_set_changed (TaxInfoDialog *ti_dialog, gboolean changed)
{
GtkWidget *button;
button = lookup_widget (ti_dialog->dialog, "apply_button");
gtk_widget_set_sensitive (button, changed);
ti_dialog->changed = changed;
}
static GList *
load_txf_info (gboolean income)
{
GHashTable *info;
GList *infos = NULL;
SCM category;
SCM codes;
initialize_getters ();
info = g_hash_table_new (g_str_hash, g_str_equal);
category = gh_eval_str (income ?
"txf-income-categories" :
"txf-expense-categories");
if (category == SCM_UNDEFINED)
{
destroy_txf_info (info);
destroy_txf_infos (infos);
return NULL;
}
codes = gh_call1 (getters.codes, category);
if (!gh_list_p (codes))
{
destroy_txf_info (info);
destroy_txf_infos (infos);
return NULL;
}
@ -153,28 +167,24 @@ load_txf_info (gboolean income)
{
TXFInfo *txf_info;
SCM code_scm;
char *code;
char *str;
SCM scm;
code_scm = gh_car (codes);
codes = gh_cdr (codes);
if (!gh_symbol_p (code_scm))
continue;
txf_info = g_new0 (TXFInfo, 1);
str = gh_symbol2newstr (code_scm, NULL);
if (!str)
continue;
code = g_strdup (str);
txf_info->code = g_strdup (str);
free (str);
txf_info = g_new0 (TXFInfo, 1);
scm = gh_call2 (getters.payer_name_source, category, code_scm);
str = gh_symbol2newstr (scm, NULL);
txf_info->payer_name_source = g_strdup (str);
if (safe_strcmp (str, "none") == 0)
txf_info->payer_name_source = NULL;
else
txf_info->payer_name_source = g_strdup (str);
free (str);
scm = gh_call2 (getters.form, category, code_scm);
@ -192,10 +202,42 @@ load_txf_info (gboolean income)
txf_info->help = g_strdup (str);
free (str);
g_hash_table_insert (info, code, txf_info);
infos = g_list_prepend (infos, txf_info);
}
return info;
return g_list_reverse (infos);
}
static GList *
gnc_tax_info_current_codes (TaxInfoDialog *ti_dialog)
{
return
ti_dialog->income ?
ti_dialog->income_txf_infos : ti_dialog->expense_txf_infos;
}
static void
load_category_list (TaxInfoDialog *ti_dialog)
{
GtkCList *clist = GTK_CLIST (ti_dialog->txf_category_clist);
char *text[1];
GList *codes;
gtk_clist_freeze (clist);
gtk_clist_clear (clist);
codes = gnc_tax_info_current_codes (ti_dialog);
for ( ; codes; codes = codes->next)
{
TXFInfo *txf_info = codes->data;
text[0] = txf_info->code;
gtk_clist_append (clist, text);
}
gtk_clist_thaw (clist);
}
static void
@ -205,11 +247,11 @@ window_destroy_cb (GtkObject *object, gpointer data)
gnc_unregister_gui_component_by_data (DIALOG_TAX_INFO_CM_CLASS, ti_dialog);
destroy_txf_info (ti_dialog->income_txf_info);
ti_dialog->income_txf_info = NULL;
destroy_txf_infos (ti_dialog->income_txf_infos);
ti_dialog->income_txf_infos = NULL;
destroy_txf_info (ti_dialog->expense_txf_info);
ti_dialog->expense_txf_info = NULL;
destroy_txf_infos (ti_dialog->expense_txf_infos);
ti_dialog->expense_txf_infos = NULL;
g_free (ti_dialog);
}
@ -282,6 +324,8 @@ tax_info_show_income_accounts (TaxInfoDialog *ti_dialog, gboolean show_income)
GNCAccountType type;
GNCAccountType show_type;
ti_dialog->income = show_income;
tree = GNC_ACCOUNT_TREE (ti_dialog->account_tree);
show_type = show_income ? INCOME : EXPENSE;
@ -291,6 +335,34 @@ tax_info_show_income_accounts (TaxInfoDialog *ti_dialog, gboolean show_income)
info.include_type[type] = (type == show_type);
gnc_account_tree_set_view_info (tree, &info);
load_category_list (ti_dialog);
}
static void
gnc_tax_info_update_accounts (TaxInfoDialog *ti_dialog)
{
GNCAccountTree *tree;
GtkWidget *label;
GtkWidget *frame;
int num_accounts;
GList *accounts;
char *string;
tree = GNC_ACCOUNT_TREE (ti_dialog->account_tree);
accounts = gnc_account_tree_get_current_accounts (tree);
num_accounts = g_list_length (accounts);
label = lookup_widget (ti_dialog->dialog, "num_accounts_label");
frame = lookup_widget (ti_dialog->dialog, "tax_info_frame");
string = g_strdup_printf ("%d", num_accounts);
gtk_label_set_text (GTK_LABEL (label), string);
g_free (string);
gtk_widget_set_sensitive (frame, num_accounts > 0);
}
static void
@ -305,6 +377,72 @@ gnc_tax_info_income_cb (GtkWidget *w, gpointer data)
gnc_account_tree_refresh (GNC_ACCOUNT_TREE (ti_dialog->account_tree));
gnc_account_tree_expand_all (GNC_ACCOUNT_TREE (ti_dialog->account_tree));
gnc_tax_info_update_accounts (ti_dialog);
}
static void
gnc_tax_info_select_account_cb (GNCAccountTree *tree,
Account *account, gpointer data)
{
TaxInfoDialog *ti_dialog = data;
gnc_tax_info_update_accounts (ti_dialog);
}
static void
gnc_tax_info_unselect_account_cb (GNCAccountTree *tree,
Account *account, gpointer data)
{
TaxInfoDialog *ti_dialog = data;
GList *accounts;
accounts = gnc_account_tree_get_current_accounts (tree);
gnc_tax_info_update_accounts (ti_dialog);
}
static void
txf_code_select_row_cb (GtkCList *clist,
gint row,
gint column,
GdkEventButton *event,
gpointer user_data)
{
TaxInfoDialog *ti_dialog = user_data;
TXFInfo *txf_info;
GtkEditable *ge;
const char *text;
gint pos = 0;
txf_info = g_list_nth_data (gnc_tax_info_current_codes (ti_dialog), row);
ge = GTK_EDITABLE (ti_dialog->txf_help_text);
text = (txf_info && txf_info->help) ? txf_info->help : "";
gtk_editable_delete_text (ge, 0, -1);
gtk_editable_insert_text (ge, text, strlen (text), &pos);
gnc_tax_info_set_changed (ti_dialog, TRUE);
}
static void
tax_related_toggled_cb (GtkToggleButton *togglebutton,
gpointer user_data)
{
TaxInfoDialog *ti_dialog = user_data;
gnc_tax_info_set_changed (ti_dialog, TRUE);
}
static void
current_account_toggled_cb (GtkToggleButton *togglebutton,
gpointer user_data)
{
TaxInfoDialog *ti_dialog = user_data;
gnc_tax_info_set_changed (ti_dialog, TRUE);
}
static void
@ -317,8 +455,8 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
ti_dialog->dialog = dialog;
tido = GTK_OBJECT (dialog);
ti_dialog->income_txf_info = load_txf_info (TRUE);
ti_dialog->expense_txf_info = load_txf_info (FALSE);
ti_dialog->income_txf_infos = load_txf_info (TRUE);
ti_dialog->expense_txf_infos = load_txf_info (FALSE);
gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0,
GTK_SIGNAL_FUNC (tax_info_ok_clicked),
@ -342,6 +480,36 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
/* default to ok */
gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
/* tax information */
{
GtkWidget *button;
GtkWidget *clist;
GtkWidget *text;
button = lookup_widget (dialog, "tax_related_button");
ti_dialog->tax_related_button = button;
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (tax_related_toggled_cb), ti_dialog);
text = lookup_widget (dialog, "txf_help_text");
gtk_text_set_word_wrap (GTK_TEXT (text), TRUE);
ti_dialog->txf_help_text = text;
clist = lookup_widget (dialog, "txf_category_clist");
ti_dialog->txf_category_clist = clist;
gtk_signal_connect (GTK_OBJECT (clist), "select-row",
GTK_SIGNAL_FUNC (txf_code_select_row_cb), ti_dialog);
button = lookup_widget (dialog, "current_account_button");
ti_dialog->current_account_button = button;
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (current_account_toggled_cb),
ti_dialog);
}
/* account tree */
{
GtkWidget *income_radio;
@ -361,6 +529,14 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
gnc_account_tree_refresh (tree);
gnc_account_tree_expand_all (tree);
gtk_signal_connect (GTK_OBJECT(tree), "select_account",
GTK_SIGNAL_FUNC(gnc_tax_info_select_account_cb),
ti_dialog);
gtk_signal_connect (GTK_OBJECT(tree), "unselect_account",
GTK_SIGNAL_FUNC(gnc_tax_info_unselect_account_cb),
ti_dialog);
gtk_widget_show (ti_dialog->account_tree);
scroll = gtk_object_get_data (tido, "account_scroll");
@ -386,6 +562,9 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
GTK_SIGNAL_FUNC (unselect_subaccounts_clicked),
ti_dialog);
}
gnc_tax_info_update_accounts (ti_dialog);
gnc_tax_info_set_changed (ti_dialog, FALSE);
}
static void

View File

@ -5701,14 +5701,17 @@ create_Tax_Information_Dialog (void)
GtkWidget *hbox81;
GtkWidget *account_frame;
GtkWidget *vbox96;
GtkWidget *account_scroll;
GtkWidget *hbox97;
GSList *tax_info_account_type_group = NULL;
GtkWidget *income_radio;
GtkWidget *expense_radio;
GtkWidget *account_scroll;
GtkWidget *hbox98;
GtkWidget *label847733;
GtkWidget *num_accounts_label;
GtkWidget *select_subaccounts_button;
GtkWidget *unselect_subaccounts_button;
GtkWidget *frame40;
GtkWidget *tax_info_frame;
GtkWidget *vbox92;
GtkWidget *tax_related_button;
GtkWidget *hseparator1;
@ -5726,7 +5729,7 @@ create_Tax_Information_Dialog (void)
GtkWidget *parent_account_button;
GtkWidget *dialog_action_area14;
GtkWidget *button73;
GtkWidget *button74;
GtkWidget *apply_button;
GtkWidget *button75;
Tax_Information_Dialog = gnome_dialog_new (_("Tax Information"), NULL);
@ -5758,21 +5761,13 @@ create_Tax_Information_Dialog (void)
gtk_widget_show (vbox96);
gtk_container_add (GTK_CONTAINER (account_frame), vbox96);
account_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (account_scroll);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "account_scroll", account_scroll,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (account_scroll);
gtk_box_pack_start (GTK_BOX (vbox96), account_scroll, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (account_scroll), 3);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (account_scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
hbox97 = gtk_hbox_new (TRUE, 0);
hbox97 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox97);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "hbox97", hbox97,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox97);
gtk_box_pack_start (GTK_BOX (vbox96), hbox97, FALSE, FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox97), 3);
income_radio = gtk_radio_button_new_with_label (tax_info_account_type_group, _("Income"));
tax_info_account_type_group = gtk_radio_button_group (GTK_RADIO_BUTTON (income_radio));
@ -5791,6 +5786,38 @@ create_Tax_Information_Dialog (void)
gtk_box_pack_start (GTK_BOX (hbox97), expense_radio, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (expense_radio), TRUE);
account_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (account_scroll);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "account_scroll", account_scroll,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (account_scroll);
gtk_box_pack_start (GTK_BOX (vbox96), account_scroll, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (account_scroll), 3);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (account_scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
hbox98 = gtk_hbox_new (FALSE, 2);
gtk_widget_ref (hbox98);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "hbox98", hbox98,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox98);
gtk_box_pack_start (GTK_BOX (vbox96), hbox98, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox98), 3);
label847733 = gtk_label_new (_("Accounts Selected:"));
gtk_widget_ref (label847733);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "label847733", label847733,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847733);
gtk_box_pack_start (GTK_BOX (hbox98), label847733, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label847733), 1, 0.5);
num_accounts_label = gtk_label_new (_("0"));
gtk_widget_ref (num_accounts_label);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "num_accounts_label", num_accounts_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (num_accounts_label);
gtk_box_pack_start (GTK_BOX (hbox98), num_accounts_label, FALSE, FALSE, 0);
select_subaccounts_button = gtk_button_new_with_label (_("Select Subaccounts"));
gtk_widget_ref (select_subaccounts_button);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "select_subaccounts_button", select_subaccounts_button,
@ -5807,19 +5834,19 @@ create_Tax_Information_Dialog (void)
gtk_box_pack_start (GTK_BOX (vbox96), unselect_subaccounts_button, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (unselect_subaccounts_button), 3);
frame40 = gtk_frame_new (_("Tax Information"));
gtk_widget_ref (frame40);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "frame40", frame40,
tax_info_frame = gtk_frame_new (_("Tax Information"));
gtk_widget_ref (tax_info_frame);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "tax_info_frame", tax_info_frame,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame40);
gtk_box_pack_start (GTK_BOX (hbox81), frame40, TRUE, TRUE, 0);
gtk_widget_show (tax_info_frame);
gtk_box_pack_start (GTK_BOX (hbox81), tax_info_frame, TRUE, TRUE, 0);
vbox92 = gtk_vbox_new (FALSE, 3);
gtk_widget_ref (vbox92);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "vbox92", vbox92,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox92);
gtk_container_add (GTK_CONTAINER (frame40), vbox92);
gtk_container_add (GTK_CONTAINER (tax_info_frame), vbox92);
gtk_container_set_border_width (GTK_CONTAINER (vbox92), 3);
tax_related_button = gtk_check_button_new_with_label (_("Tax Related"));
@ -5866,6 +5893,7 @@ create_Tax_Information_Dialog (void)
gtk_widget_show (txf_category_clist);
gtk_container_add (GTK_CONTAINER (scrolledwindow18), txf_category_clist);
gtk_clist_set_column_width (GTK_CLIST (txf_category_clist), 0, 80);
gtk_clist_set_selection_mode (GTK_CLIST (txf_category_clist), GTK_SELECTION_BROWSE);
gtk_clist_column_titles_hide (GTK_CLIST (txf_category_clist));
label847671 = gtk_label_new (_("label847671"));
@ -5936,12 +5964,12 @@ create_Tax_Information_Dialog (void)
GTK_WIDGET_SET_FLAGS (button73, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Tax_Information_Dialog), GNOME_STOCK_BUTTON_APPLY);
button74 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);
gtk_widget_ref (button74);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "button74", button74,
apply_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);
gtk_widget_ref (apply_button);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "apply_button", apply_button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button74);
GTK_WIDGET_SET_FLAGS (button74, GTK_CAN_DEFAULT);
gtk_widget_show (apply_button);
GTK_WIDGET_SET_FLAGS (apply_button, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Tax_Information_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button75 = GTK_WIDGET (g_list_last (GNOME_DIALOG (Tax_Information_Dialog)->buttons)->data);

View File

@ -8481,7 +8481,7 @@ words.
<widget>
<class>GtkButton</class>
<name>button74</name>
<name>apply_button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
@ -8525,29 +8525,11 @@ words.
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkScrolledWindow</class>
<name>account_scroll</name>
<border_width>3</border_width>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox97</name>
<homogeneous>True</homogeneous>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>2</padding>
@ -8586,6 +8568,72 @@ words.
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>account_scroll</name>
<border_width>3</border_width>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox98</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>2</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label847733</name>
<label>Accounts Selected:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>num_accounts_label</name>
<label>0</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkButton</class>
<name>select_subaccounts_button</name>
@ -8618,7 +8666,7 @@ words.
<widget>
<class>GtkFrame</class>
<name>frame40</name>
<name>tax_info_frame</name>
<label>Tax Information</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
@ -8697,7 +8745,7 @@ words.
<can_focus>True</can_focus>
<columns>1</columns>
<column_widths>80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<selection_mode>GTK_SELECTION_BROWSE</selection_mode>
<show_titles>False</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>

View File

@ -1645,6 +1645,7 @@ gnc_html_unescape_newlines(const gchar * in) {
char *
gnc_html_escape_newlines(const gchar * in) {
char *out;
const char * ip = in;
GString * escaped = g_string_new("");
@ -1657,13 +1658,12 @@ gnc_html_escape_newlines(const gchar * in) {
}
}
g_string_append_c(escaped, 0);
ip = escaped->str;
out = escaped->str;
g_string_free(escaped, FALSE);
return ip;
return out;
}
/********************************************************************
* gnc_html_generic_get_submit() : normal 'get' submit method.
********************************************************************/

View File

@ -76,7 +76,7 @@ PriceDirect (BasicCell *bcell,
if (gnc_exp_parser_parse(cell->cell.value,
&amount, &error_loc))
xaccSetPriceCellValue (cell, amount);
return xaccSetPriceCellValue (cell, amount);
else
*cursor_position = error_loc - cell->cell.value;

View File

@ -260,13 +260,13 @@ xaccGetPriceCellValue (PriceCell *cell)
return cell->amount;
}
void
gboolean
xaccSetPriceCellValue (PriceCell * cell, gnc_numeric amount)
{
const char *buff;
if (cell == NULL)
return;
return FALSE;
if (cell->fraction > 0)
amount = gnc_numeric_convert (amount, cell->fraction, GNC_RND_ROUND);
@ -275,7 +275,12 @@ xaccSetPriceCellValue (PriceCell * cell, gnc_numeric amount)
buff = xaccPriceCellPrintValue (cell);
cell->need_to_parse = FALSE;
if (safe_strcmp (buff, cell->cell.value) == 0)
return FALSE;
xaccSetBasicCellValueInternal (&cell->cell, buff);
return TRUE;
}
/* ================================================ */

View File

@ -85,8 +85,9 @@ void xaccDestroyPriceCell (PriceCell *cell);
/* return the value of a price cell */
gnc_numeric xaccGetPriceCellValue (PriceCell *cell);
/* updates amount, string format is three decimal places */
void xaccSetPriceCellValue (PriceCell *cell, gnc_numeric amount);
/* updates amount, returns TRUE if string representation
* actually changed */
gboolean xaccSetPriceCellValue (PriceCell *cell, gnc_numeric amount);
/* Sets the fraction used for rounding. If 0, no rounding is performed. */
void xaccSetPriceCellFraction (PriceCell *cell, int fraction);

View File

@ -46,29 +46,28 @@
;; This is a date-interval for a report.
(define (gnc:options-add-date-interval!
options pagename name-from name-to sort-tag)
(begin
(gnc:register-option
options
(gnc:make-date-option
pagename name-from
(string-append sort-tag "a")
(_ "Start of reporting period")
(lambda ()
(cons 'absolute
(gnc:get-start-cal-year)))
#f 'absolute #f))
(gnc:register-option
options
(gnc:make-date-option
pagename name-to
(string-append sort-tag "b")
(_ "End of reporting period")
(lambda ()
(cons 'absolute
(gnc:timepair-end-day-time
(gnc:secs->timepair
(car (mktime (localtime (current-time))))))))
#f 'absolute #f))))
(gnc:register-option
options
(gnc:make-date-option
pagename name-from
(string-append sort-tag "a")
(_ "Start of reporting period")
(lambda ()
(cons 'absolute
(gnc:get-start-cal-year)))
#f 'absolute #f))
(gnc:register-option
options
(gnc:make-date-option
pagename name-to
(string-append sort-tag "b")
(_ "End of reporting period")
(lambda ()
(cons 'absolute
(gnc:timepair-end-day-time
(gnc:secs->timepair
(car (mktime (localtime (current-time))))))))
#f 'absolute #f)))
;; A multichoice option intended to chose the account level. Different
;; from the other functions the help string can still be given. Used
@ -103,34 +102,33 @@
options pagename
name-display-depth name-show-subaccounts name-accounts
sort-tag default-depth default-accounts)
(begin
(gnc:options-add-account-levels!
options pagename name-display-depth
(string-append sort-tag "a")
(_ "Show accounts to this depth, overriding any other option.")
default-depth)
(gnc:options-add-account-levels!
options pagename name-display-depth
(string-append sort-tag "a")
(_ "Show accounts to this depth, overriding any other option.")
default-depth)
(gnc:register-option
options
(gnc:make-simple-boolean-option
pagename name-show-subaccounts
(string-append sort-tag "b")
(_ "Override account-selection and show sub-accounts of all selected accounts?")
#t))
(gnc:register-option
options
(gnc:make-simple-boolean-option
pagename name-show-subaccounts
(string-append sort-tag "b")
(_ "Override account-selection and show sub-accounts of all selected accounts?")
#t))
;; Semantics of the account selection, as used in the
;; gnc:html-build-acct-table: An account shows up if ( the
;; tree-depth is large enough AND ( it is selected in the account
;; selector OR ( always show sub-accounts is selected AND one of
;; the parents is selected in the account selector. )))
(gnc:register-option
options
(gnc:make-account-list-option
pagename name-accounts
(string-append sort-tag "c")
(_ "Report on these accounts, if display depth allows.")
default-accounts
#f #t))))
;; Semantics of the account selection, as used in the
;; gnc:html-build-acct-table: An account shows up if ( the
;; tree-depth is large enough AND ( it is selected in the account
;; selector OR ( always show sub-accounts is selected AND one of
;; the parents is selected in the account selector. )))
(gnc:register-option
options
(gnc:make-account-list-option
pagename name-accounts
(string-append sort-tag "c")
(_ "Report on these accounts, if display depth allows.")
default-accounts
#f #t)))
;; The single checkbox whether to include the sub-account balances
;; into the other balances.
@ -157,20 +155,19 @@
(define (gnc:options-add-currency-selection!
options pagename
name-show-foreign name-report-currency sort-tag)
(begin
(gnc:register-option
options
(gnc:make-simple-boolean-option
pagename name-show-foreign
(string-append sort-tag "a")
(_ "Display the account's foreign currency amount?") #f))
(gnc:register-option
options
(gnc:make-simple-boolean-option
pagename name-show-foreign
(string-append sort-tag "a")
(_ "Display the account's foreign currency amount?") #f))
(gnc:register-option
options
(gnc:make-currency-option
pagename name-report-currency
(string-append sort-tag "b")
(_ "All other currencies will get converted to this currency.")
(gnc:option-value
(gnc:lookup-global-option "International"
"Default Currency"))))))
(gnc:register-option
options
(gnc:make-currency-option
pagename name-report-currency
(string-append sort-tag "b")
(_ "All other currencies will get converted to this currency.")
(gnc:option-value
(gnc:lookup-global-option "International"
"Default Currency")))))

View File

@ -93,13 +93,13 @@
(cons 'CASH (N_ "Receive"))
(cons 'CREDIT (N_ "Payment"))
(cons 'ASSET (N_ "Increase"))
(cons 'LIABILITY (N_ "Debit"))
(cons 'LIABILITY (N_ "Decrease"))
(cons 'STOCK (N_ "Buy"))
(cons 'MUTUAL (N_ "Buy"))
(cons 'CURRENCY (N_ "Buy"))
(cons 'INCOME (N_ "Charge"))
(cons 'EXPENSE (N_ "Expense"))
(cons 'EQUITY (N_ "Debit"))))
(cons 'EQUITY (N_ "Decrease"))))
(define gnc:*credit-strings*
(list (cons 'NO_TYPE (N_ "Funds Out"))
@ -107,13 +107,13 @@
(cons 'CASH (N_ "Spend"))
(cons 'CREDIT (N_ "Charge"))
(cons 'ASSET (N_ "Decrease"))
(cons 'LIABILITY (N_ "Credit"))
(cons 'LIABILITY (N_ "Increase"))
(cons 'STOCK (N_ "Sell"))
(cons 'MUTUAL (N_ "Sell"))
(cons 'CURRENCY (N_ "Sell"))
(cons 'INCOME (N_ "Income"))
(cons 'EXPENSE (N_ "Rebate"))
(cons 'EQUITY (N_ "Credit"))))
(cons 'EQUITY (N_ "Increase"))))
(define (gnc:get-debit-string type)
(_ (assoc-ref gnc:*debit-strings* type)))

View File

@ -24,35 +24,10 @@
(register-option
(lambda (new-option)
(gnc:register-option options new-option))))
;; From date
(register-option
(gnc:make-date-option
(N_ "General") (N_ "From")
"a" (N_ "Report Items from this date")
(lambda ()
(let ((bdtime (localtime (current-time))))
(set-tm:sec bdtime 0)
(set-tm:min bdtime 0)
(set-tm:hour bdtime 0)
(set-tm:mday bdtime 1)
(set-tm:mon bdtime 0)
(cons 'absolute (cons (car (mktime bdtime)) 0))))
#f
'absolute #f))
;; to-date
(register-option
(gnc:make-date-option
(N_ "General") (N_ "To")
"c" (N_ "Report items up to and including this date")
(lambda ()
(let ((bdtime (localtime (current-time))))
(set-tm:sec bdtime 59)
(set-tm:min bdtime 59)
(set-tm:hour bdtime 23)
(cons 'absolute (cons (car (mktime bdtime)) 0))))
#f 'absolute #f))
(gnc:options-add-date-interval!
options (N_ "General") (N_ "From") (N_ "To") "a")
;; account(s) to do report on
(register-option
(gnc:make-account-list-option
@ -398,5 +373,3 @@
'name (N_ "Average Balance")
'options-generator options-generator
'renderer renderer))

View File

@ -292,31 +292,9 @@
(define (gnc:register-trep-option new-option)
(gnc:register-option gnc:*transaction-report-options* new-option))
;; from date
;; hack alert - could somebody set this to an appropriate date?
(gnc:register-trep-option
(gnc:make-date-option
(N_ "Report Options") (N_ "From")
"a" (N_ "Report Items from this date")
(lambda ()
(let ((bdtime (localtime (current-time))))
(set-tm:sec bdtime 0)
(set-tm:min bdtime 0)
(set-tm:hour bdtime 0)
(set-tm:mday bdtime 1)
(set-tm:mon bdtime 0)
(let ((time (car (mktime bdtime))))
(cons 'absolute (cons time 0)))))
#f 'absolute #f))
;; to-date
(gnc:register-trep-option
(gnc:make-date-option
(N_ "Report Options") (N_ "To")
"b" (N_ "Report items up to and including this date")
(lambda () (cons 'absolute (cons (current-time) 0)))
#f 'absolute #f))
(gnc:options-add-date-interval!
gnc:*transaction-report-options*
(N_ "Report Options") (N_ "From") (N_ "To") "a")
;; account to do report on
(gnc:register-trep-option