X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d2976ad6b56ff1650e15f2b949c10ec92385309..777fd647dc188519b1d1067dc25b1386ca36d9f3:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 8130ffda6e..fb55217c0c 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -138,6 +138,11 @@ public: { m_next = NULL; } + + ~MailCapEntry() + { + if (m_next) delete m_next; + } // accessors const wxString& GetOpenCmd() const { return m_openCmd; } @@ -560,8 +565,14 @@ void wxGNOMEIconHandler::GetMimeInfoRecords(wxMimeTypesManagerImpl *manager) } } +#if wxUSE_GUI + #define WXUNUSED_UNLESS_GUI(p) p +#else + #define WXUNUSED_UNLESS_GUI(p) +#endif -bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) +bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, + wxIcon * WXUNUSED_UNLESS_GUI(icon)) { if ( !m_inited ) { @@ -581,8 +592,11 @@ bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) icn = wxIcon(iconname); else icn = wxIcon(iconname, wxBITMAP_TYPE_ANY); - if (icn.Ok()) *icon = icn; - else return FALSE; + if ( !icn.Ok() ) + return FALSE; + + if ( icon ) + *icon = icn; #else // helpful for testing in console mode wxLogDebug(_T("Found GNOME icon for '%s': '%s'\n"), @@ -789,6 +803,7 @@ void wxKDEIconHandler::Init() dirs.Add(_T("/usr/share")); dirs.Add(_T("/opt/kde/share")); icondirs.Add(_T("/usr/share/icons/")); + icondirs.Add(_T("/usr/X11R6/share/icons/")); // Debian/Corel linux icondirs.Add(_T("/opt/kde/share/icons/")); } @@ -801,7 +816,8 @@ void wxKDEIconHandler::Init() m_inited = TRUE; } -bool wxKDEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) +bool wxKDEIconHandler::GetIcon(const wxString& mimetype, + wxIcon * WXUNUSED_UNLESS_GUI(icon)) { if ( !m_inited ) { @@ -821,8 +837,12 @@ bool wxKDEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) icn = wxIcon(iconname); else icn = wxIcon(iconname, wxBITMAP_TYPE_ANY); - if (icn.Ok()) *icon = icn; - else return FALSE; + + if ( !icn.Ok() ) + return FALSE; + + if ( icon ) + *icon = icn; #else // helpful for testing in console mode wxLogDebug(_T("Found KDE icon for '%s': '%s'\n"), @@ -1026,6 +1046,14 @@ wxMimeTypesManagerImpl::wxMimeTypesManagerImpl() handlers[hn]->GetMimeInfoRecords(this); } + +wxMimeTypesManagerImpl::~wxMimeTypesManagerImpl() +{ + size_t cnt = m_aEntries.GetCount(); + for (size_t i = 0; i < cnt; i++) delete m_aEntries[i]; +} + + wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) {