1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 02:00:37 +02:00

Add function openPackagesFromDir() to simplify constructor of Menu

This commit is contained in:
Paul Cercueil 2013-07-19 12:01:25 -04:00
parent 36c4205e0e
commit 69b9657af4
2 changed files with 15 additions and 8 deletions

View File

@ -66,14 +66,8 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, ".."))
continue;
string path = (string) CARD_ROOT + "/" + dptr->d_name + "/apps";
if (access(path.c_str(), F_OK))
continue;
readPackages(path);
#ifdef ENABLE_INOTIFY
monitors.push_back(new Monitor(path.c_str()));
#endif
openPackagesFromDir((string) CARD_ROOT + "/" +
dptr->d_name + "/apps");
}
closedir(dirp);
}
@ -452,6 +446,18 @@ void Menu::setLinkIndex(int i) {
}
#ifdef HAVE_LIBOPK
void Menu::openPackagesFromDir(std::string path)
{
if (access(path.c_str(), F_OK))
return;
DEBUG("Opening packages from directory: %s\n", path.c_str());
readPackages(path);
#ifdef ENABLE_INOTIFY
monitors.push_back(new Monitor(path.c_str()));
#endif
}
void Menu::openPackage(std::string path)
{
/* First try to remove existing links of the same OPK

View File

@ -68,6 +68,7 @@ public:
#ifdef HAVE_LIBOPK
void openPackage(std::string path);
void openPackagesFromDir(std::string path);
#ifdef ENABLE_INOTIFY
void removePackageLink(std::string path);
#endif