[gnome-chess] Try really hard to not stack games in history



commit 25126e77fc4f5d0787b20e4eeaadf8d8fb212ed1
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Aug 18 22:26:02 2013 -0500

    Try really hard to not stack games in history
    
    I don't have time to remove the history class before 3.9.90.  In the
    mean time, let's just make very sure that we never have more than one
    game in history by deleting everything before adding one.
    
    Obviously a massive FIXME, but the only thing the user will notice is
    that autosave/autoload works as expected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705878

 src/history.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/history.vala b/src/history.vala
index d04a347..5cd7ff2 100644
--- a/src/history.vala
+++ b/src/history.vala
@@ -61,6 +61,13 @@ public class History
         }
 
         Sqlite.Statement statement;
+        /*
+         * FIXME  This deletes all games.
+         * It's a quick hack to prevent games from stacking
+         * Real fix is to just remove this entire class
+         * https://bugzilla.gnome.org/show_bug.cgi?id=705878
+         */
+        assert (db.prepare_v2 ("DELETE FROM GameTable", -1, out statement) == Sqlite.OK);
         assert (db.prepare_v2 ("INSERT INTO GameTable (date, path, result) VALUES (0, \"%s\", 
\"%s\")".printf (relative_path, result), -1, out statement) == Sqlite.OK);
         if (statement.step () != Sqlite.DONE)
             warning ("Failed to insert game into history index: %s", db.errmsg ());


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