* src/backend/file/io-example-account.[ch]: add a flag that signifies

that an account-tree should start selected.
	* src/gnome/druid-hierarchy.c: when loading the example accounts, go
	  through the list and 'select' those that are marked as "start selected"
	* accounts/C/acctchrt_common.gnucash-xea: mark this account tree as
	  "start selected"


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7782 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2003-01-05 19:57:46 +00:00
parent f9d0134156
commit f0e602fa65
5 changed files with 57 additions and 1 deletions

View File

@ -8,6 +8,13 @@
marked for exclusion from "select-all". marked for exclusion from "select-all".
* accounts/C/acctchrt_business.gnucash-xea: mark this account as * accounts/C/acctchrt_business.gnucash-xea: mark this account as
"excluded from select-all" "excluded from select-all"
* src/backend/file/io-example-account.[ch]: add a flag that signifies
that an account-tree should start selected.
* src/gnome/druid-hierarchy.c: when loading the example accounts, go
through the list and 'select' those that are marked as "start selected"
* accounts/C/acctchrt_common.gnucash-xea: mark this account tree as
"start selected"
2003-01-04 David Hampton <hampton@employees.org> 2003-01-04 David Hampton <hampton@employees.org>

View File

@ -9,6 +9,7 @@
<gnc-act:long-description> <gnc-act:long-description>
Most users will want to select this set of accounts. It includes most commonly used accounts (checking, savings, cash, credit card, income, common expenses). Most users will want to select this set of accounts. It includes most commonly used accounts (checking, savings, cash, credit card, income, common expenses).
</gnc-act:long-description> </gnc-act:long-description>
<gnc-act:start-selected>1</gnc-act:start-selected>
<gnc:account version="2.0.0"> <gnc:account version="2.0.0">
<act:name>Assets</act:name> <act:name>Assets</act:name>
<act:id type="new">98f262dfab9a2b99ac42919dcf58d304</act:id> <act:id type="new">98f262dfab9a2b99ac42919dcf58d304</act:id>

View File

@ -55,6 +55,7 @@ static short module = MOD_IO;
#define GNC_ACCOUNT_LONG "gnc-act:long-description" #define GNC_ACCOUNT_LONG "gnc-act:long-description"
#define GNC_ACCOUNT_TITLE "gnc-act:title" #define GNC_ACCOUNT_TITLE "gnc-act:title"
#define GNC_ACCOUNT_EXCLUDEP "gnc-act:exclude-from-select-all" #define GNC_ACCOUNT_EXCLUDEP "gnc-act:exclude-from-select-all"
#define GNC_ACCOUNT_SELECTED "gnc-act:start-selected"
void void
gnc_destroy_example_account(GncExampleAccount *gea) gnc_destroy_example_account(GncExampleAccount *gea)
@ -279,7 +280,7 @@ gnc_excludep_end_handler(gpointer data_for_children,
{ {
GncExampleAccount *gea = GncExampleAccount *gea =
(GncExampleAccount*)((gxpf_data*)global_data)->parsedata; (GncExampleAccount*)((gxpf_data*)global_data)->parsedata;
gint64 val; gint64 val = 0;
dom_tree_to_integer ((xmlNodePtr)data_for_children, &val); dom_tree_to_integer ((xmlNodePtr)data_for_children, &val);
gea->exclude_from_select_all = (dom_tree_to_integer ? TRUE : FALSE); gea->exclude_from_select_all = (dom_tree_to_integer ? TRUE : FALSE);
@ -293,6 +294,28 @@ gnc_excludep_sixtp_parser_create(void)
return sixtp_dom_parser_new(gnc_excludep_end_handler, NULL, NULL); return sixtp_dom_parser_new(gnc_excludep_end_handler, NULL, NULL);
} }
static gboolean
gnc_selected_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 = 0;
dom_tree_to_integer ((xmlNodePtr)data_for_children, &val);
gea->start_selected = (dom_tree_to_integer ? TRUE : FALSE);
return TRUE;
}
static sixtp*
gnc_selected_sixtp_parser_create(void)
{
return sixtp_dom_parser_new(gnc_selected_end_handler, NULL, NULL);
}
static gboolean static gboolean
gnc_title_end_handler(gpointer data_for_children, gnc_title_end_handler(gpointer data_for_children,
GSList* data_from_children, GSList* sibling_data, GSList* data_from_children, GSList* sibling_data,
@ -346,6 +369,7 @@ gnc_read_example_account(GNCBook *book, const gchar *filename)
GNC_ACCOUNT_SHORT, gnc_short_descrip_sixtp_parser_create(), GNC_ACCOUNT_SHORT, gnc_short_descrip_sixtp_parser_create(),
GNC_ACCOUNT_LONG, gnc_long_descrip_sixtp_parser_create(), GNC_ACCOUNT_LONG, gnc_long_descrip_sixtp_parser_create(),
GNC_ACCOUNT_EXCLUDEP, gnc_excludep_sixtp_parser_create(), GNC_ACCOUNT_EXCLUDEP, gnc_excludep_sixtp_parser_create(),
GNC_ACCOUNT_SELECTED, gnc_selected_sixtp_parser_create(),
"gnc:account", gnc_account_sixtp_parser_create(), "gnc:account", gnc_account_sixtp_parser_create(),
NULL, NULL)) NULL, NULL))
{ {

View File

@ -39,6 +39,7 @@ struct GncExampleAccount_struct
gchar *short_description; gchar *short_description;
gchar *long_description; gchar *long_description;
gboolean exclude_from_select_all; gboolean exclude_from_select_all;
gboolean start_selected;
}; };
typedef struct GncExampleAccount_struct GncExampleAccount; typedef struct GncExampleAccount_struct GncExampleAccount;

View File

@ -352,6 +352,18 @@ add_each_gea_to_clist (gpointer data, gpointer user_data)
gtk_clist_set_row_data(clist, row, gea); gtk_clist_set_row_data(clist, row, gea);
} }
static void
select_initial_geas (gpointer data, gpointer user_data)
{
GncExampleAccount *gea = (GncExampleAccount*)data;
GtkCList *clist = GTK_CLIST (user_data);
if (gea->start_selected) {
gint row = gtk_clist_find_row_from_data (clist, gea);
gtk_clist_select_row (clist, row, 0);
}
}
static void static void
on_choose_account_types_prepare (GnomeDruidPage *gnomedruidpage, on_choose_account_types_prepare (GnomeDruidPage *gnomedruidpage,
gpointer arg1, gpointer arg1,
@ -384,6 +396,17 @@ on_choose_account_types_prepare (GnomeDruidPage *gnomedruidpage,
gtk_clist_thaw (clist); gtk_clist_thaw (clist);
g_slist_foreach (list, select_initial_geas, (gpointer)clist);
/* clear out the description/tree */
{
GtkLabel *datext = GTK_LABEL (hierarchy_get_widget
("account_types_description_entry"));
GtkTree *datree = GTK_TREE (hierarchy_get_widget ("account_type_tree"));
gtk_label_set_text (datext, "");
gtk_tree_clear_items (datree, 0, g_list_length (datree->children));
}
g_slist_free (list); g_slist_free (list);
g_free (locale_dir); g_free (locale_dir);