X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b9517a0ae450f70439f88abcab474ad60035b52c..4f6aed9c6a21d4bc732579aa564adf4cdb2c9aab:/src/common/mimetype.cpp diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 30dc954880..3dab4f75fa 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -28,7 +28,9 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #include "wx/icon.h" + #if wxUSE_GUI + #include "wx/icon.h" + #endif #endif //WX_PRECOMP // Doesn't compile in WIN16 mode @@ -43,7 +45,7 @@ #ifdef __WXMSW__ #include "wx/msw/registry.h" #include "windows.h" -#elif defined(__UNIX__) +#elif defined(__UNIX__) || defined(__WXPM__) #include "wx/ffile.h" #include "wx/textfile.h" #include "wx/dir.h" @@ -55,6 +57,9 @@ // other standard headers #include +// in case we're compiling in non-GUI mode +class WXDLLEXPORT wxIcon; + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -1339,7 +1344,11 @@ void wxGNOMEIconHandler::Init() { wxArrayString dirs; dirs.Add(_T("/usr/share")); - dirs.Add(wxGetHomeDir() + _T("/.gnome")); + + wxString gnomedir; + wxGetHomeDir( &gnomedir ); + gnomedir += _T("/.gnome"); + dirs.Add( gnomedir ); size_t nDirs = dirs.GetCount(); for ( size_t nDir = 0; nDir < nDirs; nDir++ ) @@ -1381,7 +1390,7 @@ bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) // KDE stores the icon info in its .kdelnk files. The file for mimetype/subtype // may be found in either of the following locations // -// 1. /usr/share/mimelnk/mimetype/subtype.kdelnk +// 1. $KDEDIR/share/mimelnk/mimetype/subtype.kdelnk // 2. ~/.kde/share/mimelnk/mimetype/subtype.kdelnk // // The format of a .kdelnk file is almost the same as the one used by @@ -1494,7 +1503,20 @@ void wxKDEIconHandler::LoadLinkFilesFromDir(const wxString& dirbase) void wxKDEIconHandler::Init() { wxArrayString dirs; - dirs.Add(_T("/usr/share")); + + // the variable KDEDIR is set when KDE is running + const char *kdedir = getenv("KDEDIR"); + if ( kdedir ) + { + dirs.Add(wxString(kdedir) + _T("/share")); + } + else + { + // try to guess KDEDIR + dirs.Add(_T("/usr/share")); + dirs.Add(_T("/opt/kde/share")); + } + dirs.Add(wxGetHomeDir() + _T("/.kde/share")); size_t nDirs = dirs.GetCount();