CFrameBuffer: add more possible icon paths in order of priority

This gives possibility to use theme relevant icon sets.

scheme:
	/path/to/theme/icons/file.png

example:
	/usr/share/tuxbox/neutrino/themes/Neutrino-3.0/icons/file.png
This commit is contained in:
2018-04-11 16:12:03 +02:00
parent ab281d8581
commit ae9be1be31

View File

@@ -706,11 +706,23 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty
{ {
std::string path, filetype; std::string path, filetype;
filetype = "." + file_type; filetype = "." + file_type;
path = std::string(ICONSDIR_VAR) + "/" + icon_name + filetype;
if (access(path.c_str(), F_OK)) std::string dir[] = { THEMESDIR_VAR "/" + g_settings.theme_name + "/icons",
path = iconBasePath + "/" + icon_name + filetype; THEMESDIR "/" + g_settings.theme_name + "/icons",
ICONSDIR_VAR,
iconBasePath
};
for(int i=0; i<4 ; i++){
path = std::string(dir[i]) + "/" + icon_name + filetype;
if (access(path.c_str(), F_OK) == 0){
return path;
}
}
if (icon_name.find("/", 0) != std::string::npos) if (icon_name.find("/", 0) != std::string::npos)
path = icon_name; path = icon_name;
return path; return path;
} }