[gnome-games] ui: Check 'Resume' dialog before updating the pause



commit 7c7f76906033776987e542ebdbef32e5446236a6
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Sep 2 10:57:21 2016 +0200

    ui: Check 'Resume' dialog before updating the pause
    
    Check that there is no 'Resume' dialog before updating the pause when
    the toplevel focus changes.
    
    This avoids unpausing the game when dragging the dialog.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770426

 src/ui/application-window.vala |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 8cdf955..500d260 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -104,7 +104,14 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
 
                run_game_cancellable = new Cancellable ();
 
-               run_game_with_cancellable (game, run_game_cancellable);
+               var cancellable = new Cancellable ();
+               run_game_cancellable = cancellable;
+
+               run_game_with_cancellable (game, cancellable);
+
+               // Only reset the cancellable if another one didn't replace it.
+               if (run_game_cancellable == cancellable)
+                       run_game_cancellable = null;
        }
 
        public bool quit_game () {
@@ -354,6 +361,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                if (display_box.runner == null)
                        return false;
 
+               if (run_game_cancellable != null)
+                       return false;
+
                return true;
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]