[gnome-games/wip/exalm/spinner: 14/17] 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: 14/17] ui: Use loading state instead of loading notification
- Date: Mon, 7 Jan 2019 17:26:51 +0000 (UTC)
commit 5e622e21f4926349642b37b614042a49391a13e2
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 005cd093..3d06fad0 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 (() => {
@@ -175,6 +177,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 ();
@@ -718,4 +725,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 f41dc45b..ebc4ad4c 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -232,15 +232,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 () {
@@ -338,7 +329,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]