mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-02-18 11:24:43 +02:00
When loading multiple OPKs, don't order links each time one is added
This commit is contained in:
parent
41e4cff7ac
commit
84a987e9d5
12
src/menu.cpp
12
src/menu.cpp
@ -458,7 +458,7 @@ void Menu::openPackagesFromDir(std::string path)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::openPackage(std::string path)
|
void Menu::openPackage(std::string path, bool order)
|
||||||
{
|
{
|
||||||
/* First try to remove existing links of the same OPK
|
/* First try to remove existing links of the same OPK
|
||||||
* (needed for instance when an OPK is modified) */
|
* (needed for instance when an OPK is modified) */
|
||||||
@ -516,7 +516,9 @@ void Menu::openPackage(std::string path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
opk_close(opk);
|
opk_close(opk);
|
||||||
orderLinks();
|
|
||||||
|
if (order)
|
||||||
|
orderLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::readPackages(std::string parentDir)
|
void Menu::readPackages(std::string parentDir)
|
||||||
@ -548,10 +550,11 @@ void Menu::readPackages(std::string parentDir)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
openPackage(parentDir + '/' + dptr->d_name);
|
openPackage(parentDir + '/' + dptr->d_name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
orderLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_INOTIFY
|
#ifdef ENABLE_INOTIFY
|
||||||
@ -608,7 +611,8 @@ void Menu::orderLinks()
|
|||||||
{
|
{
|
||||||
for (std::vector< std::vector<Link *> >::iterator section = links.begin();
|
for (std::vector< std::vector<Link *> >::iterator section = links.begin();
|
||||||
section < links.end(); section++)
|
section < links.end(); section++)
|
||||||
std::sort(section->begin(), section->end(), compare_links);
|
if (section->size() > 1)
|
||||||
|
std::sort(section->begin(), section->end(), compare_links);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::readLinks() {
|
void Menu::readLinks() {
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
~Menu();
|
~Menu();
|
||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
void openPackage(std::string path);
|
void openPackage(std::string path, bool order = true);
|
||||||
void openPackagesFromDir(std::string path);
|
void openPackagesFromDir(std::string path);
|
||||||
#ifdef ENABLE_INOTIFY
|
#ifdef ENABLE_INOTIFY
|
||||||
void removePackageLink(std::string path);
|
void removePackageLink(std::string path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user