From d3c392c3d3b516f05fbf71020b2f6774ce20ce8c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 11 Jan 2014 14:20:30 +0000 Subject: Initial conversion of netsurf gui to callback vtable --- desktop/gui_factory.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 desktop/gui_factory.c (limited to 'desktop/gui_factory.c') 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; +} -- cgit v1.2.3