Don't use gtk_file_chooser_set_filename() for save file dialogs.
This seems to be broken in old GTK+ versions, so use gtk_file_chooser_set_current_name() and gtk_file_chooser_set_current_folder() for save file dialogs which seem to work in all versions. Closes #15133. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,32 @@ bool wxGtkFileChooser::SetPath( const wxString& path )
|
|||||||
if ( path.empty() )
|
if ( path.empty() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return gtk_file_chooser_set_filename( m_widget, path.utf8_str() ) != 0;
|
switch ( gtk_file_chooser_get_action( m_widget ) )
|
||||||
|
{
|
||||||
|
case GTK_FILE_CHOOSER_ACTION_SAVE:
|
||||||
|
{
|
||||||
|
wxFileName fn(path);
|
||||||
|
|
||||||
|
const wxString fname = fn.GetFullName();
|
||||||
|
gtk_file_chooser_set_current_name( m_widget, fname.utf8_str() );
|
||||||
|
|
||||||
|
// set the initial file name and/or directory
|
||||||
|
const wxString dir = fn.GetPath();
|
||||||
|
return gtk_file_chooser_set_current_folder( m_widget,
|
||||||
|
dir.utf8_str() ) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case GTK_FILE_CHOOSER_ACTION_OPEN:
|
||||||
|
return gtk_file_chooser_set_filename( m_widget, path.utf8_str() ) != 0;
|
||||||
|
|
||||||
|
case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER:
|
||||||
|
case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFAIL_MSG( "Unexpected file chooser type" );
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGtkFileChooser::SetDirectory( const wxString& dir )
|
bool wxGtkFileChooser::SetDirectory( const wxString& dir )
|
||||||
|
Reference in New Issue
Block a user