From 5eb8fb7fd7438f27f4e899302b5fff702af57109 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 28 Aug 2013 13:49:08 -0400 Subject: [PATCH] Revert "When started, load all OPKs in a thread to boost startup time" Loading dynamically at startup is a very bad idea, as it confuses the "load state before exiting" feature of GMenu2X: the file selector will pass the file to a different program, the cursor will move to select a different app, etc. This reverts commit 5c631d610eabdf27c78693bdae566053166a791a. --- src/menu.cpp | 42 +++++++++++++++++------------------------- src/menu.h | 1 - 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 1e0baff..3711bdc 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #ifdef HAVE_LIBOPK @@ -80,8 +79,23 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts) readLinks(); #ifdef HAVE_LIBOPK - std::thread t(&Menu::openAllPackages, this); - t.detach(); + { + struct dirent *dptr; + DIR *dirp = opendir(CARD_ROOT); + if (dirp) { + while ((dptr = readdir(dirp))) { + if (dptr->d_type != DT_DIR) + continue; + + if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, "..")) + continue; + + openPackagesFromDir((string) CARD_ROOT + "/" + + dptr->d_name + "/apps"); + } + closedir(dirp); + } + } #endif orderLinks(); @@ -98,27 +112,6 @@ Menu::~Menu() { delete *it; } -#ifdef HAVE_LIBOPK -void Menu::openAllPackages(void) -{ - struct dirent *dptr; - DIR *dirp = opendir(CARD_ROOT); - if (dirp) { - while ((dptr = readdir(dirp))) { - if (dptr->d_type != DT_DIR) - continue; - - if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, "..")) - continue; - - openPackagesFromDir((string) CARD_ROOT + "/" + - dptr->d_name + "/apps"); - } - closedir(dirp); - } -} -#endif - void Menu::readSections(std::string parentDir) { DIR *dirp; @@ -758,7 +751,6 @@ void Menu::readPackages(std::string parentDir) } openPackage(parentDir + '/' + dptr->d_name, false); - inject_user_event(); // Notify the InputManager for a repaint } closedir(dirp); diff --git a/src/menu.h b/src/menu.h index cf4be93..c4e5c09 100644 --- a/src/menu.h +++ b/src/menu.h @@ -105,7 +105,6 @@ public: #ifdef HAVE_LIBOPK void openPackage(std::string path, bool order = true); void openPackagesFromDir(std::string path); - void openAllPackages(void); #ifdef ENABLE_INOTIFY void removePackageLink(std::string path); #endif