summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
blob: fe753635391f5b8a8a725e127a7f6dfc8ab10ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}