Remove grid gui module
[qi-bootmenu.git] / gui.c
blob1a647b2e2f4336c512bb2d4d72b4dd7aa529460c
1 static void gui_show_error(const char *errstr, ...) {
2 va_list ap;
4 va_start(ap, errstr);
6 if (gui->error)
7 gui->error(errstr, ap);
9 vfprintf(stderr, errstr, ap);
10 fprintf(stderr, "\n");
11 va_end(ap);
14 static void gui_item_clicked(void *data, Evas *evas, Evas_Object *item, void *event) {
15 MenuItem *menu = data;
16 if (gui->select)
17 gui->select(item);
18 menu->callback(menu->data);
19 if (gui->deselect)
20 gui->deselect(item);
23 static void poweroff(void *data) {
24 umount_all();
25 system("poweroff");
28 static void boot_nand(void *data) {
29 BootItem *nand = scan_partition((const char *)data);
30 if (!nand) {
31 gui_show_error("No kernel found in NAND Flash");
32 return;
35 boot_kernel(nand);
38 static void gui_bootitem_clicked(void *data) {
39 boot_kernel((BootItem*)data);
42 static bool gui_init(){
43 if (!ecore_init() || !ecore_evas_init())
44 return false;
46 /* XXX: fixed dimensions */
47 ee = ecore_evas_new(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
49 if (!ee)
50 return false;
52 ecore_evas_title_set(ee, APPNAME);
53 ecore_evas_borderless_set(ee, 0);
54 ecore_evas_show(ee);
56 evas = ecore_evas_get(ee);
57 if (!evas)
58 return false;
60 evas_font_path_append(evas, FONT_PATH);
62 return true;