(ChangePosition): new history navigation method.

Push current position into undo stack only if directory has been
changed.
This commit is contained in:
morkt 2014-08-14 21:42:27 +04:00
parent d1bde19bb3
commit cfd71f5519
2 changed files with 9 additions and 2 deletions

View File

@ -188,8 +188,7 @@ namespace GARbro.GUI
{ {
Settings.Default.appLastCreatedArchive = m_arc_name; Settings.Default.appLastCreatedArchive = m_arc_name;
m_main.Dispatcher.Invoke (() => { m_main.Dispatcher.Invoke (() => {
m_main.SaveCurrentPosition(); m_main.ChangePosition (new DirectoryPosition (m_arc_name));
m_main.SetCurrentPosition (new DirectoryPosition (m_arc_name));
}); });
} }
else else

View File

@ -613,6 +613,14 @@ namespace GARbro.GUI
m_history.Push (GetCurrentPosition()); m_history.Push (GetCurrentPosition());
} }
public void ChangePosition (DirectoryPosition new_pos)
{
var current = GetCurrentPosition();
if (current.Path != new_pos.Path || current.ArchivePath != new_pos.ArchivePath)
SaveCurrentPosition();
SetCurrentPosition (new_pos);
}
private void GoBackExec (object sender, ExecutedRoutedEventArgs e) private void GoBackExec (object sender, ExecutedRoutedEventArgs e)
{ {
DirectoryPosition current = m_history.Undo (GetCurrentPosition()); DirectoryPosition current = m_history.Undo (GetCurrentPosition());