mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 16:54:04 +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, ".."))
|
if (!strcmp(dptr->d_name, ".") || !strcmp(dptr->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string path = (string) CARD_ROOT + "/" + dptr->d_name + "/apps";
|
openPackagesFromDir((string) CARD_ROOT + "/" +
|
||||||
if (access(path.c_str(), F_OK))
|
dptr->d_name + "/apps");
|
||||||
continue;
|
|
||||||
|
|
||||||
readPackages(path);
|
|
||||||
#ifdef ENABLE_INOTIFY
|
|
||||||
monitors.push_back(new Monitor(path.c_str()));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
}
|
||||||
@ -452,6 +446,18 @@ void Menu::setLinkIndex(int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#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)
|
void Menu::openPackage(std::string path)
|
||||||
{
|
{
|
||||||
/* First try to remove existing links of the same OPK
|
/* First try to remove existing links of the same OPK
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
void openPackage(std::string path);
|
void openPackage(std::string path);
|
||||||
|
void openPackagesFromDir(std::string path);
|
||||||
#ifdef ENABLE_INOTIFY
|
#ifdef ENABLE_INOTIFY
|
||||||
void removePackageLink(std::string path);
|
void removePackageLink(std::string path);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user