From 4e1db5423309addc63f2b1d95b7e604b9c6b3057 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 14 Sep 2007 13:58:18 +0000 Subject: [PATCH] mo wiz work. has page infra now and can "run" the pages. SVN revision: 31711 --- src/modules/wizard/e_mod_main.c | 39 +++++++++++++++++++++++------- src/modules/wizard/e_wizard.c | 42 ++++++++++++++++++++++++++------- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/src/modules/wizard/e_mod_main.c b/src/modules/wizard/e_mod_main.c index 34379458f..32007c3e3 100644 --- a/src/modules/wizard/e_mod_main.c +++ b/src/modules/wizard/e_mod_main.c @@ -29,15 +29,34 @@ EAPI E_Module_Api e_modapi = }; -static int t_init (E_Wizard_Page *pg){ +static int t0_init (E_Wizard_Page *pg){ return 1; } -static int t_shutdown (E_Wizard_Page *pg){ +static int t0_shutdown (E_Wizard_Page *pg){ return 1; } -static int t_show (E_Wizard_Page *pg){ +static int t0_show (E_Wizard_Page *pg){ + printf("t0\n"); + return 0; /* 1 == show ui, and wait for user, 0 == just continue */ +} +static int t0_hide (E_Wizard_Page *pg){ + return 1; +} +static int t0_apply (E_Wizard_Page *pg){ + printf("a0\n"); + return 1; +} + +static int t1_init (E_Wizard_Page *pg){ + return 1; +} +static int t1_shutdown (E_Wizard_Page *pg){ + return 1; +} +static int t1_show (E_Wizard_Page *pg){ Evas_Object *ob, *o; + printf("t1\n"); ob = e_widget_list_add(pg->evas, 1, 0); o = e_widget_button_add(pg->evas, "Hello World", NULL, @@ -46,13 +65,14 @@ static int t_show (E_Wizard_Page *pg){ evas_object_show(o); e_wizard_page_show(ob); pg->data = ob; - return 0; + return 1; /* 1 == show ui, and wait for user, 0 == just continue */ } -static int t_hide (E_Wizard_Page *pg){ +static int t1_hide (E_Wizard_Page *pg){ evas_object_del(pg->data); return 1; } -static int t_apply (E_Wizard_Page *pg){ +static int t1_apply (E_Wizard_Page *pg){ + printf("a1\n"); return 1; } @@ -65,6 +85,7 @@ static int t2_shutdown (E_Wizard_Page *pg){ static int t2_show (E_Wizard_Page *pg){ Evas_Object *ob, *o; + printf("t2\n"); ob = e_widget_list_add(pg->evas, 1, 0); o = e_widget_button_add(pg->evas, "Hello to Another World", NULL, @@ -73,13 +94,14 @@ static int t2_show (E_Wizard_Page *pg){ evas_object_show(o); e_wizard_page_show(ob); pg->data = ob; - return 0; + return 1; } static int t2_hide (E_Wizard_Page *pg){ evas_object_del(pg->data); return 1; } static int t2_apply (E_Wizard_Page *pg){ + printf("a2\n"); return 1; } @@ -90,7 +112,8 @@ e_modapi_init(E_Module *m) conf_module = m; e_wizard_init(); - e_wizard_page_add(t_init, t_shutdown, t_show, t_hide, t_apply); + e_wizard_page_add(t0_init, t0_shutdown, t0_show, t0_hide, t0_apply); + e_wizard_page_add(t1_init, t1_shutdown, t1_show, t1_hide, t1_apply); e_wizard_page_add(t2_init, t2_shutdown, t2_show, t2_hide, t2_apply); e_wizard_go(); diff --git a/src/modules/wizard/e_wizard.c b/src/modules/wizard/e_wizard.c index 54083ea32..a688acd26 100644 --- a/src/modules/wizard/e_wizard.c +++ b/src/modules/wizard/e_wizard.c @@ -62,6 +62,7 @@ e_wizard_shutdown(void) e_object_del(E_OBJECT(pops->data)); pops = evas_list_remove_list(pops, pops); } + /* FIXME: remove wizard module */ return 1; } @@ -74,8 +75,25 @@ e_wizard_go(void) } if (curpage) { - if (!curpage->data) curpage->init(curpage); - curpage->show(curpage); + if ((!curpage->data) && (curpage->init)) curpage->init(curpage); + if ((curpage->show) && (!curpage->show(curpage))) + { + e_wizard_next(); + } + } +} + +EAPI void +e_wizard_apply(void) +{ + Evas_List *l; + + for (l = pages; l; l = l->next) + { + E_Wizard_Page *pg; + + pg = l->data; + if (pg->apply) pg->apply(pg); } } @@ -92,14 +110,16 @@ e_wizard_next(void) { if (curpage) { - curpage->hide(curpage); + if (curpage->hide) + curpage->hide(curpage); } curpage = l->next->data; if (!curpage->data) { - curpage->init(curpage); + if (curpage->init) + curpage->init(curpage); } - if (curpage->show(curpage)) + if ((curpage->show) && (curpage->show(curpage))) { break; } @@ -107,7 +127,9 @@ e_wizard_next(void) else { /* FINISH */ - break; + e_wizard_apply(); + e_wizard_shutdown(); + return; } } } @@ -126,14 +148,16 @@ e_wizard_back(void) { if (curpage) { - curpage->hide(curpage); + if (curpage->hide) + curpage->hide(curpage); } curpage = l->prev->data; if (!curpage->data) { - curpage->init(curpage); + if (curpage->init) + curpage->init(curpage); } - if (curpage->show(curpage)) + if ((curpage->show) && (curpage->show(curpage))) { break; }