From e9108bf0876f33c0ddd501da56b3872ee300e850 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Wed, 13 Jan 2021 21:54:49 +0100 Subject: [PATCH] rescan opk when exiting from FunKey menu Signed-off-by: Michel-FK --- src/gmenu2x.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index fcac51be..489b26b9 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -70,6 +70,7 @@ //for browsing the filesystem #include #include +#include #define DEFAULT_FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed.ttf" #define DEFAULT_FONT_SIZE 12 @@ -656,9 +657,27 @@ void GMenu2X::mainLoop() { if (button == InputManager::HOME) { printf("Launch FunKey menu\n"); int res = FunkeyMenu::launch(); - if(res == MENU_RETURN_EXIT){ - button = InputManager::QUIT; - } + if (res == MENU_RETURN_EXIT) { + button = InputManager::QUIT; + } +#ifdef HAVE_LIBOPK + { + DIR *dirp = opendir(GMENU2X_CARD_ROOT); + if (dirp) { + struct dirent *dptr; + while ((dptr = readdir(dirp))) { + if (dptr->d_type != DT_DIR) + continue; + + if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, "..")) + continue; + + menu.get()->openPackagesFromDir((string) GMENU2X_CARD_ROOT "/" + dptr->d_name ); + } + closedir(dirp); + } + } +#endif } /** Global button mapping: QUIT */