// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "mimetype.h"
#endif
#ifndef WX_PRECOMP
#include "wx/string.h"
- #if wxUSE_GUI
- #include "wx/icon.h"
-
- #endif
#endif //WX_PRECOMP
#include "wx/dir.h"
#include "wx/utils.h"
#include "wx/tokenzr.h"
+#include "wx/iconloc.h"
#include "wx/unix/mimetype.h"
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;
// 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);
}
// 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);
if ( iconLoc )
{
- iconLoc->SetIconFile(sTmp);
+ iconLoc->SetFileName(sTmp);
}
return TRUE;
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);
}
else if ( strLHS == wxT("exts") ) {
strExtensions = strRHS;
}
- else if ( strLHS != _T("icon") )
+ else if ( strLHS == _T("icon") )
{
// this one is simply ignored: it usually refers to Netscape
// built in icons which are useless for us anyhow