]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/filectrl.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / gtk / filectrl.cpp
index eec4ce2a7a21bfd2065bde5ef890319fd2c1661f..7eaf55511731393e938f559e86e81e9fee725acb 100644 (file)
@@ -47,7 +47,7 @@ wxString wxGtkFileChooser::GetPath() const
     wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );
 
     wxString string;
-    if (str.c_str() != NULL)
+    if (str)
         string = wxString::FromUTF8(str);
     return string;
 }
@@ -88,7 +88,7 @@ bool wxGtkFileChooser::SetPath( const wxString& path )
     if ( path.empty() )
         return true;
 
-    return gtk_file_chooser_set_filename( m_widget, path.utf8_str() );
+    return gtk_file_chooser_set_filename( m_widget, path.utf8_str() ) != 0;
 }
 
 bool wxGtkFileChooser::SetDirectory( const wxString& dir )
@@ -285,6 +285,12 @@ extern "C"
 
 IMPLEMENT_DYNAMIC_CLASS( wxGtkFileCtrl, wxControl )
 
+wxGtkFileCtrl::~wxGtkFileCtrl()
+{
+    if (m_fcWidget)
+        GTKDisconnect(m_fcWidget);
+}
+
 void wxGtkFileCtrl::Init()
 {
     m_checkNextSelEvent = false;
@@ -362,7 +368,7 @@ bool wxGtkFileCtrl::Create( wxWindow *parent,
     if ( !dir.empty() )
     {
         gtk_file_chooser_set_current_folder( m_fcWidget,
-                                             dir.fn_str() );
+                                             wxGTK_CONV_FN(dir) );
     }
 
     const wxString fname = fn.GetFullName();
@@ -371,7 +377,7 @@ bool wxGtkFileCtrl::Create( wxWindow *parent,
         if ( !fname.empty() )
         {
             gtk_file_chooser_set_current_name( m_fcWidget,
-                                               fname.fn_str() );
+                                               wxGTK_CONV_FN(fname) );
         }
     }
     else // wxFC_OPEN
@@ -379,7 +385,7 @@ bool wxGtkFileCtrl::Create( wxWindow *parent,
         if ( !fname.empty() )
         {
             gtk_file_chooser_set_filename( m_fcWidget,
-                                           fn.GetFullPath().fn_str() );
+                                           wxGTK_CONV_FN(fn.GetFullPath()) );
         }
     }