diff --git a/src/modules/userinterface/legacymenu/mainscreens/exitmenu.cpp b/src/modules/userinterface/legacymenu/mainscreens/exitmenu.cpp index 1ea3b5cd9..49bba0db2 100644 --- a/src/modules/userinterface/legacymenu/mainscreens/exitmenu.cpp +++ b/src/modules/userinterface/legacymenu/mainscreens/exitmenu.cpp @@ -25,8 +25,7 @@ #include "mainmenu.h" -static void *exitmenuHandle = NULL; -static void *exitMainMenuHandle = NULL; +static void *MenuHandle = NULL; static void onAcceptExit(void * /* dummy */) @@ -34,29 +33,6 @@ onAcceptExit(void * /* dummy */) LegacyMenu::self().quit(); } -void* exitMenuInit(void *prevMenu, void *menuHandle) -{ - if (menuHandle) { - GfuiScreenRelease(menuHandle); - } - - menuHandle = GfuiScreenCreate(); - - void *param = GfuiMenuLoad("exitmenu.xml"); - - GfuiMenuCreateStaticControls(menuHandle, param); - GfuiMenuCreateButtonControl(menuHandle, param, "yesquit", NULL, onAcceptExit); - GfuiMenuCreateButtonControl(menuHandle, param, "nobacktogame", prevMenu, GfuiScreenActivate); - - GfParmReleaseHandle(param); - - GfuiMenuDefaultKeysAdd(menuHandle); - GfuiAddKey(menuHandle, GFUIK_RETURN, "Yes, quit the game", NULL, onAcceptExit, NULL); - GfuiAddKey(menuHandle, GFUIK_ESCAPE, "No, back to the game", prevMenu, GfuiScreenActivate, NULL); - - return menuHandle; -} - /* * Function * ExitMenuInit @@ -65,23 +41,34 @@ void* exitMenuInit(void *prevMenu, void *menuHandle) * init the exit menus * * Parameters - * none + * prevMenu : Handle of the menu to activate when cancelling the exit action. * * Return - * 0 ok -1 nok + * The menu handle * * Remarks * */ -void* ExitMenuInit(void *menu) -{ - exitmenuHandle = exitMenuInit(menu, exitmenuHandle); - return exitmenuHandle; -} - -void* MainExitMenuInit(void *mainMenu) +void* ExitMenuInit(void *prevMenu) { - exitMainMenuHandle = exitMenuInit(mainMenu, exitMainMenuHandle); - return exitMainMenuHandle; + if (MenuHandle) { + GfuiScreenRelease(MenuHandle); + } + + MenuHandle = GfuiScreenCreate(); + + void *param = GfuiMenuLoad("exitmenu.xml"); + + GfuiMenuCreateStaticControls(MenuHandle, param); + GfuiMenuCreateButtonControl(MenuHandle, param, "yesquit", NULL, onAcceptExit); + GfuiMenuCreateButtonControl(MenuHandle, param, "nobacktogame", prevMenu, GfuiScreenActivate); + + GfParmReleaseHandle(param); + + GfuiMenuDefaultKeysAdd(MenuHandle); + GfuiAddKey(MenuHandle, GFUIK_RETURN, "Yes, quit the game", NULL, onAcceptExit, NULL); + GfuiAddKey(MenuHandle, GFUIK_ESCAPE, "No, back to the game", prevMenu, GfuiScreenActivate, NULL); + + return MenuHandle; } diff --git a/src/modules/userinterface/legacymenu/mainscreens/exitmenu.h b/src/modules/userinterface/legacymenu/mainscreens/exitmenu.h index 1a3034b0a..a548fd56b 100644 --- a/src/modules/userinterface/legacymenu/mainscreens/exitmenu.h +++ b/src/modules/userinterface/legacymenu/mainscreens/exitmenu.h @@ -22,8 +22,7 @@ #define _EXITMENU_H_ -extern void* ExitMenuInit(void *menu); -extern void* MainExitMenuInit(void *mainMenu); +extern void* ExitMenuInit(void *prevMenu); #endif /* _EXITMENU_H_ */