summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r--desktop/gui_factory.c33
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;
+}