RFC: refactoring window-register as widget-register + containing window

Derek Atkins warlord@MIT.EDU
25 Nov 2001 13:01:27 -0500


Josh Sled <jsled@asynchronous.org> writes:

> I'm attempting to fix something that came up earlier in the course
> of Scheduled Transaction UI development... where I needed to
> cut-and-paste a bunch of code from src/gnome/window-register.c into
> dialog-scheduledxaction.c to get a register in the SX Editor.  I decided
> at the time that that was a to-be-short-term-lived hack to see if/how
> it all worked, and that something like this would be necessary, later.
> Now, as the SX since-last-run dialog wants two more "embedded" registers,
> it seems like time to do it.
> 
> As this is a fairly major change, I'd like input before proceeding
> much further [i.e., actually making the changes], and definitely before
> committing back.
> 
> ...jsled

I've got a different (but related) problem..  With Order/Invoice
entries, I need something that looks like the Split Ledger but is
different..

So, I was wondering if there were some way to refactor the SplitLedger
into something more abstract?  In doing this I'll probably wind up
re-inventing the register core, but what I was thinking was that we
could have a way to register cell-types with the split ledger, or
rather, register the functions used to create/modify "Splits":

	gpointer (*newSplit) (GNCBook *, ...);
	void (*setFCN) (gpointer entry, gpointer new_data);
	gpointer (*getFCN) (gpointer entry);

	void setCell (Cell, char * title, getFCN, setFCN);

Then instead of requiring Splits, the SplitLedger could be used to
store, say, a bunch of GncEntry	objects for an Order and Invoice.
It would also allow other registers to have the same look-and-feel
as the current SplitLedger.

I need to flush out these ideas a bit more, but I'm trying to prevent
the case where I have to re-implement the SplitLedger because the
Business objects don't use Splits and Transactions, even though they
"look" almost exactly the same.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available