[gnome-games/sudoku-tube] Fix autosave
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Fix autosave
- Date: Sat, 25 Jul 2009 03:36:29 +0000 (UTC)
commit b34220e00e0fad0e6cd32b427368380caf4fd0d8
Author: Zhang Sen <zh jesse gmail com>
Date: Sat Jul 25 12:35:57 2009 +0800
Fix autosave
gnome-sudoku/src/lib/main.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 8e930c6..fb8207d 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -204,8 +204,8 @@ class UI (gconf_wrapper.GConfWrapper):
self.setup_color()
self.setup_actions()
- return
self.setup_autosave()
+ return
#TODO
# self.w.add_accel_group(self.uimanager.get_accel_group())
@@ -426,7 +426,7 @@ class UI (gconf_wrapper.GConfWrapper):
"""Close current running game
Return True if game is closed, or else return False"""
- if (self._main_model.grid.is_changed() and not self.won):
+ if self._should_save():
try:
if dialog_extras.getBoolean(
label = _("Save current game?"),
@@ -455,8 +455,7 @@ class UI (gconf_wrapper.GConfWrapper):
def quit_cb (self, *args):
self.w.hide()
- if (self._main_model and self._main_model.grid.is_changed()
- and (not self.won)):
+ if self._should_save():
self._save_game()
# make sure we really go away before doing our saving --
# otherwise we appear sluggish.
@@ -600,10 +599,14 @@ class UI (gconf_wrapper.GConfWrapper):
def autosave (self):
# this is called on a regular loop and will autosave if we
# have reason to...
- if self.gsd.grid and self.gsd.grid.is_changed() and not self.won:
+ if self._should_save():
self._save_game()
return True
+ def _should_save(self):
+ return self._main_model and self._main_model.grid.is_changed() and \
+ not self.won
+
def show_about (self, *args):
about = gtk.AboutDialog()
about.set_transient_for(self.w)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]