From: Vadim Zeitlin Date: Thu, 25 Feb 2010 00:03:35 +0000 (+0000) Subject: Always use UTF-8 for GTK+ strings. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b74d7c8525b3388bf60b998c238af972e51f97ef Always use UTF-8 for GTK+ strings. Strings returned and accepted by GTK+ functions always use UTF-8 independently of the current locale and of the file name encoding we use. So use UTF-8 instead of wxConvFileName everywhere where we deal with GTK+ directly. Closes #11743. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/dirdlg.cpp b/src/gtk/dirdlg.cpp index 08e4a0af44..a1d32a3e8b 100644 --- a/src/gtk/dirdlg.cpp +++ b/src/gtk/dirdlg.cpp @@ -172,7 +172,7 @@ void wxDirDialog::SetPath(const wxString& dir) wxString wxDirDialog::GetPath() const { wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget))); - return wxString(str, *wxConvFileName); + return wxString::FromUTF8(str); } #endif // wxUSE_DIRDLG diff --git a/src/gtk/filectrl.cpp b/src/gtk/filectrl.cpp index 1b00e343ee..f670e07350 100644 --- a/src/gtk/filectrl.cpp +++ b/src/gtk/filectrl.cpp @@ -47,7 +47,7 @@ wxString wxGtkFileChooser::GetPath() const wxString string; if (str.c_str() != NULL) - string = wxConvFileName->cMB2WX(str); + string = wxString::FromUTF8(str); return string; } @@ -70,7 +70,7 @@ void wxGtkFileChooser::GetPaths( wxArrayString& paths ) const GSList *gpaths = gpathsi; while ( gpathsi ) { - wxString file( wxConvFileName->cMB2WX( ( gchar* ) gpathsi->data ) ); + wxString file(wxString::FromUTF8(static_cast(gpathsi->data))); paths.Add( file ); g_free( gpathsi->data ); gpathsi = gpathsi->next; @@ -84,24 +84,21 @@ void wxGtkFileChooser::GetPaths( wxArrayString& paths ) const bool wxGtkFileChooser::SetPath( const wxString& path ) { - if ( path.empty() ) return true; + if ( path.empty() ) + return true; - return gtk_file_chooser_set_filename( m_widget, - wxConvFileName->cWX2MB( path.c_str() ) ); + return gtk_file_chooser_set_filename( m_widget, path.utf8_str() ); } bool wxGtkFileChooser::SetDirectory( const wxString& dir ) { - const gboolean b = - gtk_file_chooser_set_current_folder( m_widget, - wxConvFileName->cWX2MB( dir.c_str() ) ); - return b != 0; + return gtk_file_chooser_set_current_folder( m_widget, dir.utf8_str() ) != 0; } wxString wxGtkFileChooser::GetDirectory() const { const wxGtkString str( gtk_file_chooser_get_current_folder( m_widget ) ); - return wxString( str, *wxConvFileName ); + return wxString::FromUTF8(str); } wxString wxGtkFileChooser::GetFilename() const diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index ace2daddcd..3e63c53243 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -51,7 +51,7 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) msg.Printf( _("File '%s' already exists, do you really want to overwrite it?"), - wxString(filename, *wxConvFileName)); + wxString::FromUTF8(filename)); wxMessageDialog dlg(dialog, msg, _("Confirm"), wxYES_NO | wxICON_QUESTION); diff --git a/src/gtk/hyperlink.cpp b/src/gtk/hyperlink.cpp index dc90de7e58..54b8aa7d8e 100644 --- a/src/gtk/hyperlink.cpp +++ b/src/gtk/hyperlink.cpp @@ -151,7 +151,7 @@ wxString wxHyperlinkCtrl::GetURL() const if ( UseNative() ) { const gchar *str = gtk_link_button_get_uri(GTK_LINK_BUTTON(m_widget)); - return wxString(str, *wxConvFileName); + return wxString::FromUTF8(str); } return wxGenericHyperlinkCtrl::GetURL();