[gnome-chess/chess-telepathy-networking-support-664946-rebase: 47/64] [glchess] Pass set_move_text() scene and history_model
- From: Chandni Verma <vchandni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/chess-telepathy-networking-support-664946-rebase: 47/64] [glchess] Pass set_move_text() scene and history_model
- Date: Sun, 23 Dec 2012 03:42:34 +0000 (UTC)
commit 5ce19ae7fc141b3bcc255fbf0c9dca19cc4b54b2
Author: Chandni Verma <chandniverma2112 gmail com>
Date: Thu Sep 20 14:36:43 2012 +0530
[glchess] Pass set_move_text() scene and history_model
This allows set_move_text() to be used by glchess-channel-handler
src/gnome-chess-application.vala | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-chess-application.vala b/src/gnome-chess-application.vala
index 11a528e..91514bf 100644
--- a/src/gnome-chess-application.vala
+++ b/src/gnome-chess-application.vala
@@ -399,7 +399,7 @@ public class Application : Gtk.Application
{
Gtk.TreeIter iter;
if (history_combo.model.iter_nth_child (out iter, null, i))
- set_move_text (iter, state.last_move);
+ set_move_text (iter, state.last_move, scene, history_combo.model);
}
i--;
}
@@ -645,7 +645,7 @@ public class Application : Gtk.Application
opponent_engine.request_move ();
}
- protected void set_move_text (Gtk.TreeIter iter, ChessMove move)
+ protected void set_move_text (Gtk.TreeIter iter, ChessMove move, ChessScene scene, Gtk.TreeModel model)
{
/* Note there are no move formats for pieces taking kings and this is not allowed in Chess rules */
const string human_descriptions[] = {/* Human Move String: Description of a white pawn moving from %1$s to %2s, e.g. 'c2 to c4' */
@@ -827,9 +827,8 @@ public class Application : Gtk.Application
break;
}
- var model = (Gtk.ListStore) history_combo.model;
var label = "%u%c. %s".printf ((move.number + 1) / 2, move.number % 2 == 0 ? 'b' : 'a', move_text);
- model.set (iter, 0, label, -1);
+ (model as Gtk.ListStore).set (iter, 0, label, -1);
}
protected void game_move_cb (ChessGame game, ChessMove move)
@@ -848,7 +847,7 @@ public class Application : Gtk.Application
Gtk.TreeIter iter;
model.append (out iter);
model.set (iter, 1, move.number, -1);
- set_move_text (iter, move);
+ set_move_text (iter, move, scene, history_combo.model);
/* Follow the latest move */
if (move.number == game.n_moves && scene.move_number == -1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]