[gnome-sudoku] Clean the grid saving when quitting application.



commit 847d9e2527620966afac95cd49a42070836ab88a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Sep 1 13:40:35 2014 +0200

    Clean the grid saving when quitting application.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735806

 src/gnome-sudoku.vala |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index adc9a8d..4d19294 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -46,7 +46,7 @@ public class Sudoku : Gtk.Application
         {"print-multiple", print_multiple_cb                        },
         {"help", help_cb                                            },
         {"about", about_cb                                          },
-        {"quit", quit_cb                                            }
+        {"quit", quit                                               }
     };
 
     private static const OptionEntry[] option_entries =
@@ -153,13 +153,6 @@ public class Sudoku : Gtk.Application
             start_game (savegame.board);
         else
             show_new_game_screen ();
-
-        window.delete_event.connect ((event) => {
-            if (game != null && !game.board.is_empty () && !game.board.complete)
-                saver.save_game (game);
-
-            return false;
-        });
     }
 
     protected override void activate ()
@@ -169,6 +162,9 @@ public class Sudoku : Gtk.Application
 
     protected override void shutdown ()
     {
+        if (game != null && !game.board.is_empty () && !game.board.complete)
+            saver.save_game (game);
+
         base.shutdown ();
 
         /* Save window state */
@@ -365,12 +361,6 @@ public class Sudoku : Gtk.Application
         printer.run_dialog ();
     }
 
-    private void quit_cb ()
-    {
-        saver.save_game (game);
-        window.destroy ();
-    }
-
     private void help_cb ()
     {
         try


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