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() {
|
void GMenu2X::initMenu() {
|
||||||
//Menu structure handler
|
//Menu structure handler
|
||||||
menu.reset(new Menu(*this, ts));
|
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",
|
|
||||||
bind(&GMenu2X::explorer, this),
|
|
||||||
tr["Launch an application"],
|
|
||||||
"skin:icons/explorer.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add virtual links in the setting section
|
// Add action links in the applications section.
|
||||||
else if (menu->getSections()[i]=="settings") {
|
auto appIdx = menu->sectionNamed("applications");
|
||||||
menu->addActionLink(i, "GMenu2X",
|
menu->addActionLink(appIdx, "Explorer",
|
||||||
bind(&GMenu2X::showSettings, this),
|
bind(&GMenu2X::explorer, this),
|
||||||
tr["Configure GMenu2X's options"],
|
tr["Launch an application"],
|
||||||
"skin:icons/configure.png");
|
"skin:icons/explorer.png");
|
||||||
menu->addActionLink(i, tr["Skin"],
|
|
||||||
bind(&GMenu2X::skinMenu, this),
|
// Add action links in the settings section.
|
||||||
tr["Configure skin"],
|
auto settingIdx = menu->sectionNamed("settings");
|
||||||
"skin:icons/skin.png");
|
menu->addActionLink(settingIdx, "GMenu2X",
|
||||||
menu->addActionLink(i, tr["Wallpaper"],
|
bind(&GMenu2X::showSettings, this),
|
||||||
bind(&GMenu2X::changeWallpaper, this),
|
tr["Configure GMenu2X's options"],
|
||||||
tr["Change GMenu2X wallpaper"],
|
"skin:icons/configure.png");
|
||||||
"skin:icons/wallpaper.png");
|
menu->addActionLink(settingIdx, tr["Skin"],
|
||||||
if (fileExists(LOG_FILE)) {
|
bind(&GMenu2X::skinMenu, this),
|
||||||
menu->addActionLink(i, tr["Log Viewer"],
|
tr["Configure skin"],
|
||||||
bind(&GMenu2X::viewLog, this),
|
"skin:icons/skin.png");
|
||||||
tr["Displays last launched program's output"],
|
menu->addActionLink(settingIdx, tr["Wallpaper"],
|
||||||
"skin:icons/ebook.png");
|
bind(&GMenu2X::changeWallpaper, this),
|
||||||
}
|
tr["Change GMenu2X wallpaper"],
|
||||||
menu->addActionLink(i, tr["About"],
|
"skin:icons/wallpaper.png");
|
||||||
bind(&GMenu2X::about, this),
|
if (fileExists(LOG_FILE)) {
|
||||||
tr["Info about GMenu2X"],
|
menu->addActionLink(settingIdx, tr["Log Viewer"],
|
||||||
"skin:icons/about.png");
|
bind(&GMenu2X::viewLog, this),
|
||||||
}
|
tr["Displays last launched program's output"],
|
||||||
|
"skin:icons/ebook.png");
|
||||||
}
|
}
|
||||||
|
menu->addActionLink(settingIdx, tr["About"],
|
||||||
|
bind(&GMenu2X::about, this),
|
||||||
|
tr["Info about GMenu2X"],
|
||||||
|
"skin:icons/about.png");
|
||||||
|
|
||||||
menu->skinUpdated();
|
menu->skinUpdated();
|
||||||
menu->orderLinks();
|
menu->orderLinks();
|
||||||
|
Loading…
Reference in New Issue
Block a user