mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 06:15:21 +02:00
Create sections for built-in action links if necessary
Previously, the built-in actions would only be added if their respective sections already existed. This also works around the fact that Menu::paint() crashes if there are no sections present.
This commit is contained in:
parent
08ecd7d8d9
commit
fad68bfb6e
@ -377,41 +377,38 @@ void GMenu2X::initFont() {
|
||||
void GMenu2X::initMenu() {
|
||||
//Menu structure handler
|
||||
menu.reset(new Menu(*this, ts));
|
||||
for (uint i=0; i<menu->getSections().size(); i++) {
|
||||
//Add virtual links in the applications section
|
||||
if (menu->getSections()[i]=="applications") {
|
||||
menu->addActionLink(i, "Explorer",
|
||||
|
||||
// Add action links in the applications section.
|
||||
auto appIdx = menu->sectionNamed("applications");
|
||||
menu->addActionLink(appIdx, "Explorer",
|
||||
bind(&GMenu2X::explorer, this),
|
||||
tr["Launch an application"],
|
||||
"skin:icons/explorer.png");
|
||||
}
|
||||
|
||||
//Add virtual links in the setting section
|
||||
else if (menu->getSections()[i]=="settings") {
|
||||
menu->addActionLink(i, "GMenu2X",
|
||||
// Add action links in the settings section.
|
||||
auto settingIdx = menu->sectionNamed("settings");
|
||||
menu->addActionLink(settingIdx, "GMenu2X",
|
||||
bind(&GMenu2X::showSettings, this),
|
||||
tr["Configure GMenu2X's options"],
|
||||
"skin:icons/configure.png");
|
||||
menu->addActionLink(i, tr["Skin"],
|
||||
menu->addActionLink(settingIdx, tr["Skin"],
|
||||
bind(&GMenu2X::skinMenu, this),
|
||||
tr["Configure skin"],
|
||||
"skin:icons/skin.png");
|
||||
menu->addActionLink(i, tr["Wallpaper"],
|
||||
menu->addActionLink(settingIdx, tr["Wallpaper"],
|
||||
bind(&GMenu2X::changeWallpaper, this),
|
||||
tr["Change GMenu2X wallpaper"],
|
||||
"skin:icons/wallpaper.png");
|
||||
if (fileExists(LOG_FILE)) {
|
||||
menu->addActionLink(i, tr["Log Viewer"],
|
||||
menu->addActionLink(settingIdx, tr["Log Viewer"],
|
||||
bind(&GMenu2X::viewLog, this),
|
||||
tr["Displays last launched program's output"],
|
||||
"skin:icons/ebook.png");
|
||||
}
|
||||
menu->addActionLink(i, tr["About"],
|
||||
menu->addActionLink(settingIdx, tr["About"],
|
||||
bind(&GMenu2X::about, this),
|
||||
tr["Info about GMenu2X"],
|
||||
"skin:icons/about.png");
|
||||
}
|
||||
}
|
||||
|
||||
menu->skinUpdated();
|
||||
menu->orderLinks();
|
||||
|
Loading…
Reference in New Issue
Block a user