mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-18 03:10:27 -04:00
Centralize handling of modal error display.
This commit is contained in:
parent
682a1706a3
commit
6a3cd4c144
4 changed files with 16 additions and 2 deletions
|
@ -117,6 +117,10 @@ View* NavigationView::push_view(std::unique_ptr<View> new_view) {
|
|||
}
|
||||
|
||||
void NavigationView::pop() {
|
||||
if( view() == modal_view ) {
|
||||
modal_view = nullptr;
|
||||
}
|
||||
|
||||
// Can't pop last item from stack.
|
||||
if( view_stack.size() > 1 ) {
|
||||
free_view();
|
||||
|
@ -127,6 +131,13 @@ void NavigationView::pop() {
|
|||
}
|
||||
}
|
||||
|
||||
void NavigationView::display_error(const std::string& message) {
|
||||
/* If a modal view is already visible, don't display another */
|
||||
if( !modal_view ) {
|
||||
modal_view = push<ModalMessageView>(message);
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationView::free_view() {
|
||||
remove_child(view());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue