X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..04fa04d8067d235ab45b5bc05b65f0679634b541:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 2f79104e23..caa9459875 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -267,7 +267,7 @@ void wxMimeTypesManagerImpl::LoadXDGGlobs(const wxString& filename) ext.Remove( 0, 2 ); wxArrayString exts; exts.Add( ext ); - + AddToMimeData(mime, wxEmptyString, NULL, exts, wxEmptyString, true ); } } @@ -507,14 +507,19 @@ void wxMimeTypesManagerImpl::InitIfNeeded() // set the flag first to prevent recursion m_initialized = true; - wxString wm = wxTheApp->GetTraits()->GetDesktopEnvironment(); + int mailcapStyles = wxMAILCAP_ALL; + if ( wxAppTraits * const traits = wxApp::GetTraitsIfExists() ) + { + wxString wm = traits->GetDesktopEnvironment(); - if (wm == wxT("KDE")) - Initialize( wxMAILCAP_KDE ); - else if (wm == wxT("GNOME")) - Initialize( wxMAILCAP_GNOME ); - else - Initialize(); + if ( wm == "KDE" ) + mailcapStyles = wxMAILCAP_KDE; + else if ( wm == "GNOME" ) + mailcapStyles = wxMAILCAP_GNOME; + //else: unknown, use the default + } + + Initialize(mailcapStyles); } } @@ -844,7 +849,7 @@ wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ex // found wxFileType *fileType = new wxFileType; fileType->m_impl->Init(this, n); - + return fileType; } }