handle application tag when looking for icon, and add icons for books and book chapters (epub, chm, info)

This commit is contained in:
Jean-Francois Dockes 2012-10-23 16:34:07 +02:00
parent 128b54cabd
commit 217c38edb4
8 changed files with 39 additions and 34 deletions

View file

@ -885,33 +885,30 @@ bool RclConfig::mimeViewerNeedsUncomp(const string &mimetype)
return true;
}
/**
* Return icon name and path
*/
string RclConfig::getMimeIconName(const string &mtype, string *path)
string RclConfig::getMimeIconPath(const string &mtype, const string &apptag)
{
string iconname;
mimeconf->get(mtype, iconname, "icons");
if (!apptag.empty())
mimeconf->get(mtype + string("|") + apptag, iconname, "icons");
if (iconname.empty())
mimeconf->get(mtype, iconname, "icons");
if (iconname.empty())
iconname = "document";
if (path) {
string iconsdir;
string iconpath;
#if defined (__FreeBSD__) && __FreeBSD_version < 500000
// gcc 2.95 dies if we call getConfParam here ??
if (m_conf) m_conf->get(string("iconsdir"), iconsdir, m_keydir);
// gcc 2.95 dies if we call getConfParam here ??
if (m_conf) m_conf->get(string("iconsdir"), iconpath, m_keydir);
#else
getConfParam("iconsdir", iconsdir);
getConfParam("iconsdir", iconpath);
#endif
if (iconsdir.empty()) {
iconsdir = path_cat(m_datadir, "images");
} else {
iconsdir = path_tildexpand(iconsdir);
}
*path = path_cat(iconsdir, iconname) + ".png";
if (iconpath.empty()) {
iconpath = path_cat(m_datadir, "images");
} else {
iconpath = path_tildexpand(iconpath);
}
return iconname;
return path_cat(iconpath, iconname) + ".png";
}
string RclConfig::getDbDir()