]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/mimetype.cpp
Ensure there is valid context for DrawRectangle
[wxWidgets.git] / src / unix / mimetype.cpp
index 05426d667ae373c2f025b9f9a19c7586abd1b837..51209e7f671c754ffc9b6a2a60de5464c10f73cf 100644 (file)
@@ -507,14 +507,19 @@ void wxMimeTypesManagerImpl::InitIfNeeded()
         // set the flag first to prevent recursion
         m_initialized = true;
 
         // 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);
     }
 }
 
     }
 }
 
@@ -719,7 +724,7 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType,
     if ( nIndex == wxNOT_FOUND )
     {
         // We put MIME types containing  "application" at the end, so that
     if ( nIndex == wxNOT_FOUND )
     {
         // We put MIME types containing  "application" at the end, so that
-        // if the MIME type for the extention "htm" is searched for, it will
+        // if the MIME type for the extension "htm" is searched for, it will
         // rather find "text/html" than "application/x-mozilla-bookmarks".
         if (mimeType.Find( "application" ) == 0)
         {
         // rather find "text/html" than "application/x-mozilla-bookmarks".
         if (mimeType.Find( "application" ) == 0)
         {