> > > > int gnucash_lowlev_app_init(); > > > int gnucash_lowlev_app_main(); > > > int gnucash_ui_open_file(const char name[]); > > > int gnucash_ui_select_file(); > > > > > > Each UI needs to provide these, > > > The function gnucash_lowlev_app_init() was just supposed to do > whatever part of initialization was necessary so that when it > finishes, it is OK to make UI calls like gnucash_ui_open_file(). > gnucash_lowlev_app_main() is where you finally end up, and should > contain the UI's main loop. gnucash_ui_open_file() and > gnucash_ui_select_file() are just the helper functions that you can > call (from C or Guile) to open a file or pop up a file selection > dialog respectively. > > The current startup procedure looks (roughly) like this: > > main(argc,argv):/main.c > gnucash_main(argc,argv) --- guile/gnucash.c > /* startup Guile */ > gnucash_main_helper() --- guile/gnucash.c > /* Publish the C functions we need at the Guile level */ > /* Enter Guile */ --- prefs/startup.scm > ;; Process arguments > (gnucash:lowlev-app-init) > (if (pair? gnucash:*command-line-remaining*) > (gnucash:ui-open-file (car gnucash:*command-line-remaining*)) > (gnucash:ui-select-file)) > (gnucash:lowlev-app-main) > > > the sample src/guile/simple-app.c does a #include > > I assume this is a typo? > > This file is horrendously out of date. It was the old prefs/gnucash.c > file. I just renamed it so that it wouldn't be confused with > guile/gnucash.c and haven't gotten around to updating it. Don't look > at that file :> > We now have shutdown-hook and startup-hook, and the user can add their own functions to these with (gnc:hook-add-dangler ...). There are also two new functions on the C side which should be respected (from gnucash.h): void gnc_shutdown(const int exit_status); /* All C code should call this function to exit. It makes sure both the C and Scheme sides are cleaned up (including calling any scheme shutdown hooks) before it calls exit(). */ /* Private (normally you shouldn't be calling these */ void _gnc_shutdown_(const int exit_status); /* Any code that needs to be called to clean up the C side should be put in here. Don't put it anywhere else or it may not be called if a quit is initiated from the scheme side. */ I've fixed the C side to respect gnc_shutdown (in closeMainWindow), but any future exit's should also be handled through this function. -- Rob Browning PGP=E80E0D04F521A094 532B97F5D64E3930 ----- %< -------------------------------------------- >% ------