#include <libxml/parser.h>
Data Structures | |
struct | ROXOption |
Typedefs | |
typedef ROXOption | ROXOption |
typedef ROXOption | Option |
typedef void | ROXOptionNotify (void) |
typedef ROXOptionNotify | OptionNotify |
typedef GList *(*) | ROXOptionBuildFn (Option *option, xmlNode *node, gchar *label) |
typedef ROXOptionBuildFn | OptionBuildFn |
Functions | |
void | rox_options_init (const char *project) |
void | rox_options_init_with_domain (const char *project, const char *domain) |
void | rox_option_register_widget (char *name, ROXOptionBuildFn builder) |
void | rox_option_check_widget (ROXOption *option) |
void | rox_option_add_int (ROXOption *option, const gchar *key, int value) |
void | rox_option_add_string (ROXOption *option, const gchar *key, const gchar *value) |
void | rox_options_notify (void) |
void | rox_option_add_notify (ROXOptionNotify *callback) |
void | rox_option_add_saver (ROXOptionNotify *callback) |
GtkWidget * | rox_options_show (void) |
void | options_init (const char *project) |
void | options_init_with_domain (const char *project, const char *domain) |
void | option_check_widget (Option *option) |
void | option_add_int (Option *option, const gchar *key, int value) |
void | option_add_string (Option *option, const gchar *key, const gchar *value) |
void | options_notify (void) |
GtkWidget * | options_show (void) |
Manage a programs options in the same way as ROX-Filer does.
Derived from code written by Thomas Leonard, <tal197@users.sourceforge.net>.
How it works:
On startup:
When the user opens the Options box:
When the user changes an option or clicks on Revert:
When OK is clicked:
typedef ROXOptionBuildFn OptionBuildFn |
typedef ROXOptionNotify OptionNotify |
typedef GList*(*) ROXOptionBuildFn(Option *option, xmlNode *node, gchar *label) |
Type of function used to build custom option widgets
[in,out] | option | option being constructed |
[in] | node | element of the Options.xml file to use in construction |
[in] | label | label to attach to the widget |
typedef void ROXOptionNotify(void) |
Type of function called when the options change
void option_add_int | ( | ROXOption * | option, | |
const gchar * | key, | |||
int | value | |||
) |
Initialise and register a new integer option
[in,out] | option | option to initialize |
[in] | key | name of the option |
[in] | value | default value |
void option_add_string | ( | ROXOption * | option, | |
const gchar * | key, | |||
const gchar * | value | |||
) |
Initialise and register a new string option
[in,out] | option | option to initialize |
[in] | key | name of the option |
[in] | value | default value |
void option_check_widget | ( | ROXOption * | option | ) |
This is called when the widget's value is modified by the user. Reads the new value of the widget into the option and calls the notify callbacks.
[in,out] | option | option to be updated. |
void options_init | ( | const char * | project | ) |
Initialize the options system, normally called by rox_init().
[in] | project | name of program |
void options_init_with_domain | ( | const char * | project, | |
const char * | domain | |||
) |
Initialize the options system, normally called by rox_init_with_domain() if it detects Options.xml
in $APP_DIR.
[in] | project | name of program |
[in] | domain | domain under the control of the programmer. |
void options_notify | ( | void | ) |
Call all the notify callbacks. This should happen after any options have their values changed. Set each option->has_changed flag before calling this function.
GtkWidget* options_show | ( | void | ) |
Allow the user to edit the options. Returns the window widget (you don't normally need this). NULL if already open.
void rox_option_add_int | ( | ROXOption * | option, | |
const gchar * | key, | |||
int | value | |||
) |
Initialise and register a new integer option
[in,out] | option | option to initialize |
[in] | key | name of the option |
[in] | value | default value |
void rox_option_add_notify | ( | ROXOptionNotify * | callback | ) |
Add a callback which will be called after any options have changed their values. If several options change at once, this is called after all changes.
[in] | callback | funtion to call if options change |
void rox_option_add_saver | ( | ROXOptionNotify * | callback | ) |
Call 'callback' after all the options have been saved
[in] | callback | funtion to call when options have been saved |
void rox_option_add_string | ( | ROXOption * | option, | |
const gchar * | key, | |||
const gchar * | value | |||
) |
Initialise and register a new string option
[in,out] | option | option to initialize |
[in] | key | name of the option |
[in] | value | default value |
void rox_option_check_widget | ( | ROXOption * | option | ) |
This is called when the widget's value is modified by the user. Reads the new value of the widget into the option and calls the notify callbacks.
[in,out] | option | option to be updated |
void rox_option_register_widget | ( | char * | name, | |
ROXOptionBuildFn | builder | |||
) |
When parsing the XML file, process an element named 'name' by calling 'builder(option, xml_node, label)'. builder returns the new widgets to add to the options box. name should be a static string. Call rox_option_check_widget() when the widget's value is modified.
Functions to set or get the widget's state can be stored in 'option'. If the option doesn't have a name attribute in Options.xml then ui will be NULL
on entry (this is used for buttons).
[in] | name | name of the type of widget as used in the Options.xml element |
[in] | builder | function called to build the option |
void rox_options_init | ( | const char * | project | ) |
Initialize the options system, normally called by rox_init().
[in] | project | name of program |
void rox_options_init_with_domain | ( | const char * | project, | |
const char * | domain | |||
) |
Initialize the options system, normally called by rox_init_with_domain() if it detects Options.xml
in $APP_DIR.
[in] | project | name of program |
[in] | domain | domain under the control of the programmer. |
void rox_options_notify | ( | void | ) |
Call all the notify callbacks. This should happen after any options have their values changed. Set each option->has_changed flag before calling this function.
GtkWidget* rox_options_show | ( | void | ) |
Allow the user to edit the options. Returns the window widget (you don't normally need this).
NULL
if already open.