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



commit ce9cafadb34503351450bbef8530ca5dd8505ff4
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Sep 2 11:13:49 2016 +0200

    ui: Check 'Quit' dialog before updating the pause
    
    Check that there is no 'Quit' 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 |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 500d260..c9d0ca2 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -126,9 +126,16 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                if (quit_game_cancellable != null)
                        quit_game_cancellable.cancel ();
 
-               quit_game_cancellable = new Cancellable ();
+               var cancellable = new Cancellable ();
+               quit_game_cancellable = cancellable;
+
+               var result = quit_game_with_cancellable (cancellable);
+
+               // Only reset the cancellable if another one didn't replace it.
+               if (quit_game_cancellable == cancellable)
+                       quit_game_cancellable = null;
 
-               return quit_game_with_cancellable (quit_game_cancellable);
+               return result;
        }
 
        [GtkCallback]
@@ -364,6 +371,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
                if (run_game_cancellable != null)
                        return false;
 
+               if (quit_game_cancellable != null)
+                       return false;
+
                return true;
        }
 


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