1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-19 23:49:41 +02:00

When deleting a link, check if the icon is used elsewhere before unloading it.

This commit is contained in:
Ayla 2011-09-18 13:22:02 +02:00
parent cf8bd84362
commit 3995133fa5

View File

@ -312,14 +312,26 @@ bool Menu::addSection(const string &sectionName) {
return false;
}
void Menu::deleteSelectedLink() {
void Menu::deleteSelectedLink()
{
bool icon_used = false;
string iconpath = selLink()->getIconPath();
INFO("Deleting link '%s'\n", selLink()->getTitle().c_str());
if (selLinkApp()!=NULL)
unlink(selLinkApp()->getFile().c_str());
gmenu2x->sc.del(selLink()->getIconPath());
sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() );
setLinkIndex(selLinkIndex());
for (vector<linklist>::iterator section = links.begin();
!icon_used && section<links.end(); section++)
for (linklist::iterator link = section->begin();
!icon_used && link<section->end(); link++)
icon_used = !iconpath.compare((*link)->getIconPath());
if (!icon_used)
gmenu2x->sc.del(iconpath);
}
void Menu::deleteSelectedSection() {