Give new footprint libraries a dummy name in the file dialog

If they don't have a dummy name, then GTK will display the regex
for the extension in the dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/5365
This commit is contained in:
Ian McInerney 2020-09-02 00:08:57 +01:00
parent 8bdf25d3e2
commit 4ca7993382
2 changed files with 15 additions and 18 deletions

View File

@ -884,6 +884,10 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
}
else
{
// Ensure the file has a dummy name, otherwise GTK will display the regex from the filter
if( aFilename.GetName().empty() )
aFilename.SetName( "Library" );
wxString dir = Prj().IsNullProject() ? aFilename.GetFullPath() : Prj().GetProjectPath();
wxFileDialog dlg( this, prompt, dir, aFilename.GetFullName(),

View File

@ -391,7 +391,7 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary( const wxString& aLibName,
fn = initialPath;
if( !LibraryFileBrowser( false, fn,
KiCadFootprintLibPathWildcard(), KiCadFootprintLibPathExtension) )
KiCadFootprintLibPathWildcard(), KiCadFootprintLibPathExtension ) )
{
return wxEmptyString;
}
@ -505,16 +505,9 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename )
switch( SelectSingleOption( this, _( "Select Library Table" ),
_( "Choose the Library Table to add the library to:" ), libTableNames ) )
{
case 0:
saveInGlobalTable = true;
break;
case 1:
saveInProjectTable = true;
break;
default:
return false;
case 0: saveInGlobalTable = true; break;
case 1: saveInProjectTable = true; break;
default: return false;
}
}