diff --git a/ChangeLog b/ChangeLog index 3d01a0e6c4..be23437518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ * src/scm/main.scm -- mention bugzilla in the unstable message + * src/backend/file/io-example-account.[ch]: add a flag that signifies + that an account-tree should NOT be included by "select-all" + * src/gnome/druid-hierachy.c: ignore account-trees that are + marked for exclusion from "select-all". + * accounts/C/acctchrt_business.gnucash-xea: mark this account as + "excluded from select-all" + 2003-01-04 David Hampton * src/backend/file/gnc-account-xml-v2.c: diff --git a/accounts/C/acctchrt_business.gnucash-xea b/accounts/C/acctchrt_business.gnucash-xea index 17f3327eff..b3ded18eeb 100644 --- a/accounts/C/acctchrt_business.gnucash-xea +++ b/accounts/C/acctchrt_business.gnucash-xea @@ -8,7 +8,8 @@ Users running a business want to select this instead of other choices. This includes all the accounts you need to run a most businesses, including Payables, Receivables, Income, and Expenses. - + + 1 Assets c53764b4dc9f08210475c5d8ae54cb91 diff --git a/src/backend/file/io-example-account.c b/src/backend/file/io-example-account.c index 7144c6d8aa..fb5a76de7e 100644 --- a/src/backend/file/io-example-account.c +++ b/src/backend/file/io-example-account.c @@ -54,6 +54,7 @@ static short module = MOD_IO; #define GNC_ACCOUNT_SHORT "gnc-act:short-description" #define GNC_ACCOUNT_LONG "gnc-act:long-description" #define GNC_ACCOUNT_TITLE "gnc-act:title" +#define GNC_ACCOUNT_EXCLUDEP "gnc-act:exclude-from-select-all" void gnc_destroy_example_account(GncExampleAccount *gea) @@ -270,6 +271,28 @@ gnc_long_descrip_sixtp_parser_create(void) return sixtp_dom_parser_new(gnc_long_descrip_end_handler, NULL, NULL); } +static gboolean +gnc_excludep_end_handler(gpointer data_for_children, + GSList* data_from_children, GSList* sibling_data, + gpointer parent_data, gpointer global_data, + gpointer *result, const gchar *tag) +{ + GncExampleAccount *gea = + (GncExampleAccount*)((gxpf_data*)global_data)->parsedata; + gint64 val; + + dom_tree_to_integer ((xmlNodePtr)data_for_children, &val); + gea->exclude_from_select_all = (dom_tree_to_integer ? TRUE : FALSE); + + return TRUE; +} + +static sixtp* +gnc_excludep_sixtp_parser_create(void) +{ + return sixtp_dom_parser_new(gnc_excludep_end_handler, NULL, NULL); +} + static gboolean gnc_title_end_handler(gpointer data_for_children, GSList* data_from_children, GSList* sibling_data, @@ -322,6 +345,7 @@ gnc_read_example_account(GNCBook *book, const gchar *filename) GNC_ACCOUNT_TITLE, gnc_titse_sixtp_parser_create(), GNC_ACCOUNT_SHORT, gnc_short_descrip_sixtp_parser_create(), GNC_ACCOUNT_LONG, gnc_long_descrip_sixtp_parser_create(), + GNC_ACCOUNT_EXCLUDEP, gnc_excludep_sixtp_parser_create(), "gnc:account", gnc_account_sixtp_parser_create(), NULL, NULL)) { @@ -355,6 +379,19 @@ write_string_part(FILE *out, const char *tag, const char *data) xmlFreeNode(node); } +static void +write_bool_part(FILE *out, const char *tag, gboolean data) +{ + xmlNodePtr node; + + node = int_to_dom_tree(tag, data); + + xmlElemDump(out, NULL, node); + fprintf(out, "\n"); + + xmlFreeNode(node); +} + gboolean gnc_write_example_account(GncExampleAccount *gea, const gchar *filename) { @@ -375,6 +412,8 @@ gnc_write_example_account(GncExampleAccount *gea, const gchar *filename) write_string_part(out, GNC_ACCOUNT_LONG, gea->long_description); + write_bool_part(out, GNC_ACCOUNT_EXCLUDEP, gea->exclude_from_select_all); + write_account_group(out, gea->group, NULL); fprintf(out, "\n\n"); diff --git a/src/backend/file/io-example-account.h b/src/backend/file/io-example-account.h index d53b4e5614..2a77fc5aa7 100644 --- a/src/backend/file/io-example-account.h +++ b/src/backend/file/io-example-account.h @@ -38,6 +38,7 @@ struct GncExampleAccount_struct AccountGroup *group; gchar *short_description; gchar *long_description; + gboolean exclude_from_select_all; }; typedef struct GncExampleAccount_struct GncExampleAccount; diff --git a/src/gnome/druid-hierarchy.c b/src/gnome/druid-hierarchy.c index 3b28d74809..e2e5fd9d83 100644 --- a/src/gnome/druid-hierarchy.c +++ b/src/gnome/druid-hierarchy.c @@ -464,7 +464,17 @@ static void select_all_clicked (GtkButton *button, gpointer user_data) { - gtk_clist_select_all (get_account_types_clist ()); + // gtk_clist_select_all (get_account_types_clist ()); + GtkCList *clist; + gint row; + + /* Walk the list; select the rows that are not "excluded" */ + clist = get_account_types_clist (); + for (row = 0; row < clist->rows; row++) { + GncExampleAccount *gea = gtk_clist_get_row_data (clist, row); + if (! gea->exclude_from_select_all) + gtk_clist_select_row (clist, row, 0); + } } static void