mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 18:09:43 +02:00
Remove all links of an OPK when moved out of the monitored folder
It was previously removing only one link, but an OPK can provide multiples links.
This commit is contained in:
parent
13b3d8e0ca
commit
dfad7c39a7
10
src/menu.cpp
10
src/menu.cpp
@ -541,6 +541,8 @@ void Menu::readPackages(std::string parentDir)
|
|||||||
#ifdef ENABLE_INOTIFY
|
#ifdef ENABLE_INOTIFY
|
||||||
void Menu::removePackageLink(std::string path)
|
void Menu::removePackageLink(std::string path)
|
||||||
{
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
for (vector< vector<Link*> >::iterator section = links.begin();
|
for (vector< vector<Link*> >::iterator section = links.begin();
|
||||||
section < links.end(); section++) {
|
section < links.end(); section++) {
|
||||||
for (vector<Link*>::iterator link = section->begin();
|
for (vector<Link*>::iterator link = section->begin();
|
||||||
@ -549,19 +551,21 @@ void Menu::removePackageLink(std::string path)
|
|||||||
if (!app || !app->isOpk() || app->getOpkFile().empty())
|
if (!app || !app->isOpk() || app->getOpkFile().empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (app->isOpk() && app->getOpkFile().compare(path) == 0) {
|
if (app->getOpkFile().compare(path) == 0) {
|
||||||
DEBUG("Removing link corresponding to package %s\n",
|
DEBUG("Removing link corresponding to package %s\n",
|
||||||
app->getOpkFile().c_str());
|
app->getOpkFile().c_str());
|
||||||
section->erase(link);
|
section->erase(link);
|
||||||
if (section - links.begin() == iSection
|
if (section - links.begin() == iSection
|
||||||
&& iLink == (int) section->size())
|
&& iLink == (int) section->size())
|
||||||
setLinkIndex(iLink - 1);
|
setLinkIndex(iLink - 1);
|
||||||
return;
|
found = true;
|
||||||
|
link--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR("Unable to find link corresponding to %s\n", path.c_str());
|
if (!found)
|
||||||
|
ERROR("Unable to find link corresponding to %s\n", path.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user