OK, we've continued discussing this on IRC, and it turns out that like many things in life it's more complex than I first envisiaged. Not only do we need to record which accounts contain transactions related to a stock, for later tax reporting purposes we need to differentiate between interest, dividends, short and long term capital gains, and "other" on the income side, and commission and "other" on the expense side. Secondly, while a druid will probably be the way to go for account entry, we'll still need a paned conventional dialog for account editing. Therefore, we need to build an interface that lets the user specify a number of accounts, as well as specify the category of income (expense) for each account selected. The idea would probably be to have a conventional account tree on the left, with a button with a right arrow and saying "add", which adds the selected account to the left button. Next would be a two-column alphabetically-ordered list display (we'll call this the "related" list) of the accounts that have been added to the "related" group. The second column lists which category (interest, CG, dividend) the account is going to be placed under. To the right of the related list is a clist which allows the user to choose the category for the account selected in the "related" list. I was initally proposing that the dialog should insist that at least one expense and income account be specified, but I'm no longer convinced that it is necessary. If people don't want to record income and expenses for stocks, we don't need to insist. As far as the back end is concerned, The API for storing/accessing this information would be as follows: /* * account_list is a list of account *'s, all of which much be expense * accounts */ typedef enum {GNC_TR_INC_MISC, GNC_TR_INC_INTEREST, GNC_TR_INC__DIVIDEND, GNC_TR_INC_LT_CG, GNC_TR_INC_ST_CG} GNCTrackingIncomeCategory; typedef enum {GNC_TR_EXP_MISC, GNC_TR_EXP_COMMISSION} GNCTrackingExpenseCategory; /* * account_list is a list of account *'s, all of which much be expense * accounts. You can clear associations by setting account_list to NULL */ void gnc_tracking_associate_income_accounts(Account *stock_account, GNCTrackingIncomeCategory category, GList *account_list); void gnc_tracking_asssociate_expense_account(Account *stock_account, GNCTrackingExpenseCategory category, GList *account_list); /* * returns a list of account *'s, * returns null if no association specified */ GList *gnc_tracking_find_expense_accounts(Account *stock_account, GNCTrackingExpenseCategory category); GList *gnc_tracking_find_income_accounts(Account *stock_account, GNCTrackingIncomeCategory category); /* for ROI purposes we don't care about categories, these are "grab all" for that purpose */ GList *gnc_tracking_find_all_expense_accounts(Account *stock_account); GList *gnc_tracking_find_all_income_accounts(Account *stock_account); /* * reverse lookup - obviously returns a stock account (or NULL if none * associated), and argument must be an income or expense account * Account *gnc_tracking_find_stock_account(Account *inc_or_expense_acc); Note that this interface will need to be g-wrapped (with the new g-wrap this shouldn't present a problem). Implementation of backend: a frame with key "expense accounts" would be created in each stock account, as would a frame "income accounts". The value of these frame would itself be another frame, containing keys for each category and each value being a list of account GUIDs. Income and expense accounts associated with a stock account would would have a kvp associating "stock account" with the account GUID for the stock account. Comments invited. ------------------------------------------------------------ Robert Merkel [EMAIL PROTECTED] "We are excited and optimistic about its usage going forward and, yes, we can teach penguins the military close-order drill", Mark Norton, US Department of Defense. ------------------------------------------------------------ _______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel