diff --git a/src/engine/Account.c b/src/engine/Account.c index b2eaef4303..a7e84f8b4d 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1241,6 +1241,50 @@ xaccAccountGetNumSplits (Account *acc) { /********************************************************************\ \********************************************************************/ +gboolean +xaccAccountGetTaxRelated (Account *account) +{ + kvp_value *kvp; + + if (!account) + return FALSE; + + kvp = kvp_frame_get_slot (xaccAccountGetSlots (account), "tax-related"); + if (!kvp) + return FALSE; + + return kvp_value_get_gint64 (kvp); +} + +void +xaccAccountSetTaxRelated (Account *account, gboolean tax_related) +{ + kvp_value *new_value; + + if (!account) + return; + + if (tax_related) + new_value = kvp_value_new_gint64 (tax_related); + else + new_value = NULL; + + xaccAccountBeginEdit (account); + { + CHECK (account); + + kvp_frame_set_slot(xaccAccountGetSlots (account), + "tax-related", new_value); + + if (new_value) + kvp_value_delete(new_value); + } + xaccAccountCommitEdit (account); +} + +/********************************************************************\ +\********************************************************************/ + Account * IthAccount (Account **list, int i) { diff --git a/src/engine/Account.h b/src/engine/Account.h index becfd61ffa..fc7d6c31c9 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -244,10 +244,14 @@ gnc_numeric xaccAccountGetShareBalance (Account *); gnc_numeric xaccAccountGetShareClearedBalance (Account *); gnc_numeric xaccAccountGetShareReconciledBalance (Account *); -Split * xaccAccountGetSplit (Account *acc, int i); -int xaccAccountGetNumSplits (Account *acc); +Split * xaccAccountGetSplit (Account *acc, int i); +int xaccAccountGetNumSplits (Account *acc); -GList* xaccAccountGetSplitList (Account *acc); +GList* xaccAccountGetSplitList (Account *acc); + +gboolean xaccAccountGetTaxRelated (Account *account); +void xaccAccountSetTaxRelated (Account *account, + gboolean tax_related); /* The xaccAccountGetFullName routine returns the fully qualified name * of the account using the given separator char. The name must be freed diff --git a/src/engine/kvp_doc.txt b/src/engine/kvp_doc.txt index 507705c944..278b857239 100644 --- a/src/engine/kvp_doc.txt +++ b/src/engine/kvp_doc.txt @@ -72,6 +72,11 @@ Use: This string holds the old Price Source code used by earlier versions is fully supported. The new version of Finance::Quote uses a different scheme to identify sources for price quotes. +Name: tax-related +Type: gint64 +Entities: Account +Use: A boolean flag indicated whether the Account is tax-related. + Name: user-keys Type: frame Entities: All diff --git a/src/gnome/dialog-account.c b/src/gnome/dialog-account.c index 83d6f39ee0..ffc53516c5 100644 --- a/src/gnome/dialog-account.c +++ b/src/gnome/dialog-account.c @@ -77,6 +77,8 @@ struct _AccountWindow GtkWidget * parent_tree; GtkWidget * source_menu; + GtkWidget * tax_related_button; + gint source; }; @@ -101,6 +103,7 @@ gnc_account_to_ui(AccountWindow *aw) { const gnc_commodity * commodity=NULL; const char *string; + gboolean tax_related; gint pos = 0; string = xaccAccountGetName (aw->account); @@ -127,6 +130,10 @@ gnc_account_to_ui(AccountWindow *aw) gtk_editable_insert_text (GTK_EDITABLE (aw->notes_text), string, strlen(string), &pos); + tax_related = xaccAccountGetTaxRelated (aw->account); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->tax_related_button), + tax_related); + if ((STOCK != aw->type) && (MUTUAL != aw->type) && (CURRENCY != aw->type)) return; @@ -149,6 +156,7 @@ gnc_ui_to_account(AccountWindow *aw) Account *parent_account; const char *old_string; const char *string; + gboolean tax_related; xaccAccountBeginEdit (aw->account); @@ -201,6 +209,10 @@ gnc_ui_to_account(AccountWindow *aw) if (safe_strcmp (string, old_string) != 0) xaccAccountSetNotes (aw->account, string); + tax_related = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->tax_related_button)); + xaccAccountSetTaxRelated (aw->account, tax_related); + parent_account = gnc_account_tree_get_current_account (GNC_ACCOUNT_TREE(aw->parent_tree)); if (parent_account == aw->top_level_account) @@ -1190,6 +1202,8 @@ gnc_account_window_create(AccountWindow *aw) gtk_signal_connect(GTK_OBJECT (aw->parent_tree), "unselect_account", GTK_SIGNAL_FUNC(gnc_parent_tree_select), aw); + aw->tax_related_button = gtk_object_get_data (awo, "tax_related_button"); + if (last_width == 0) gnc_get_window_size("account_win", &last_width, &last_height); diff --git a/src/gnome/glade-gnc-dialogs.c b/src/gnome/glade-gnc-dialogs.c index 151c2af1e7..5488d858dd 100644 --- a/src/gnome/glade-gnc-dialogs.c +++ b/src/gnome/glade-gnc-dialogs.c @@ -3867,6 +3867,7 @@ create_Account_Dialog (void) GtkWidget *frame32; GtkWidget *scrolledwindow9; GtkWidget *notes_text; + GtkWidget *tax_related_button; GtkWidget *dialog_action_area12; GtkWidget *button63; GtkWidget *cancel_button; @@ -4103,6 +4104,14 @@ create_Account_Dialog (void) gtk_container_add (GTK_CONTAINER (scrolledwindow9), notes_text); gtk_text_set_editable (GTK_TEXT (notes_text), TRUE); + tax_related_button = gtk_check_button_new_with_label (_("Tax Related")); + gtk_widget_ref (tax_related_button); + gtk_object_set_data_full (GTK_OBJECT (Account_Dialog), "tax_related_button", tax_related_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (tax_related_button); + gtk_box_pack_start (GTK_BOX (vbox75), tax_related_button, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (tax_related_button), 3); + dialog_action_area12 = GNOME_DIALOG (Account_Dialog)->action_area; gtk_object_set_data (GTK_OBJECT (Account_Dialog), "dialog_action_area12", dialog_action_area12); gtk_widget_show (dialog_action_area12); diff --git a/src/gnome/gnc-dialogs.glade b/src/gnome/gnc-dialogs.glade index 532ec02093..61f118f0e7 100644 --- a/src/gnome/gnc-dialogs.glade +++ b/src/gnome/gnc-dialogs.glade @@ -6053,6 +6053,21 @@ Daily (365) + + + GtkCheckButton + tax_related_button + 3 + True + + False + True + + 0 + False + False + + diff --git a/src/gnome/window-main.c b/src/gnome/window-main.c index 7c60990419..a4c33b298c 100644 --- a/src/gnome/window-main.c +++ b/src/gnome/window-main.c @@ -458,8 +458,8 @@ gnc_refresh_main_window_title() { GtkWidget *main_window; GNCBook *book; - gchar *filename; - gchar *title; + const char *filename; + char *title; main_window = gnc_get_ui_data(); if (main_window == NULL)