[gnome-games/glchess-vala] Workaround GTK bug that makes the history buttons wrap around



commit def3a3f39e228060229dfb4349e44842df8548aa
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Jan 6 08:35:17 2011 +1100

    Workaround GTK bug that makes the history buttons wrap around

 glchess/src/glchess.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/glchess/src/glchess.vala b/glchess/src/glchess.vala
index c3b60e6..20d40b1 100644
--- a/glchess/src/glchess.vala
+++ b/glchess/src/glchess.vala
@@ -669,8 +669,11 @@ public class Application
     [CCode (cname = "G_MODULE_EXPORT history_next_clicked_cb", instance_pos = -1)]
     public void history_next_clicked_cb (Gtk.Widget widget)
     {
+        if (view_options.move_number == -1)
+            return;
+
         int move_number = view_options.move_number + 1;
-        if (move_number == game.n_moves)
+        if (move_number >= game.n_moves)
             view_options.move_number = -1;
         else
             view_options.move_number = move_number;
@@ -679,6 +682,9 @@ public class Application
     [CCode (cname = "G_MODULE_EXPORT history_previous_clicked_cb", instance_pos = -1)]
     public void history_previous_clicked_cb (Gtk.Widget widget)
     {
+        if (view_options.move_number == 0)
+            return;
+
         if (view_options.move_number == -1)
             view_options.move_number = (int) game.n_moves - 1;
         else



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