summaryrefslogtreecommitdiffstats
path: root/src/server/ui.c
blob: 62cfc1cd6b05eee6b3942b1eabf398d204d143fb (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Hot Beverage Companion – desktop application ui wrapper
 *
 * Copyright (C) 2018 Gediminas Jakutis
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; version 2.1
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include "util.h"
#include "ui.h"
#include "curses.h"
#include "gtk.h"

static enum uitype chosen = ui_none;

int ui_init(int *argc, char ***argv, enum uitype ui, int nd, struct timespec period)
{
	int ret = A_OK;

	chosen = ui;

	switch (ui) {
	case ui_none:
		/* noop */
		break;
	case ui_file:
		/* TODO: stub */
		break;
	case ui_curses:
		ret = curses_init(nd, period);
		break;
	case ui_gtk:
		ret = gtkui_init(argc, argv, nd, period);
		break;
	default:
		/* noop */
		break;
	}

	return ret;
}

int ui_startloop(void)
{
	int ret = A_OK;

	switch (chosen) {
	case ui_none:
		/* noop */
		break;
	case ui_file:
		/* TODO: stub */
		break;
	case ui_curses:
		ret = curses_loop();
		break;
	case ui_gtk:
		ret = gtkui_loop();
		break;
	default:
		/* noop */
		break;
	}

	return ret;
}