mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 04:50:38 +02:00
Add function openPackagesFromDir() to simplify constructor of Menu
This commit is contained in:
parent
36c4205e0e
commit
69b9657af4
22
src/menu.cpp
22
src/menu.cpp
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user