[gnome-games/wip/exalm/spinner: 7/10] ui: Use loading state instead of loading notification
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/spinner: 7/10] ui: Use loading state instead of loading notification
- Date: Sun, 7 Oct 2018 10:29:43 +0000 (UTC)
commit 5a07fc558fbd66718412da2fdaa047ab63e416cc
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 5 20:18:53 2018 +0500
ui: Use loading state instead of loading notification
src/ui/application-window.vala | 16 ++++++++++++++++
src/ui/application.vala | 11 +----------
2 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index c3e89698..e570824f 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -116,6 +116,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
private KonamiCode konami_code;
+ private Game game_to_run;
+
public ApplicationWindow (ListModel collection) {
collection_box.collection = collection;
collection.items_changed.connect (() => {
@@ -173,6 +175,11 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
}
public void run_game (Game game) {
+ if (ui_state == UiState.LOADING) {
+ game_to_run = game;
+ return;
+ }
+
if (run_game_cancellable != null)
run_game_cancellable.cancel ();
@@ -714,4 +721,13 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
critical (e.message);
}
}
+
+ public void on_collection_loaded () {
+ if (game_to_run != null) {
+ ui_state = UiState.DISPLAY;
+ run_game (game_to_run);
+ game_to_run = null;
+ } else
+ ui_state = UiState.COLLECTION;
+ }
}
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 7d1797fe..80ac6158 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -233,15 +233,6 @@ public class Games.Application : Gtk.Application {
quit_application ();
});
window.show ();
-
- GLib.Timeout.add (500, show_loading_notification);
- }
-
- private bool show_loading_notification () {
- if (!game_list_loaded)
- window.loading_notification = true;
-
- return false;
}
private void init_game_sources () {
@@ -339,7 +330,7 @@ public class Games.Application : Gtk.Application {
game_list_loaded = true;
if (window != null)
- window.loading_notification = false;
+ window.on_collection_loaded ();
}
private void preferences () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]