Don't keep showing the same error message
When updating on a timer, if there is an error, just show it once and be done
This commit is contained in:
parent
6b3ac54a41
commit
4bc055d5d0
|
@ -182,6 +182,7 @@ PROJECT_TREE_PANE::PROJECT_TREE_PANE( KICAD_MANAGER_FRAME* parent ) :
|
||||||
m_selectedItem = nullptr;
|
m_selectedItem = nullptr;
|
||||||
m_watcherNeedReset = false;
|
m_watcherNeedReset = false;
|
||||||
m_lastGitStatusUpdate = wxDateTime::Now();
|
m_lastGitStatusUpdate = wxDateTime::Now();
|
||||||
|
m_gitLastError = GIT_ERROR_NONE;
|
||||||
|
|
||||||
m_watcher = nullptr;
|
m_watcher = nullptr;
|
||||||
Connect( wxEVT_FSWATCHER,
|
Connect( wxEVT_FSWATCHER,
|
||||||
|
@ -1538,13 +1539,20 @@ void PROJECT_TREE_PANE::onGitInitializeProject( wxCommandEvent& aEvent )
|
||||||
if( error != 0 )
|
if( error != 0 )
|
||||||
{
|
{
|
||||||
git_repository_free( repo );
|
git_repository_free( repo );
|
||||||
DisplayErrorMessage( this, _( "Failed to initialize git project." ),
|
|
||||||
git_error_last()->message );
|
if( m_gitLastError != git_error_last()->klass )
|
||||||
|
{
|
||||||
|
m_gitLastError = git_error_last()->klass;
|
||||||
|
DisplayErrorMessage( this, _( "Failed to initialize git project." ),
|
||||||
|
git_error_last()->message );
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_TreeProject->SetGitRepo( repo );
|
m_TreeProject->SetGitRepo( repo );
|
||||||
|
m_gitLastError = GIT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1600,11 +1608,18 @@ void PROJECT_TREE_PANE::onGitInitializeProject( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
if( error != GIT_OK )
|
if( error != GIT_OK )
|
||||||
{
|
{
|
||||||
DisplayErrorMessage( this, _( "Failed to set default remote." ),
|
if( m_gitLastError != git_error_last()->klass )
|
||||||
git_error_last()->message );
|
{
|
||||||
|
m_gitLastError = git_error_last()->klass;
|
||||||
|
DisplayErrorMessage( this, _( "Failed to set default remote." ),
|
||||||
|
git_error_last()->message );
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_gitLastError = GIT_ERROR_NONE;
|
||||||
|
|
||||||
GIT_PULL_HANDLER handler( repo );
|
GIT_PULL_HANDLER handler( repo );
|
||||||
|
|
||||||
handler.SetConnType( m_TreeProject->GitCommon()->GetConnType() );
|
handler.SetConnType( m_TreeProject->GitCommon()->GetConnType() );
|
||||||
|
@ -1875,7 +1890,10 @@ void PROJECT_TREE_PANE::updateGitStatusIcons()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogError( "Failed to lookup current branch: %s", giterr_last()->message );
|
if( giterr_last()->klass != m_gitLastError )
|
||||||
|
wxLogError( "Failed to lookup current branch: %s", giterr_last()->message );
|
||||||
|
|
||||||
|
m_gitLastError = giterr_last()->klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect a map to easily set the state of each item
|
// Collect a map to easily set the state of each item
|
||||||
|
@ -1912,6 +1930,7 @@ void PROJECT_TREE_PANE::updateGitStatusIcons()
|
||||||
|
|
||||||
if( git_repository_index( &index, repo ) != GIT_OK )
|
if( git_repository_index( &index, repo ) != GIT_OK )
|
||||||
{
|
{
|
||||||
|
m_gitLastError = giterr_last()->klass;
|
||||||
wxLogDebug( "Failed to get git index: %s", giterr_last()->message );
|
wxLogDebug( "Failed to get git index: %s", giterr_last()->message );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,6 +292,7 @@ private:
|
||||||
// (during an idle time for instance) after
|
// (during an idle time for instance) after
|
||||||
// the main loop event handler is started
|
// the main loop event handler is started
|
||||||
wxDateTime m_lastGitStatusUpdate;
|
wxDateTime m_lastGitStatusUpdate;
|
||||||
|
int m_gitLastError;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue