Add tax-related Account flags, including GUI and guile wrapping.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3181 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-11-20 08:49:58 +00:00
parent 0b0a6bd0d8
commit e49fce1712
7 changed files with 96 additions and 5 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -6053,6 +6053,21 @@ Daily (365)
</widget>
</widget>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>tax_related_button</name>
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Tax Related</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>

View File

@ -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)