diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-01-11 14:20:30 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-01-11 14:20:30 +0000 |
commit | d3c392c3d3b516f05fbf71020b2f6774ce20ce8c (patch) | |
tree | bad0d50f6d2d7bfc52774745ce10e69ce0ff5bff /desktop/gui_factory.c | |
parent | a856439afb743c7fa16f51108862b99a1f56c82a (diff) | |
download | netsurf-d3c392c3d3b516f05fbf71020b2f6774ce20ce8c.tar.gz netsurf-d3c392c3d3b516f05fbf71020b2f6774ce20ce8c.tar.bz2 |
Initial conversion of netsurf gui to callback vtable
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r-- | desktop/gui_factory.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c new file mode 100644 index 000000000..fe7536353 --- /dev/null +++ b/desktop/gui_factory.c @@ -0,0 +1,33 @@ + +#include "desktop/gui.h" +#include "desktop/gui_factory.h" + +struct gui_table *guit = NULL; + + +static void gui_default_quit(void) +{ +} + +nserror gui_factory_register(struct gui_table *gt) +{ + /* ensure not already initialised */ + if (guit != NULL) { + return NSERROR_INIT_FAILED; + } + + /* check the mandantory fields are set */ + + if (gt->poll == NULL) { + return NSERROR_BAD_PARAMETER; + } + + /* fill in the optional entries with defaults */ + if (gt->quit == NULL) { + gt->quit = &gui_default_quit; + } + + guit = gt; + + return NSERROR_OK; +} |