Skip to content

Commit e9108bf

Browse files
committed
rescan opk when exiting from FunKey menu
Signed-off-by: Michel-FK <[email protected]>
1 parent 168b4be commit e9108bf

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/gmenu2x.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
//for browsing the filesystem
7171
#include <sys/stat.h>
7272
#include <sys/types.h>
73+
#include <dirent.h>
7374

7475
#define DEFAULT_FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSansCondensed.ttf"
7576
#define DEFAULT_FONT_SIZE 12
@@ -656,9 +657,27 @@ void GMenu2X::mainLoop() {
656657
if (button == InputManager::HOME) {
657658
printf("Launch FunKey menu\n");
658659
int res = FunkeyMenu::launch();
659-
if(res == MENU_RETURN_EXIT){
660-
button = InputManager::QUIT;
661-
}
660+
if (res == MENU_RETURN_EXIT) {
661+
button = InputManager::QUIT;
662+
}
663+
#ifdef HAVE_LIBOPK
664+
{
665+
DIR *dirp = opendir(GMENU2X_CARD_ROOT);
666+
if (dirp) {
667+
struct dirent *dptr;
668+
while ((dptr = readdir(dirp))) {
669+
if (dptr->d_type != DT_DIR)
670+
continue;
671+
672+
if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, ".."))
673+
continue;
674+
675+
menu.get()->openPackagesFromDir((string) GMENU2X_CARD_ROOT "/" + dptr->d_name );
676+
}
677+
closedir(dirp);
678+
}
679+
}
680+
#endif
662681
}
663682

664683
/** Global button mapping: QUIT */

0 commit comments

Comments
 (0)