X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/da0766ab2ae2357cd4dc111415731ee85aa45984..2bbc1b285523e4ff3d325b0bf36205e5c1aa844a:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 0d1b83011c..3015edf5f7 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -40,7 +40,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "mimetype.h" #endif @@ -59,10 +59,6 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #if wxUSE_GUI - #include "wx/icon.h" - - #endif #endif //WX_PRECOMP @@ -77,6 +73,7 @@ #include "wx/dir.h" #include "wx/utils.h" #include "wx/tokenzr.h" +#include "wx/iconloc.h" #include "wx/unix/mimetype.h" @@ -643,14 +640,12 @@ void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename, void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& filename) { wxTextFile textfile(filename); -#if defined(__WXGTK20__) && wxUSE_UNICODE - if ( !textfile.Open( wxConvUTF8) ) -#else if ( !textfile.Open() ) -#endif return; - wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"), - filename.c_str()); + + wxLogTrace(TRACE_MIME, + wxT("--- Opened Gnome file %s ---"), + filename.c_str()); // values for the entry being parsed wxString curMimeType, curExtList; @@ -679,8 +674,9 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file // end of the entry if ( !!curMimeType && !!curExtList ) { - wxLogTrace(TRACE_MIME, wxT("--- At end of Gnome file finding mimetype %s ---"), - curMimeType.c_str()); + wxLogTrace(TRACE_MIME, + wxT("--- At end of Gnome file finding mimetype %s ---"), + curMimeType.c_str()); AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); } @@ -702,20 +698,20 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file // this is a field=value ling pc++; // skip leading TAB - static const int lenField = 4; // strlen("ext:") - if ( wxStrncmp(pc, wxT("ext:"), lenField) == 0 ) + static const int lenField = 5; // strlen("ext: ") + if ( wxStrncmp(pc, wxT("ext: "), lenField) == 0 ) { - // skip ' ' which follows and take everything left until the end - // of line - curExtList = pc + lenField + 1; + // skip it and take everything left until the end of line + curExtList = pc + lenField; } //else: some other field, we don't care } else { // this is the start of the new section - wxLogTrace(TRACE_MIME, wxT("--- In Gnome file finding mimetype %s ---"), - curMimeType.c_str()); + wxLogTrace(TRACE_MIME, + wxT("--- In Gnome file finding mimetype %s ---"), + curMimeType.c_str()); if (! curMimeType.empty()) AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); @@ -1187,7 +1183,7 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const if ( iconLoc ) { - iconLoc->SetIconFile(sTmp); + iconLoc->SetFileName(sTmp); } return TRUE; @@ -1820,7 +1816,8 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType, m_aEntries.Add(entry ? entry : new wxMimeTypeCommands); // change nIndex so we can use it below to add the extensions - nIndex = m_aExtensions.Add(wxEmptyString); + m_aExtensions.Add(wxEmptyString); + nIndex = m_aExtensions.size() - 1; m_aDescriptions.Add(strDesc); }