mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 18:40:36 +02:00
Fix the function that sets the icon of a Link
This commit is contained in:
parent
dfad7c39a7
commit
504641a6cf
21
src/link.cpp
21
src/link.cpp
@ -84,24 +84,13 @@ const string &Link::getIcon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Link::setIcon(const string &icon) {
|
void Link::setIcon(const string &icon) {
|
||||||
string skinpath = gmenu2x->sc.getSkinPath(gmenu2x->confStr["skin"]);
|
this->icon = icon;
|
||||||
|
|
||||||
if (icon.substr(0,skinpath.length()) == skinpath) {
|
if (icon.compare(0, 5, "skin:") == 0)
|
||||||
string tempIcon = icon.substr(skinpath.length(), icon.length());
|
this->iconPath = gmenu2x->sc.getSkinFilePath(
|
||||||
string::size_type pos = tempIcon.find("/");
|
icon.substr(5, string::npos));
|
||||||
if (pos != string::npos)
|
|
||||||
this->icon = "skin:"+tempIcon.substr(pos+1,icon.length());
|
|
||||||
else
|
else
|
||||||
this->icon = icon;
|
this->iconPath = icon;
|
||||||
} else {
|
|
||||||
this->icon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
iconPath = strreplace(this->icon,"skin:",skinpath+"/");
|
|
||||||
if (iconPath.empty() || !fileExists(iconPath)) {
|
|
||||||
iconPath = strreplace(this->icon,"skin:",gmenu2x->sc.getSkinPath("Default"));
|
|
||||||
if (!fileExists(iconPath)) searchIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
edited = true;
|
edited = true;
|
||||||
updateSurfaces();
|
updateSurfaces();
|
||||||
|
Loading…
Reference in New Issue
Block a user