Skip to content

Commit

Permalink
ui: Show message when Konami Code is performed
Browse files Browse the repository at this point in the history
Show a message in the info box when the Konami Code is performed on the
collection view.

Fixes #247
  • Loading branch information
Kekun committed Aug 13, 2016
1 parent f15e507 commit 43cb0d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ui/application-window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {

break;
}

konami_code.reset ();
}
get { return _ui_state; }
}
Expand Down Expand Up @@ -78,6 +80,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
private Cancellable run_game_cancellable;
private Cancellable quit_game_cancellable;

private KonamiCode konami_code;

public ApplicationWindow (ListModel collection) {
collection_box.collection = collection;
}
Expand All @@ -94,6 +98,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
BindingFlags.BIDIRECTIONAL);
header_bar_fullscreen_binding = bind_property ("is-fullscreen", display_header_bar, "is-fullscreen",
BindingFlags.BIDIRECTIONAL);

konami_code = new KonamiCode (this);
konami_code.code_performed.connect (on_konami_code_performed);
}

public void run_game (Game game) {
Expand Down Expand Up @@ -293,4 +300,10 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
runners.remove (game);
}
}
private void on_konami_code_performed () {
if (ui_state != UiState.COLLECTION)
return;

collection_box.display_error (KonamiCode.CODE_STRING);
}
}

0 comments on commit 43cb0d2

Please sign in to comment.