From 700373e3dddc14df874d0322f324a4af16e0abfa Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 30 Nov 2012 15:48:52 +0000 Subject: [PATCH] wizard now uses inlist SVN revision: 79911 --- src/modules/wizard/e_wizard.c | 88 ++++++++++++++--------------------- src/modules/wizard/e_wizard.h | 1 + 2 files changed, 35 insertions(+), 54 deletions(-) diff --git a/src/modules/wizard/e_wizard.c b/src/modules/wizard/e_wizard.c index 73b9e84e4..e90fe39e3 100644 --- a/src/modules/wizard/e_wizard.c +++ b/src/modules/wizard/e_wizard.c @@ -16,7 +16,7 @@ static E_Popup *pop = NULL; static Eina_List *pops = NULL; static Evas_Object *o_bg = NULL; static Evas_Object *o_content = NULL; -static Eina_List *pages = NULL; +static E_Wizard_Page *pages = NULL; static E_Wizard_Page *curpage = NULL; static int next_ok = 1; static int next_prev = 0; @@ -67,7 +67,6 @@ e_wizard_init(void) EAPI int e_wizard_shutdown(void) { - E_Wizard_Page *pg; E_Object *eo; if (pop) @@ -78,8 +77,8 @@ e_wizard_shutdown(void) EINA_LIST_FREE(pops, eo) e_object_del(eo); - EINA_LIST_FREE(pages, pg) - e_wizard_page_del(pg); + while (pages) + e_wizard_page_del(pages); if (next_timer) ecore_timer_del(next_timer); next_timer = NULL; @@ -91,12 +90,7 @@ EAPI void e_wizard_go(void) { if (!curpage) - { - if (pages) - { - curpage = pages->data; - } - } + curpage = pages; if (curpage) { if (curpage->init) curpage->init(curpage, &need_xdg_desktops, &need_xdg_icons); @@ -118,58 +112,44 @@ e_wizard_go(void) EAPI void e_wizard_apply(void) { - Eina_List *l; E_Wizard_Page *pg; - EINA_LIST_FOREACH(pages, l, pg) + EINA_INLIST_FOREACH(EINA_INLIST_GET(pages), pg) if (pg->apply) pg->apply(pg); } EAPI void e_wizard_next(void) { - E_Wizard_Page *page; - Eina_List *l; - - EINA_LIST_FOREACH(pages, l, page) + if (!curpage) { - if (page == curpage) - { - if (eina_list_next(l)) - { - if (curpage) - { - if (curpage->hide) - curpage->hide(curpage); - curpage->state++; - } - curpage = eina_list_data_get(eina_list_next(l)); - e_wizard_button_next_enable_set(1); - need_xdg_desktops = EINA_FALSE; - need_xdg_icons = EINA_FALSE; - if (curpage->init) - curpage->init(curpage, &need_xdg_desktops, &need_xdg_icons); - curpage->state++; - if (!_e_wizard_check_xdg()) - break; - - _e_wizard_next_eval(); - if ((curpage->show) && (curpage->show(curpage))) - { - curpage->state++; - break; - } - curpage->state++; - } - else - { - /* FINISH */ - e_wizard_apply(); - e_wizard_shutdown(); - return; - } - } + /* FINISH */ + e_wizard_apply(); + e_wizard_shutdown(); + return; } + if (curpage->hide) + curpage->hide(curpage); + curpage->state++; + curpage = EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(curpage)->next, E_Wizard_Page); + if (!curpage) + { + e_wizard_next(); + return; + } + + e_wizard_button_next_enable_set(1); + need_xdg_desktops = EINA_FALSE; + need_xdg_icons = EINA_FALSE; + if (curpage->init) + curpage->init(curpage, &need_xdg_desktops, &need_xdg_icons); + curpage->state++; + if (!_e_wizard_check_xdg()) return; + + _e_wizard_next_eval(); + curpage->state++; + if (curpage->show && curpage->show(curpage)) return; + e_wizard_next(); } EAPI void @@ -213,7 +193,7 @@ e_wizard_page_add(void *handle, pg->hide = hide_cb; pg->apply = apply_cb; - pages = eina_list_append(pages, pg); + pages = (E_Wizard_Page*)eina_inlist_append(EINA_INLIST_GET(pages), EINA_INLIST_GET(pg)); return pg; } @@ -226,7 +206,7 @@ e_wizard_page_del(E_Wizard_Page *pg) // once only then e restarts itself with final wizard page // if (pg->handle) dlclose(pg->handle); if (pg->shutdown) pg->shutdown(pg); - pages = eina_list_remove(pages, pg); + pages = (E_Wizard_Page*)eina_inlist_remove(EINA_INLIST_GET(pages), EINA_INLIST_GET(pg)); free(pg); } diff --git a/src/modules/wizard/e_wizard.h b/src/modules/wizard/e_wizard.h index c2f01d7a9..007ab343a 100644 --- a/src/modules/wizard/e_wizard.h +++ b/src/modules/wizard/e_wizard.h @@ -16,6 +16,7 @@ typedef enum struct _E_Wizard_Page { + EINA_INLIST; void *handle; Evas *evas; int (*init) (E_Wizard_Page *pg, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons);