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

Fix the function that sets the icon of a Link

This commit is contained in:
Paul Cercueil 2013-07-18 17:00:18 -04:00
parent dfad7c39a7
commit 504641a6cf

View File

@ -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) else
this->icon = "skin:"+tempIcon.substr(pos+1,icon.length()); this->iconPath = icon;
else
this->icon = 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();