* src/gnome-util/dialog-options.[ch]: Create an option-type

database so that modules can define new option-types and plug them
	into Gnucash.  Break apart the existing "if type == blah; else if
	type == blah blah..." code and use the new options-type database.
	New options require the implementation of three functions,
	set_widget(), set_value(), and get_value().


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6918 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-05-27 02:48:19 +00:00
parent 1d7c3ea829
commit 706df53175
4 changed files with 1203 additions and 858 deletions

View File

@ -1,3 +1,12 @@
2002-05-26 Derek Atkins <derek@ihtfp.com>
* src/gnome-util/dialog-options.[ch]: Create an option-type
database so that modules can define new option-types and plug them
into Gnucash. Break apart the existing "if type == blah; else if
type == blah blah..." code and use the new options-type database.
New options require the implementation of three functions,
set_widget(), set_value(), and get_value().
2002-05-24 Derek Atkins <derek@ihtfp.com>
* src/engine/GNCId.c: Implement xaccForeachEntity() as a which

File diff suppressed because it is too large Load Diff

View File

@ -57,4 +57,38 @@ void gnc_show_options_dialog(void);
void gnc_build_options_dialog_contents(GNCOptionWin *win,
GNCOptionDB *odb);
/*****************************************************************/
/* Option Registration */
/* Function to set the UI widget based upon the option */
typedef GtkWidget *
(*GNCOptionUISetWidget) (GNCOption *option, GtkBox *page_box,
GtkTooltips *tooltips,
char *name, char *documentation,
/* Return values */
GtkWidget **enclosing, gboolean *packed);
/* Function to set the UI Value for a particular option */
typedef gboolean
(*GNCOptionUISetValue) (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value);
/* Function to get the UI Value for a particular option */
typedef SCM
(*GNCOptionUIGetValue) (GNCOption *option, GtkWidget *widget);
typedef struct gnc_option_def {
const char * option_name;
GNCOptionUISetWidget set_widget;
GNCOptionUISetValue set_value;
GNCOptionUIGetValue get_value;
} GNCOptionDef_t;
/* Register a new option type in the UI */
void gnc_options_ui_initialize (void);
void gnc_options_ui_register_option (GNCOptionDef_t *option);
GNCOptionDef_t * gnc_options_ui_get_option (const char *option_name);
#endif /* OPTIONS_DIALOG_H */

View File

@ -12,6 +12,8 @@
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "dialog-options.h"
/* version of the gnc module system interface we require */
int libgncmod_gnome_utils_LTX_gnc_module_system_interface = 0;
@ -63,6 +65,10 @@ libgncmod_gnome_utils_LTX_gnc_module_init(int refcount) {
/* publish g-wrapped bindings */
lmod("(g-wrapped gw-gnome-utils)");
lmod("(gnucash gnome-utils)");
/* Initialize the options-ui database */
if (refcount == 0)
gnc_options_ui_initialize ();
return TRUE;
}