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:
parent
cf8bd84362
commit
3995133fa5
16
src/menu.cpp
16
src/menu.cpp
@ -312,14 +312,26 @@ bool Menu::addSection(const string §ionName) {
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user