mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-28 05:59:53 +02:00
Order the links in alphabetical order
This commit is contained in:
parent
9029deceeb
commit
bcb3e98ddc
15
src/menu.cpp
15
src/menu.cpp
@ -76,6 +76,8 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
orderLinks();
|
||||
}
|
||||
|
||||
Menu::~Menu() {
|
||||
@ -501,6 +503,7 @@ void Menu::openPackage(std::string path)
|
||||
}
|
||||
|
||||
opk_close(opk);
|
||||
orderLinks();
|
||||
}
|
||||
|
||||
void Menu::readPackages(std::string parentDir)
|
||||
@ -586,6 +589,18 @@ void Menu::readLinksOfSection(std::string path, std::vector<std::string> &linkfi
|
||||
closedir(dirp);
|
||||
}
|
||||
|
||||
static bool compare_links(Link *a, Link *b)
|
||||
{
|
||||
return a->getTitle().compare(b->getTitle()) <= 0;
|
||||
}
|
||||
|
||||
void Menu::orderLinks()
|
||||
{
|
||||
for (std::vector< std::vector<Link *> >::iterator section = links.begin();
|
||||
section < links.end(); section++)
|
||||
std::sort(section->begin(), section->end(), compare_links);
|
||||
}
|
||||
|
||||
void Menu::readLinks() {
|
||||
vector<string> linkfiles;
|
||||
|
||||
|
@ -46,6 +46,7 @@ private:
|
||||
|
||||
void readLinks();
|
||||
void freeLinks();
|
||||
void orderLinks();
|
||||
|
||||
// Load all the sections of the given "sections" directory.
|
||||
void readSections(std::string parentDir);
|
||||
|
Loading…
Reference in New Issue
Block a user