Index: gnome-games/gataxx/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/Makefile.am,v
retrieving revision 1.36
diff -u -r1.36 Makefile.am
--- gnome-games/gataxx/Makefile.am	22 Aug 2006 03:21:05 -0000	1.36
+++ gnome-games/gataxx/Makefile.am	29 Sep 2006 07:10:03 -0000
@@ -1,4 +1,3 @@
-themedir=$(datadir)/gnome-games/ataxx/themes/2.14/
 Gamesdir = $(datadir)/applications
 icondir=$(datadir)/icons/hicolor/48x48/apps/
 svgicondir = $(datadir)/icons/hicolor/scalable/apps/
@@ -8,7 +7,6 @@
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
 	-DDATADIR=\""$(datadir)"\"		   \
 	-DTHEMEDIR=\""$(themedir)"\" \
-	$(CAIRO_CFLAGS) \
 	$(GNOME_GAMES_CFLAGS)
 
 bin_PROGRAMS = gataxx
@@ -16,14 +14,6 @@
 gataxx_SOURCES = \
 	ai.c \
 	ai.h \
-	appbar.c \
-	appbar.h \
-	gtkgridboard.c \
-	gtkgridboard.h \
-	gtkgridboardthemes.c \
-	gtkgridboardthemes.h \
-	menus.c \
-	menus.h \
 	gataxx.c \
 	gataxx.h \
 	properties.c \
@@ -31,10 +21,8 @@
 
 gataxx_LDADD = \
 	../libgames-support/libgames-support.la \
-	$(GNOME_GAMES_LIBS) \
-	$(CAIRO_LIBS)
+	$(GNOME_GAMES_LIBS)
 
-theme_DATA=classic.png
 icon_DATA = gnome-ataxx.png
 svgicon_DATA = gnome-ataxx.svg
 
@@ -49,14 +37,13 @@
 
 EXTRA_DIST = AUTHORS \
 	gataxx.desktop.in 	\
-	$(theme_DATA) \
 	$(icon_DATA) \
 	$(svgicon_DATA) \
 	$(schema_in_files)
 
 SUBDIRS = help
 
-DISTCLEANFILES = $(Games_DATA) $(schema_DATA) $(soundlist_DATA)
+DISTCLEANFILES = $(Games_DATA) $(schema_DATA)
 
 install-data-local:
 if GCONF_SCHEMAS_INSTALL
Index: gnome-games/gataxx/ai.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/ai.c,v
retrieving revision 1.3
diff -u -r1.3 ai.c
--- gnome-games/gataxx/ai.c	14 Jan 2005 05:20:09 -0000	1.3
+++ gnome-games/gataxx/ai.c	29 Sep 2006 07:10:03 -0000
@@ -1,6 +1,6 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * ai.c - Artificial intelligence
- * 
+/*
+ * ai.c
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -18,239 +18,311 @@
  * For more details see the file COPYING.
  */
 
+#include <gnome.h>
 
-#include <glib.h>
-#include <gtkgridboard.h>
-#include "gataxx.h"
 #include "ai.h"
-#include "properties.h"
-
-
-static int steps;
-
-
-static int alphabeta(GtkGridBoard * gridboard, int alpha, int beta, int mode, int me, int depth);
-static int get_possible_moves_size(move *pm);
-static move * get_possible_moves(GtkGridBoard *gridboard, int turn);
-static move get_best_move_to(GtkGridBoard *gridboard, int x, int y, int me);
-static void free_possible_moves(move *pm);
 
+static gint  history[MAX_MOVE_COUNT][13];
+static gint  vpointer;
+static GRand *rgen;
+
+gint8 board0[7][7];
+gint vsquares[MAX_VPOINTER][3];
+gint move_count;
+gint whose_turn;
+gint bcount;
+gint wcount;
+
+/* Initialization of data */
+void
+init (void)
+{
+	gint i, j;
+
+	rgen = g_rand_new ();
+
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+			board0[i][j] = EMPTY;
+
+	board0[0][0] = WHITE;
+	board0[0][6] = BLACK;
+	board0[6][0] = BLACK;
+	board0[6][6] = WHITE;
+
+	vpointer = 0;
+	move_count = 0;
+	whose_turn = WHITE;
+	bcount = 2;
+	wcount = 2;
+}
 
-/* take a random move */
-static move computer_move_random(GtkGridBoard * gridboard, int turn) {
-	move * pm;
-	move result;
-	int size, item;
-
-	pm=get_possible_moves(gridboard, turn);
-	size=get_possible_moves_size(pm);
-	if (size>0) {
-		item=g_random_int_range(0, size);
-	} else {
-		item=0;
-	}
-	result=pm[item];
-	free_possible_moves(pm);
-	return result;
+gboolean
+is_valid (gint ox, gint oy, gint nx, gint ny)
+{
+	if (ox < 0 || ox > 6 || nx < 0 || nx > 6)
+		return FALSE;
+	if (board0[oy][ox] != (gint8)whose_turn)
+		return FALSE;
+	if (board0[ny][nx] != EMPTY)
+		return FALSE;
+	if (ox - nx > 2 || ox - nx < -2 || oy - ny > 2 || oy - ny < -2)
+		return FALSE;
+	return TRUE;
 }
 
-/* makes a move which is not completely dumb, but not as hard as the move with
- * the highest heuristic value
- */
-static move computer_move_easy(GtkGridBoard * gridboard, int turn) {
-	move * pm;
-	move bm={ {0, 0, 0}, {0, 0, 0} };
-	int i, size, h, maxh=-100;
-	steps=0;
-
-	pm=get_possible_moves(gridboard, turn);
-	size=get_possible_moves_size(pm);
-	for (i=0; i<size; i+=5) {
-		gtk_gridboard_save_state(gridboard, NULL);
-		gridboard_move(gridboard, pm[i]);
-		h=gtk_gridboard_count_pieces(gridboard, turn);
-		gtk_gridboard_revert_state(gridboard);
-		if (h>maxh) {
-			maxh=h;
-			bm=pm[i];
+void
+move_board (gint ox, gint oy, gint nx, gint ny)
+{
+	gint i, j;
+	gint count = 0, stat = 0, not_me = OTHER_PLAYER (whose_turn);
+
+	if (!is_valid (ox, oy, nx, ny))
+		return;
+
+	for (i = ny - 1; i <= ny + 1; i++)
+	{
+		for (j = nx - 1; j <= nx + 1; j++)
+		{
+			if (i >= 0 && i <= 6 && j >= 0 && j <= 6)
+			{
+				if (board0[i][j] == (gint8) whose_turn)
+					stat = 1;
+				else if (board0[i][j] == (gint8) not_me)
+				{
+					board0[i][j] = (gint8) whose_turn;
+					count++;
+					history [move_count][4 + count] = i * 7 + j;
+				}
+			}
 		}
 	}
-	free_possible_moves(pm);
-	return bm;
+	board0[ny][nx] = (gint8) whose_turn;
+	if (!stat)
+		board0[oy][ox] = EMPTY;
+	history [move_count][0] = whose_turn;
+	history [move_count][1] = oy * 7 + ox;
+	history [move_count][2] = ny * 7 + nx;
+	history [move_count][3] = stat;
+	history [move_count][4] = count;
+	if (whose_turn == BLACK)
+	{
+		bcount += count + stat;
+		wcount -= count;
+	}
+	else
+	{
+		wcount += count + stat;
+		bcount -= count;
+	}
+	move_count++;
+	whose_turn = OTHER_PLAYER (whose_turn);
 }
 
-/* decides which move to take with alphabeta algorithm
- * @param turn  the current player
- * @param depth the maximum search depth in the tree
- * @return the chosen move
- */
-static move computer_move_ab(GtkGridBoard * gridboard, int turn, int depth) {
-	move * pm; 				/* possible moves */
-	move bm={ {0, 0, 0}, {0, 0, 0} }; 	/* best move */
-	move * gm; 				/* good moves */
-	int i, pmsize, gmsize=0;
-	int h, maxh=-100;			/* heuristic values */
-	steps=0;				/* FIXME: debug var */
-
-	pm=get_possible_moves(gridboard, turn);
-	pmsize=get_possible_moves_size(pm);
-	gm=calloc(pmsize, sizeof(move));
-	for (i=0; i<pmsize; i++) {
-		gtk_gridboard_save_state(gridboard, NULL);
-		gridboard_move(gridboard, pm[i]);
-		h=alphabeta(gridboard, -100, 100, FALSE, turn, depth);
-		gtk_gridboard_revert_state(gridboard);
-		if (h>maxh) {
-			maxh=h;
-			gmsize=0;
-			gm[gmsize++]=pm[i];
-		} else if (h==maxh) {
-			gm[gmsize++]=pm[i];
-		}
+/* Back to before board0 */
+void
+back (void)
+{
+	gint o_yx, n_yx;
+	gint count, not_me, stat;
+
+	move_count--;
+	whose_turn = history[move_count][0];
+	o_yx       = history[move_count][1];
+	n_yx       = history[move_count][2];
+	stat       = history[move_count][3];
+	count      = history[move_count][4];
+
+	if (whose_turn == WHITE)
+	{
+		wcount -= count + stat;
+		bcount += count;
+	}
+	else
+	{
+		bcount -= count + stat;
+		wcount += count;
 	}
-	free_possible_moves(pm);
-
-	i=g_random_int_range(0, gmsize);
-	bm=gm[i];
-	free(gm);
-	return bm;
-	
-}
 
-/* this function gets called from gataxx */
-move computer_move(GtkGridBoard * gridboard, int turn) {
-        int level=props_get_level(turn);
-        move ai_move;
-
-        gtk_gridboard_set_visibility (gridboard, FALSE);
-
-	if (level == 1) {
-		ai_move = computer_move_random(gridboard, turn);
-	} else if (level == 2) {
-		ai_move = computer_move_easy(gridboard, turn);
-	} else {
-		ai_move = computer_move_ab(gridboard, turn, level-3);
-        }
-
-        gtk_gridboard_set_visibility (gridboard, TRUE);
-
-        return ai_move;
-}
-
-/* alphabeta search the possible moves */
-static int alphabeta(GtkGridBoard * gridboard, int alpha, int beta, int mode, int me, int depth) {
-	move * pm;
-	int size, i, h;
-	int notme=(me==WHITE ? BLACK : WHITE);
-	int mec, notmec;
-
-	steps++;
-
-	if (depth==0) {
-		mec=gtk_gridboard_count_pieces(GTK_GRIDBOARD (gridboard), me);
-		if (mec==0) return -50;
-		notmec=gtk_gridboard_count_pieces(GTK_GRIDBOARD (gridboard), notme);
-		if (notmec==0) return 50;
-		return mec; /* -notmec; */
-	}
-	if (mode) { /* max */
-		pm=get_possible_moves(gridboard, me);
-		size=get_possible_moves_size(pm);
-		for (i=0; i<size; i++) {
-			gtk_gridboard_save_state(GTK_GRIDBOARD (gridboard), NULL);
-			gridboard_move(gridboard, pm[i]);
-			h=alphabeta(gridboard, alpha, beta, !mode, me, depth-1);
-			if (h>alpha) alpha=h;
-			gtk_gridboard_revert_state(GTK_GRIDBOARD (gridboard));
-			if (alpha>beta) break; 
-		}
-		free_possible_moves(pm);
-		return alpha;
-	} else {
-		pm=get_possible_moves(gridboard, notme);
-		size=get_possible_moves_size(pm);
-		for (i=0; i<size; i++) {
-			gtk_gridboard_save_state(GTK_GRIDBOARD (gridboard), NULL);
-			gridboard_move(gridboard, pm[i]);
-			h=alphabeta(gridboard, alpha, beta, !mode, me, depth-1);
-			if (h<beta) beta=h;
-			gtk_gridboard_revert_state(GTK_GRIDBOARD (gridboard));
-			if (alpha>beta) break; 
-		}
-		free_possible_moves(pm);
-		return beta;
+	board0[n_yx / 7][n_yx % 7] = EMPTY;
+	if (!stat)
+		board0[o_yx / 7][o_yx % 7] = (gint8) whose_turn;
+	not_me = OTHER_PLAYER (whose_turn);
+	while (count > 0)
+	{
+		o_yx = history[move_count][4 + count];
+		board0[o_yx / 7][o_yx % 7] = (gint8) not_me;
+		count--;
 	}
 }
 
-/* returns possible moves
- * The less moves this returns, the faster the search algorithm will work.
- * Therefore, this does not really return _all_ possible moves.
- */
-static move * get_possible_moves(GtkGridBoard * gridboard, int turn) {
-	int x, y, i=0;
-	move * pm;
-	move bm;
-
-	pm=calloc(sizeof(move), BWIDTH*BHEIGHT);
-	for (x=0; x<BWIDTH; x++) {
-		for (y=0; y<BHEIGHT; y++) {
-			bm=get_best_move_to(gridboard, x, y, turn);
-			if (bm.from.valid) pm[i++]=bm;
+static gint
+entry_valid_movement (void)
+{
+	gint ox, oy, nx, ny;
+	gint j;
+
+	j = vpointer;
+	for (oy = 0; oy < 7; oy++)
+	{
+		for (ox = 0; ox < 7; ox++)
+		{
+			for (ny = oy -2; ny <= oy + 2; ny++)
+			{
+				if (ny >= 0 && ny <= 6)
+				for (nx = ox - 2; nx <= ox +2; nx++)
+				{
+					if (nx >= 0 && nx <= 6)
+					{
+						if (is_valid (ox, oy, nx, ny))
+						{
+							j++;
+							vsquares[j][1] = oy * 7 + ox;
+							vsquares[j][2] = ny * 7 + nx;
+							move_board (ox, oy, nx, ny);
+							if (whose_turn == WHITE)
+								vsquares[j][0] = wcount - bcount;
+							else
+								vsquares[j][0] = bcount - wcount;
+							back ();
+						}
+					}
+				}
+			}
 		}
 	}
-	pm[0].from.valid=i;
-	return pm;
+	return j;
 }
 
-static int get_possible_moves_size(move * pm) {
-	return pm[0].from.valid;
+gboolean
+is_game_over (void)
+{
+	if (entry_valid_movement () == vpointer)
+		return TRUE;
+	return FALSE;
 }
 
-static void free_possible_moves(move * pm) {
-	free(pm);
+/* Sort vsquares by small order */
+static void
+sort (guint l, guint r)
+{
+	guint i, j;
+	gint u, v, w, x;
+
+	i = l;
+	j = r;
+	x = vsquares[(l + r) / 2][0];
+	do
+	{
+		while (vsquares[i][0] < x)
+			i++;
+		while (x < vsquares[j][0])
+			j--;
+		if (i < j)
+		{
+			u = vsquares[i][0];
+			v = vsquares[i][1];
+			w = vsquares[i][2];
+			vsquares[i][0] = vsquares[j][0];
+			vsquares[i][1] = vsquares[j][1];
+			vsquares[i][2] = vsquares[j][2];
+			vsquares[j][0] = u;
+			vsquares[j][1] = v;
+			vsquares[j][2] = w;
+		}
+		if (i <= j)
+		{
+			i++;
+			j--;
+		}
+	}
+	while (i <= j);
+
+	if (l < j)
+		sort (l, j);
+	if (i < r)
+		sort (i, r);
 }
 
-/* only thing to make sure the returned move is the "best" move is to
- * prioritize normal moves over jumps
- */
-static move get_best_move_to(GtkGridBoard * gridboard, int x, int y, int me) {
-	move bm;
-	int _x, _y, piece;
+/* alpha-beta search */
+static gint
+search (guint n, gint a, gint b)
+{
+	gint ox, oy, nx, ny;
+	gint aa, bb;
+	gint i, j;
 	
-	bm.from.x=bm.from.y=bm.from.valid=bm.to.x=bm.to.y=bm.to.valid=0;
-	if (gtk_gridboard_get_piece(gridboard, x, y)!=EMPTY) return bm;
+	if (!n)					/* end ? */
+	{
+		if (whose_turn == WHITE)
+			return wcount - bcount;
+		return bcount - wcount;
+	}
 
-	/* search for normal moves */
-	for (_x=MAX(0, x-1); _x<MIN(BWIDTH, x+2); _x++) {
-		for (_y=MAX(0, y-1); _y<MIN(BHEIGHT, y+2); _y++) {
-			piece=gtk_gridboard_get_piece(gridboard, _x, _y);
-			if (piece==me) {
-				bm.from.x=_x;
-				bm.from.y=_y;
-				bm.from.valid=TRUE;
-				bm.to.x=x;
-				bm.to.y=y;
-				bm.to.valid=TRUE;
-				return bm;
-			}
-		}
+	aa = a;
+	j = entry_valid_movement ();
+	if (j == vpointer)			/* end ? */
+	{
+		aa = wcount - bcount;
+		if (whose_turn == BLACK)
+			aa = -aa;
+		if (aa > 0)
+			return aa + 1000;
+		if (aa < 0)
+			return aa - 1000;
+		return 0;
 	}
 
-	/* search for jumps also */
-	for (_x=MAX(0, x-2); _x<MIN(BWIDTH, x+3); _x++) {
-		for (_y=MAX(0, y-2); _y<MIN(BHEIGHT, y+3); _y++) {
-			piece=gtk_gridboard_get_piece(gridboard, _x, _y);
-			if (piece==me) {
-				bm.from.x=_x;
-				bm.from.y=_y;
-				bm.from.valid=TRUE;
-				bm.to.x=x;
-				bm.to.y=y;
-				bm.to.valid=TRUE;
-				return bm;
-			}
+	sort (vpointer + 1, j);		/* sort vsquares    */
+	i = vpointer;				/* save vpointer    */
+	vpointer = j + 1;			/* new vpointer     */
+
+	j = i + 1;
+	while (aa < b && j < vpointer)	/* evaluate squares */
+	{
+		oy = vsquares[j][1] / 7;
+		ox = vsquares[j][1] % 7;
+		ny = vsquares[j][2] / 7;
+		nx = vsquares[j][2] % 7;
+		move_board (ox, oy, nx, ny);
+		bb = -search (n - 1, -b, -aa);
+		back ();
+		if (aa < bb)
+		{
+			aa = bb;
+			vsquares[i][1] = vsquares[j][1];
+			vsquares[i][2] = vsquares[j][2];
 		}
+		j++;
 	}
-	
-	return bm;
+	vpointer = i;				/* pop vpointer      */
+	return aa;
+}
+
+static gint
+random_select (void)
+{
+	guint i, j;
+
+	j = entry_valid_movement ();
+	i = vpointer + 1;
+	if (j > i)
+		i = g_rand_int_range (rgen, i, j + 1);
+	vsquares[0][1] = vsquares[i][1];
+	vsquares[0][2] = vsquares[i][2];
+	return 0;
+}
+
+void
+computer_move (gint level, gint *ox, gint *oy, gint *nx, gint *ny)
+{
+	if (move_count < RUNDOM)
+		vsquares[0][0] = random_select ();
+	else
+		vsquares[0][0] = search (level, -32767, 32767);
+
+	*ox = vsquares[0][1] % 7;
+	*oy = vsquares[0][1] / 7;
+	*nx = vsquares[0][2] % 7;
+	*ny = vsquares[0][2] / 7;	
 }
Index: gnome-games/gataxx/ai.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/ai.h,v
retrieving revision 1.3
diff -u -r1.3 ai.h
--- gnome-games/gataxx/ai.h	14 Jan 2005 05:20:09 -0000	1.3
+++ gnome-games/gataxx/ai.h	29 Sep 2006 07:10:03 -0000
@@ -1,6 +1,6 @@
-/* 
- * ai.c - Artificial intelligence
- * 
+/*
+ * ai.h
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -18,9 +18,26 @@
  * For more details see the file COPYING.
  */
 
-#ifndef AI_H
-#define AI_H
+#define RUNDOM			4
+#define MAX_DEPTH		5
+#define MAX_MOVE_COUNT	100
+#define MAX_VPOINTER	MAX_DEPTH * 120
+
+#define BLACK			1
+#define WHITE			31
+#define EMPTY			127
+
+#define OUTSIDE (BLACK + WHITE)
+#define OTHER_PLAYER(who) (OUTSIDE - who)
+
+void init (void);
+
+gboolean is_valid (gint ox, gint oy, gint nx, gint ny);
+
+void move_board (gint ox, gint oy, gint nx, gint ny);
+
+void back (void);
 
-move computer_move(GtkGridBoard *gridboard, int turn);
+gboolean is_game_over (void);
 
-#endif /* AI_H */
+void computer_move (gint level, gint *ox, gint *oy, gint *nx, gint *ny);
Index: gnome-games/gataxx/appbar.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/appbar.c,v
retrieving revision 1.2
diff -u -r1.2 appbar.c
--- gnome-games/gataxx/appbar.c	25 Jul 2005 11:18:48 -0000	1.2
+++ gnome-games/gataxx/appbar.c	29 Sep 2006 07:10:03 -0000
@@ -1,85 +0,0 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * appbar.c - Status bar 
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- */
-
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include "gataxx.h"
-#include "appbar.h"
-
-static GtkWidget * white_score;
-static GtkWidget * white_label;
-static GtkWidget * black_score;
-static GtkWidget * black_label;
-static GtkWidget * appbar = NULL;
-
-GtkWidget * appbar_new() {
-	GtkWidget * hbox;
-
-	appbar = gtk_statusbar_new();
-	gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (appbar), FALSE);
-
-	hbox=gtk_hbox_new(TRUE, 5);
-
-	white_label=gtk_label_new(_("Light:"));
-	gtk_box_pack_start(GTK_BOX(hbox), white_label, FALSE, FALSE, 0);
-
-	white_score=gtk_label_new("");
-	gtk_box_pack_start(GTK_BOX(hbox), white_score, FALSE, FALSE, 0);
-
-	black_label=gtk_label_new(_("Dark:"));
-	gtk_box_pack_start(GTK_BOX(hbox), black_label, FALSE, FALSE, 0);
-
-	black_score=gtk_label_new("");
-	gtk_box_pack_start(GTK_BOX(hbox), black_score, FALSE, FALSE, 0);
-
-	gtk_widget_show_all(hbox);
-	gtk_box_pack_end(GTK_BOX(appbar), hbox, FALSE, FALSE, 0);
-
-	return appbar;	
-}
-
-void appbar_set_white(int pieces) {
-	gchar * buf;
-
-	buf = g_strdup_printf ("%d", pieces);
-	gtk_label_set_text(GTK_LABEL(white_score), buf); 
-	g_free (buf);
-}
-
-void appbar_set_black(int pieces) {
-	gchar * buf;
-
-	buf = g_strdup_printf ("%d", pieces);
-	gtk_label_set_text(GTK_LABEL(black_score), buf); 
-	g_free (buf);
-}
-
-void appbar_set_status(gchar * status) {
-	gtk_statusbar_pop(GTK_STATUSBAR(appbar), 0);
-	gtk_statusbar_push(GTK_STATUSBAR(appbar), 0, status);
-}
-
-void appbar_set_turn (int player) 
-{
-	gtk_statusbar_pop(GTK_STATUSBAR(appbar), 0);
-	gtk_statusbar_push(GTK_STATUSBAR(appbar), 0,
-			   player == WHITE ? _("Light's move") : _("Dark's move"));
-}
Index: gnome-games/gataxx/appbar.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/appbar.h,v
retrieving revision 1.1
diff -u -r1.1 appbar.h
--- gnome-games/gataxx/appbar.h	25 Mar 2004 08:03:44 -0000	1.1
+++ gnome-games/gataxx/appbar.h	29 Sep 2006 07:10:03 -0000
@@ -1,32 +0,0 @@
-/* (C) 2004 Callum McKenzie
- * appbar.h - Interfaces for manipulating the information in the appbar.
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- */
-
-#ifndef APPBAR_H
-#define APPBAR_H
-
-#include <glib.h>
-
-GtkWidget * appbar_new(void);
-void appbar_set_white (int pieces);
-void appbar_set_black (int pieces);
-void appbar_set_status (gchar * status);
-void appbar_set_turn (int player);
-
-#endif /* APPBAR_H */
Index: gnome-games/gataxx/gataxx.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gataxx.c,v
retrieving revision 1.71
diff -u -r1.71 gataxx.c
--- gnome-games/gataxx/gataxx.c	17 Jul 2006 06:32:15 -0000	1.71
+++ gnome-games/gataxx/gataxx.c	29 Sep 2006 07:10:03 -0000
@@ -1,7 +1,6 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * (C) 1999-2003 Chris Rogers
- * gataxx.c -
- * 
+/*
+ * gataxx.c
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -19,367 +18,802 @@
  * For more details see the file COPYING.
  */
 
-
 #include "config.h"
-#include <gdk/gdkkeysyms.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include <sys/time.h>
-#include <string.h>
+#include <gnome.h>
 #include <gconf/gconf-client.h>
-#include <games-gconf.h>
-#include <games-gridframe.h>
-#include <libintl.h>
-#include <libgnome/libgnome.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "games-stock.h"
+#include "games-preimage.h"
 
-#include "gtkgridboard.h"
-#include "properties.h"
 #include "gataxx.h"
-#include "menus.h"
-#include "appbar.h"
+#include "properties.h"
 #include "ai.h"
 
-#define GCONF_WINDOW_WIDTH "/apps/gataxx/width"
-#define GCONF_WINDOW_HEIGHT "/apps/gataxx/height"
+gint8     pixmaps[7][7];
+gint8     board[7][7];
+gint      kifu[150][3];
+
+GtkWidget *window;
+GtkWidget *properties_dialog = NULL;
+GtkWidget *file_open_dialog;
+GtkWidget *file_save_dialog;
+
+GtkWidget *drawing_area;
+GdkGC     *gridGC[2] = { 0 };
+GdkColor  bg_color[3] = {{0,0,0,0},             /* background color */
+            {0xffffffff,0xffff,0xffff,0xffff},  /* grid color */
+            {0,0,0,0}};                         /* tmp color  */
+
+guint     board_width;
+guint     board_height;
+guint     black_computer_level;
+guint     white_computer_level;
+gboolean  animate;
+gboolean  quick_moves;
+gboolean  animate_stagger;
+gboolean  grid;
+gboolean  flip_final;
+gchar     *tile_set;
+gchar     *bg_color_name;
+guint     computer_speed;
+guint     flip_speed;
+gboolean  game_in_progress;
+
+static GtkWidget *counter;
+static GtkWidget *score[4];
+static GtkWidget *statusbar;
+static GtkWidget *entry;
+static GdkPixmap *buffer_pixmap = NULL;
+static GdkPixmap *tiles_pixmap = NULL;
+static GTimer    *b_timer;
+static GTimer    *w_timer;
+static guint     tile_width;
+static guint     tile_height;
+static gchar     *flip_sound;
+static gchar     *gameover_sound;
+static gboolean  flip_tiles = FALSE;
+static gboolean  play_sound = FALSE;
+static gboolean  gameover = FALSE;
+static guint     context_id = 0;
+static guint     computer_id = 0;
+static guint     flip_pixmaps_id = 0;
+static guint     flip_final_id = 0;
+static guint     timer_id = 0;
+static gint      old_x = -1;
+static gint      old_y = -1;
+
+static GtkActionGroup *action_group;
+static GtkUIManager *manager;
+static GtkAction *open_action;
+static GtkAction *new_game_action;
+static GtkAction *redo_game_action;
+static GtkAction *show_hint_action;
+static GtkAction *sync_action;
+static GtkAction *again_action;
+static GtkAction *preferences_action;
+
+static gboolean ggz_network_mode = FALSE;
+
+extern gint8 board0[7][7];
+extern gint  vsquares[MAX_DEPTH * 100][3];
+extern gint  bcount;
+extern gint  wcount;
+extern gint  move_count;
+extern gint  whose_turn;
 
-GtkGridBoard * gridboard;		/* current gridboard */
-GtkWidget * window;             /* The apps main window. */
-gint turn;		        /* current player */
-position selection={0, 0, 0};	/* last selected position */
-int timeout;			/* computer speed */
-
-GnomeProgram *program;
-
-/* Command-line handling. */
-static gint iturn = 1;
-static gchar * state = NULL;
-
-static const GOptionEntry options[] = {
-  {"state", 's', 0, G_OPTION_ARG_STRING, &state,
-   N_("Set the state of the board at start-up."), N_("STATE")},
-  {"turn", 't', 0, G_OPTION_ARG_INT, &iturn,
-   N_("Set whose turn it is."), N_("1 (Light) or 2 (Dark)")},
-  {NULL}
-};
 
-/* gettext i18n stuff */
-static void settextdomain() {
-	bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
-	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-	textdomain(GETTEXT_PACKAGE);
-}
-
-/* returns true if at least one move is possible for player /turn/ */
-gboolean move_possible(GtkGridBoard * gridboard, int turn) {
-	int x, y;
-	gboolean mov;
-
-	for (x=0; x<BWIDTH; x++) {
-		for (y=0; y<BHEIGHT; y++) {
-			mov=move_possible_to(gridboard, x, y, turn);
-			if (mov) {
-				return TRUE;
-			}
-		}
+gint
+clamp_int (gint input, gint low, gint high)
+{
+	if (input < low)
+		input = low;
+	if (input > high)
+		input = high;
+
+	return input;
+}
+
+static void
+copy_board (void)
+{
+	guint i, j;
+
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+			board[ i ][ j ] = board0[ i ][ j ];
+}
+
+static void
+copy_pixmaps (void)
+{
+	guint i, j;
+
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+			pixmaps[ i ][ j ] = board[ i ][ j ];
+}
+
+void
+set_board_size (void)
+{
+	gint depth = -1;
+	
+	board_width = clamp_int(board_width, BOARD_MIN, BOARD_W_MAX);
+	board_height = clamp_int(board_height, BOARD_MIN, BOARD_H_MAX);
+	tile_width = (board_width - GRIDWIDTH * 6) / 7;
+	tile_height = (board_height - GRIDWIDTH * 6) / 7;
+	board_width = tile_width * 7 + GRIDWIDTH * 6;
+	board_height = tile_height * 7 + GRIDWIDTH * 6;
+	save_properties ();
+	
+	gtk_widget_set_size_request (drawing_area, board_width, board_height);
+	if (buffer_pixmap)
+	{
+		g_object_unref (buffer_pixmap);
+		depth = gdk_drawable_get_depth ((GdkDrawable*) drawing_area->window);
 	}
-	return FALSE;
+	buffer_pixmap = gdk_pixmap_new (drawing_area->window,
+						board_width, board_height, depth);
 }
 
-/* returns true if a move is possible to (x, y) */
-gboolean move_possible_to(GtkGridBoard * gridboard, int x, int y, int turn) {
-	int piece, _x, _y;
-	if (gtk_gridboard_get_piece(gridboard, x, y)!=EMPTY) 
-	  return FALSE;
-	for (_x=MAX(0, x-2); _x<MIN(BWIDTH, x+3); _x++) {
-		for (_y=MAX(0, y-2); _y<MIN(BHEIGHT, y+3); _y++) {
-			piece=gtk_gridboard_get_piece(gridboard, _x, _y);
-			if (piece==turn) return TRUE;
-		}
+void
+set_bg_color (void)
+{
+	gint i;
+	
+	gdk_color_parse (bg_color_name, &bg_color[0]);
+	gdk_colormap_alloc_color (gtk_widget_get_colormap (drawing_area),
+				&bg_color[0], FALSE, TRUE);
+	
+	for (i = 0; i < 2; i++)
+	{
+		if (gridGC[i])
+			g_object_unref (gridGC[i]);
+		gridGC[i] = gdk_gc_new (drawing_area->window);
+		gdk_gc_copy (gridGC[i], drawing_area->style->bg_gc[0]);
+		gdk_gc_set_background (gridGC[i], &bg_color[i]);
+		gdk_gc_set_foreground (gridGC[i], &bg_color[i]);
 	}
-	return FALSE;
-}	
+}
 
-/* after a move is done, a timeout is set on this function */
-gboolean computer_move_cb(gpointer turn) {
-	move cm;
-
-	/* In case the level gets changed between the timeout
-	 * being set and it going off. */
-	if (props_get_level (GPOINTER_TO_INT (turn)) < 1)
-	  return FALSE;
+static void
+load_image (gchar *tileset,	GamesPreimage **image)
+{
+	gchar *fname, *pathname;
+	GError *error = NULL;
 
-	cm=computer_move(gridboard, GPOINTER_TO_INT(turn));
-	do_move(cm);
-	return FALSE;
+	fname = g_build_filename ("iagno", tileset, NULL);
+	pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
+					   fname, TRUE, NULL);
+	*image = games_preimage_new_from_file (pathname, &error);
+	g_free (fname);
 }
 
-/* gets called when the user clicks with the mouse */
-void boxclicked_cb(GtkWidget * widget, int x, int y) {
-	int dist=MAX(ABS(selection.x-x), ABS(selection.y-y));
-	int piece=gtk_gridboard_get_piece(gridboard, x, y);
-	move m={{selection.x, selection.y, selection.valid}, {x, y, TRUE}};
-
-	if (!props_is_human(turn)) return;
-	
-	if ((selection.valid)&&(piece==EMPTY)&&(dist<=2)) {
-		dist=MAX(ABS(selection.x-x), ABS(selection.y-y));
-		do_move(m);
-		selection.valid=FALSE;
-	} else if (piece==turn) {
-		do_select(x, y);
-		selection.x=x;
-		selection.y=y;
-		selection.valid=TRUE;
-	}
-	
-	gtk_gridboard_paint (gridboard);
-}
-
-/* sets pieces, adds undo info, changes statusbar and changes turn */
-void do_move(move m) {
-	/* undo info */
-	if (props_is_human(turn)) {
-		gtk_gridboard_save_state(gridboard, GINT_TO_POINTER(turn));
-	}
-	if (gtk_gridboard_states_present(gridboard)) {
-		menu_undo_set_sensitive(TRUE);
-	} else {
-		menu_undo_set_sensitive(FALSE);
+void
+load_pixmaps (void)
+{
+	GdkPixbuf *image;
+	GamesPreimage *t_image;
+	gint depth = -1;
+	GdkGC *gc;
+	
+	load_image (tile_set, &t_image);
+	if (!t_image)
+	{
+		if (tile_set)
+			g_free (tile_set);
+		tile_set = g_strdup ("sun_and_star.svg");
+		load_image (tile_set, &t_image);
+		if (!t_image)
+		{
+			g_print ("Could not find \'%s\' pixmap file\n", "iagno/sun_and_star.svg");
+			exit (1);
+		}
+		save_properties ();
+		reset_properties ();
+	}
+
+	image = games_preimage_render (t_image,
+				tile_width * 8, tile_height * 4, NULL);
+
+	if (tiles_pixmap)
+	{
+		g_object_unref (tiles_pixmap);
+		depth = gdk_drawable_get_depth ((GdkDrawable*) drawing_area->window);
 	}
+	tiles_pixmap = gdk_pixmap_new (drawing_area->window,
+				tile_width * 8, tile_height * 4, depth);
+
+	gc = gdk_gc_new (tiles_pixmap);
+	gdk_gc_set_foreground (gc, &bg_color[0]);
+	gdk_gc_set_background (gc, &bg_color[0]);
+
+	gdk_draw_rectangle (tiles_pixmap, gc, TRUE, 0, 0,
+				tile_width * 8, tile_height * 4);
+	gdk_draw_pixbuf (tiles_pixmap, gc, image, 0, 0, 0, 0,
+				tile_width * 8, tile_height * 4, GDK_RGB_DITHER_NONE, 0, 0);
+	
+	g_object_unref (image);
+	g_object_unref (t_image);
+}
+
+static void
+gui_draw_pixmap_buffer (guint x, guint y, guint which)
+{
+	gdk_draw_drawable (buffer_pixmap, gridGC[0], tiles_pixmap,
+			    tile_width * (which % 8),    tile_height * (which / 8),
+			   (tile_width + GRIDWIDTH) * x,(tile_height + GRIDWIDTH) * y,
+			    tile_width,                  tile_height);
+}
+
+static void
+gui_draw_pixmap (guint x, guint y, guint which)
+{
+	gui_draw_pixmap_buffer (x, y, which);
+	gdk_draw_drawable (drawing_area->window, gridGC[0], tiles_pixmap,
+			    tile_width * (which % 8),    tile_height * (which / 8),
+			   (tile_width + GRIDWIDTH) * x,(tile_height + GRIDWIDTH) * y,
+			    tile_width,                  tile_height);
+}
+
+static void
+gui_draw_grid (guint j)
+{
+	guint i;
+
+	gdk_gc_set_line_attributes (gridGC[1], GRIDWIDTH, GDK_LINE_ON_OFF_DASH,
+				    GDK_CAP_BUTT, GDK_JOIN_MITER);
 		
+	for (i = tile_height; i < board_height; i += tile_height + GRIDWIDTH)
+		gdk_draw_line (buffer_pixmap, gridGC[j], 0, i, board_width, i);
+	for (i = tile_width; i < board_width; i += tile_width + GRIDWIDTH)
+		gdk_draw_line (buffer_pixmap, gridGC[j], i, 0, i, board_height);
+}
+
+static void
+gui_status (void)
+{
+	gchar message[5];
 	
-	gtk_gridboard_clear_selections(GTK_GRIDBOARD (gridboard));
-	gridboard_move(gridboard, m);
+	sprintf (message, _("%.2d"), move_count);
+	gtk_label_set_text (GTK_LABEL (counter), message);
+	sprintf (message, _("%.2d"), bcount);
+	gtk_label_set_text (GTK_LABEL (score[0]), message);
+	sprintf (message, _("%.2d"), wcount);
+	gtk_label_set_text (GTK_LABEL (score[1]), message);
+}
+
+static void
+redraw_board (void)
+{
+	guint i, j, which;
 
-	appbar_set_white(gtk_gridboard_count_pieces(GTK_GRIDBOARD (gridboard), WHITE));
-	appbar_set_black(gtk_gridboard_count_pieces(GTK_GRIDBOARD (gridboard), BLACK));
+	copy_pixmaps ();
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+		{
+			which = 0;
+			if (pixmaps[i][j] != EMPTY)
+				which = (guint) (pixmaps[i][j] - BLACK + 1);
+			gui_draw_pixmap_buffer (j, i, which);
+		}
 
-	turn = turn == BLACK ? WHITE : BLACK;
-	appbar_set_turn (turn);
+	gui_draw_grid (0);
+	if (grid)
+		gui_draw_grid (1);
+	gtk_widget_queue_draw_area (drawing_area, 0, 0, board_width, board_height);
+	gui_status ();
+}
 
-	if (!move_possible(gridboard, turn)) {
-		g_timeout_add(timeout, end_game_cb, GINT_TO_POINTER(turn));
-		return;
-	}
+void
+refresh_board (void)
+{
+	set_board_size ();
+	set_bg_color ();
+	load_pixmaps ();
+	redraw_board ();	
+}
 
-	if (!props_is_human(turn)) {
-		g_timeout_add(timeout, computer_move_cb, 
-                              GINT_TO_POINTER(turn));
-	}
+static void
+sprint_time (gchar *message, GTimer *timer)
+{
+	gint mm, ss;
 
+	ss = (gint) g_timer_elapsed (timer, NULL);
+	mm = ss / 60;
+	ss -= mm * 60;
+	sprintf (message, _("%.2d:%.2d"), mm, ss);
 }
 
-/* game over */
-gboolean end_game_cb(gpointer data) {
-	int wc=gtk_gridboard_count_pieces(gridboard, WHITE);
-	int bc=gtk_gridboard_count_pieces(gridboard, BLACK);
+static void
+gui_timer (void)
+{
+	gchar message[9];
 	
-	turn=EMPTY;
+	sprint_time (message,b_timer);
+	gtk_label_set_text (GTK_LABEL (score[2]), message);
+	sprint_time (message,w_timer);
+	gtk_label_set_text (GTK_LABEL (score[3]), message);		
+}
 
-	if (wc>bc) {
-		appbar_set_status(_("Light player wins!"));
-	} else if (wc<bc) {
-		appbar_set_status(_("Dark player wins!"));
-	} else {
-		appbar_set_status(_("The game was a draw."));
-	}
+static void
+timer_start (void)
+{
+	if (timer_id)
+		g_source_remove (timer_id);
+	timer_id = g_timeout_add (500, (GSourceFunc) gui_timer, NULL);
+}
 
-	flip_final (gridboard, wc, bc);
-	gtk_gridboard_paint (gridboard);
+void
+gui_message (gchar *message)
+{
+	if (context_id)
+		gtk_statusbar_pop (GTK_STATUSBAR (statusbar), context_id);
+	context_id =
+		gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), message);
+	gtk_statusbar_push (GTK_STATUSBAR (statusbar), context_id, message);
+}
 
-	return FALSE; /* kill the timeout */
+void
+gui_entry (gchar *message)
+{
+	gtk_entry_set_text (GTK_ENTRY (entry), message);
 }
 
-/* makes an overview of all the pieces on the board at the end of the game */
-void flip_final(GtkGridBoard * gridboard, int wc, int bc) {
-	int x, y, piece=EMPTY;
-	int ec=BWIDTH*BHEIGHT-wc-bc;
+static void
+gui_hint (gint oyx, gint nyx, gint score)
+{
+	gchar message[16];
+
+	message[0] = (gchar) (oyx % 7 + 0x41);
+	message[1] = (gchar) (oyx / 7 + 0x31);
+	message[2] = 0x2D;
+	message[3] = (gchar) (nyx % 7 + 0x41);
+	message[4] = (gchar) (nyx / 7 + 0x31);
+	message[5] = 0x20;
+	sprintf (&message[6], _("%d"), score);
 
-	for (y=0; y<BWIDTH; y++) {
-		for (x=0; x<BHEIGHT; x++) {
-			if (wc) {
-				piece=WHITE;
-				wc--;
-			} else if (ec) {
-				piece=EMPTY;
-				ec--;
-			} else if (bc) {
-				piece=BLACK;
-				bc--;
-			}
-			gtk_gridboard_set_piece(gridboard, x, y, piece);
-		}
-	}
+	gui_entry (message);
 }
 
-/* changes the pieces on the board */
-void gridboard_move(GtkGridBoard * gridboard, move m) {
-	int dist;
-	int piece=gtk_gridboard_get_piece(gridboard, m.from.x, m.from.y);
-	dist=MAX(ABS(m.from.x-m.to.x), ABS(m.from.y-m.to.y));
-	if (dist==1) {
-		gtk_gridboard_set_piece(gridboard, m.to.x, m.to.y, piece);
-	} else if (dist==2) {
-		gtk_gridboard_set_piece(gridboard, m.to.x, m.to.y, piece);
-		gtk_gridboard_set_piece(gridboard, m.from.x, m.from.y,
-				EMPTY);
-	} else {
-		return;
-	}
-	turn_pieces(gridboard, m.to.x, m.to.y);
+static void
+clear_board (void)
+{
+	guint i, j;
+
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+			board[i][j] = EMPTY;
+
+	game_in_progress = FALSE;
+	move_count = 0;
+	bcount = 0;
+	wcount = 0;
 }
 
-/* turn all surrounding pieces */
-void turn_pieces(GtkGridBoard * gridboard, int x, int y) {
-	int me, _x, _y, piece;
-	me=gtk_gridboard_get_piece(gridboard, x, y);
-	for (_x=MAX(0, x-1); _x<MIN(BWIDTH, x+2); _x++) {
-		for (_y=MAX(0, y-1); _y<MIN(BHEIGHT, y+2); _y++) {
-			piece=gtk_gridboard_get_piece(gridboard, _x, _y);
-			if ((piece!=EMPTY)&&(piece!=me)) {
-				gtk_gridboard_set_piece(gridboard, _x, _y, me);
-			}
-		}
+static void
+check_sound (void)
+{
+	if (play_sound)
+	{
+		gnome_sound_play (flip_sound);
+		play_sound = FALSE;
+	}
+	if (gameover)
+	{
+		gnome_sound_play (gameover_sound);
+		gameover = FALSE;
 	}
 }
 
-/* selects (x, y) and all surrounding boxes */
-void do_select(int x, int y) {
-	int _x, _y;
-
-	gtk_gridboard_clear_selections(gridboard);
-	for (_x=MAX(0, x-2); _x<MIN(BWIDTH, x+3); _x++) {
-		for (_y=MAX(0, y-2); _y<MIN(BHEIGHT, y+3); _y++) {
-			if (gtk_gridboard_get_piece(gridboard, _x, _y)==EMPTY) {
-				gtk_gridboard_set_selection(gridboard, 
-					SELECTED_A, _x, _y);
+static gboolean
+flip_pixmaps (gpointer data)
+{
+	guint i, j, which;
+
+	check_sound ();
+
+	if (!flip_tiles)
+		return TRUE;
+	flip_tiles = FALSE;
+
+	for (i = 0; i < 7; i++)
+		for (j = 0; j < 7; j++)
+		{
+			if (pixmaps[i][j] == EMPTY && board[i][j] != EMPTY)
+			{
+				pixmaps[i][j] = board[i][j];
+				which = clamp_int ((gint)pixmaps[i][j], BLACK, WHITE);
+				gui_draw_pixmap (j, i, which - BLACK + 1);
+				flip_tiles = TRUE;
+			}
+			else if (pixmaps[i][j] != EMPTY && board[i][j] == EMPTY)
+			{
+				pixmaps[i][j] = EMPTY;
+				gui_draw_pixmap (j, i, 0);
+				flip_tiles = TRUE;
+			}
+			else if (pixmaps[i][j] < board[i][j] && board[i][j] != EMPTY)
+			{
+				if (!animate)
+				{
+					if (pixmaps[i][j] == BLACK)
+						pixmaps[i][j] = board[i][j];
+					else
+						pixmaps[i][j]++;
+				}
+				else if (animate)
+					pixmaps[i][j]++;
+
+				which = clamp_int ((gint)pixmaps[i][j], BLACK, WHITE);
+				gui_draw_pixmap (j, i, which - BLACK + 1);
+				flip_tiles = TRUE;
+			}
+			else if (pixmaps[i][j] > board[i][j] && pixmaps[i][j] != EMPTY)
+			{
+				if (!animate)
+				{
+					if (pixmaps[i][j] == WHITE)
+						pixmaps[i][j] = board[i][j];
+					else
+						pixmaps[i][j]--;
+				}
+				else if (animate)
+					pixmaps[i][j]--;
+
+				which = clamp_int ((gint)pixmaps[i][j], BLACK, WHITE);
+				gui_draw_pixmap (j, i, which - BLACK + 1);
+				flip_tiles = TRUE;
 			}
 		}
-	}
-	gtk_gridboard_set_selection(gridboard, SELECTED_B, x, y);
+
+	return TRUE;
 }
 
-/* Restore the state of the board from the command line. */
-static void restore_state (void)
+static gboolean
+flip_final_results (gpointer data)
 {
-  int i,j;
+	guint i;
+	gint8 adder = 0;
 
-  gtk_gridboard_clear (gridboard);
+	i = 0;
+	for (; i < bcount; i++)
+	{
+		board[i / 7][i % 7] = BLACK;
+		if (pixmaps[i / 7][i % 7] == EMPTY)
+			pixmaps[i / 7][i % 7] = WHITE;
+		if (pixmaps[i / 7][i % 7] == WHITE)
+		{
+			pixmaps[i / 7][i % 7] += adder;
+			if (animate_stagger)
+				adder++;
+		}
+	}
 
-  if (!state)
-    return;
+	for (; i < 49 - wcount; i++)
+		board[i / 7][i % 7] = EMPTY;
 
-  for (j=0; j<BHEIGHT; j++) {
-    for (i=0; i<BWIDTH; i++) {
-      if (*state == '\0')
-	return;
-      switch (*state) {
-      case '1':
-	gtk_gridboard_set_piece (gridboard, i, j, WHITE);
-	break;
-      case '2':
-	gtk_gridboard_set_piece (gridboard, i, j, BLACK);
-	break;
-      }
-      state++;
-    }
-  }
+	for (; i < 49; i++)
+	{
+		board[i / 7][i % 7] = WHITE;
+		if (pixmaps[i / 7][i % 7] == EMPTY)
+			pixmaps[i / 7][i % 7] = BLACK;
+		if (pixmaps[i / 7][i % 7] == BLACK)
+		{
+			pixmaps[i / 7][i % 7] -= adder;
+			if (animate_stagger)
+				adder++;
+		}
+	}
+	flip_tiles = TRUE;
+	return FALSE;
 }
 
-/* This handles both games loaded off the command line and proper new games. */
-static void new_game(void)
+void
+set_flip_pixmaps_id (void)
 {
-        gboolean boardok = FALSE;
+	if (flip_pixmaps_id)
+		g_source_remove (flip_pixmaps_id);
 
-        if (state) {
-	  restore_state ();
-	  state = NULL;
-	  boardok = (gtk_gridboard_count_pieces(gridboard, WHITE) > 0) && 
-        	    (gtk_gridboard_count_pieces(gridboard, BLACK) > 0);
-	} 
-	if (!boardok) {
-	  gtk_gridboard_clear(gridboard);
+	if (animate)
+		flip_pixmaps_id = g_timeout_add (flip_speed, flip_pixmaps, NULL);
+	else
+		flip_pixmaps_id = g_timeout_add (100, flip_pixmaps, NULL);
+}
 
-	  gtk_gridboard_set_piece(gridboard, 0, 0, WHITE);
-	  gtk_gridboard_set_piece(gridboard, 0, 6, BLACK);
-	  gtk_gridboard_set_piece(gridboard, 6, 0, BLACK);
-	  gtk_gridboard_set_piece(gridboard, 6, 6, WHITE);
+static gboolean
+check_game_over (void)
+{
+	if (is_game_over ())
+	{
+		if (wcount > bcount)
+			gui_message ("Light player wins!");
+		if (bcount > wcount)
+			gui_message ("Dark player wins!");
+		if (wcount == bcount)
+			gui_message ("The game was a draw.");
+
+		if (flip_final)
+			flip_final_id = g_timeout_add (computer_speed,
+								flip_final_results, NULL);
+
+		game_in_progress = FALSE;
+		gameover = TRUE;
+		return TRUE;
 	}
 
-	if (iturn != WHITE) {
-	  turn = BLACK;
-	  iturn = WHITE;
-	} else {
-	  turn = WHITE;
+	if (whose_turn == BLACK)
+	{
+		gui_message ("Dark's move");
+		if (game_in_progress)
+			g_timer_continue (b_timer);
+	}
+	else if (whose_turn == WHITE)
+	{
+		gui_message ("Light's move");
+		if (game_in_progress)
+			g_timer_continue (w_timer);
 	}
+	return FALSE;
+}
+
+static gboolean
+t_computer_move (gpointer level)
+{
+	gint ox, oy, nx, ny;
+
+	computer_move (GPOINTER_TO_INT (level), &ox, &oy, &nx, &ny);
+	if (game_in_progress)
+		return move (whose_turn, ox, oy, nx, ny);
+	return FALSE;
+}
+
+gboolean
+check_computer_players (void)
+{
+	guint level = 0;
 	
-	appbar_set_turn(turn);
-	appbar_set_white(gtk_gridboard_count_pieces(gridboard, WHITE));
-	appbar_set_black(gtk_gridboard_count_pieces(gridboard, BLACK));
+	if (computer_id)
+	{
+		g_source_remove (computer_id);
+		computer_id = 0;
+	}
 
-	if (!props_is_human(turn)) {
-		g_timeout_add(timeout, computer_move_cb,
-                              GINT_TO_POINTER(turn));
+	if (black_computer_level && whose_turn == BLACK)
+		level = black_computer_level;
+	else if (white_computer_level && whose_turn == WHITE)
+		level = white_computer_level;
+	if (level)
+	{
+		gui_entry ("Now thinking.");
+		computer_id = g_timeout_add (computer_speed,
+					(GSourceFunc) t_computer_move, GINT_TO_POINTER (level));
 	}
+	return FALSE;
 }
 
-/* menu: Game->New game */
-void new_game_cb(GtkWidget * widget, gpointer data)
-{
-        new_game ();
-	gtk_gridboard_paint (gridboard);
+static gboolean
+check_valid_move (gint who, gint ox, gint oy, gint nx, gint ny)
+{	
+	if (!game_in_progress)
+		return FALSE;
+	if (who != whose_turn)
+		return FALSE;
+	if (ox < 0 || ox > 6 || oy < 0 || oy > 6
+		|| nx < 0 || nx > 6 || ny < 0 || ny > 6)
+		return FALSE;
+
+	return is_valid (ox, oy, nx, ny);
 }
 
+gboolean
+move (gint who, gint ox, gint oy, gint nx, gint ny)
+{
+	if (!check_valid_move (who, ox, oy, nx, ny))
+		return FALSE;
+	if (game_in_progress)
+	{
+		kifu[move_count][0] = whose_turn;
+		kifu[move_count][1] = oy * 7 + ox;
+		kifu[move_count][2] = ny * 7 + nx;
+		kifu[move_count + 1][0] = 0;
+		if (whose_turn == BLACK)
+			g_timer_stop (b_timer);
+		else
+			g_timer_stop (w_timer);
+	}
+
+	move_board (ox, oy, nx, ny);
 
-/* menu: Game->Undo move */
-void undo_move_cb(GtkWidget * widget, gpointer data) {
-	if (gtk_gridboard_states_present(gridboard)) {
-		turn=GPOINTER_TO_INT(gtk_gridboard_revert_state(gridboard));
+	if (move_count >= MAX_MOVE_COUNT - MAX_DEPTH)
+	{
+		gui_message ("Count overflow!");
+		game_in_progress = FALSE;
+		return FALSE;
 	}
-	if (gtk_gridboard_states_present(gridboard)) {
-		menu_undo_set_sensitive(TRUE);
-	} else {
-		menu_undo_set_sensitive(FALSE);
+		
+	old_x = -1;
+	old_y = -1;
+	gui_entry (" ");
+	gtk_entry_set_position ((GtkEntry *) entry, 0);
+	copy_board ();
+	gui_status ();
+	flip_tiles = TRUE;
+	play_sound = TRUE;
+	check_game_over ();
+	if (game_in_progress)
+		return check_computer_players ();
+
+	return FALSE;
+}
+
+void
+init_new_game (void)
+{
+	if (flip_final_id)
+	{
+		g_source_remove (flip_final_id);
+		flip_final_id = 0;
 	}
-	if (!props_is_human(turn)) {
-		g_timeout_add(timeout, computer_move_cb, GINT_TO_POINTER(turn));
+	if (computer_id)
+	{
+		g_source_remove (computer_id);
+		computer_id = 0;
 	}
-	selection.valid = FALSE;
-	appbar_set_turn (turn);
-	appbar_set_white (gtk_gridboard_count_pieces(gridboard, WHITE));
-	appbar_set_black (gtk_gridboard_count_pieces(gridboard, BLACK));
-	gtk_gridboard_paint (gridboard);
+
+	kifu[0][0] = 0;
+	init ();
+	copy_board ();
+	redraw_board ();
+	game_in_progress = TRUE;
+	g_timer_stop (b_timer);
+	g_timer_reset (b_timer);
+	g_timer_stop (w_timer);
+	g_timer_reset (w_timer);
+	gui_timer ();
+	timer_start ();
+	check_game_over ();
+	check_computer_players ();
 }
 
-/* menu: Game->Quit */
-gboolean quit_game_cb(GtkWidget * widget, gpointer data) {
-	gtk_main_quit();
-	
-	return TRUE;
+static void
+network_gui_update (void)
+{
+	if (ggz_network_mode)
+	{
+		black_computer_level = 0;
+		white_computer_level = 0;
+	}
+	gtk_action_set_sensitive (open_action,        !ggz_network_mode); 
+	gtk_action_set_visible   (new_game_action,    !ggz_network_mode); 
+	gtk_action_set_visible   (redo_game_action,   !ggz_network_mode); 
+	gtk_action_set_visible   (show_hint_action,   !ggz_network_mode); 
+	gtk_action_set_visible   (sync_action,         ggz_network_mode); 
+	gtk_action_set_visible   (again_action,        ggz_network_mode); 
+	gtk_action_set_sensitive (preferences_action, !ggz_network_mode); 
+	gtk_widget_set_sensitive (
+		gtk_ui_manager_get_widget (manager, "/ToolBar"), !ggz_network_mode);
 }
 
-/* menu: Settings->Preferences */
-void properties_cb(GtkWidget * widget, gpointer data) {
-	show_properties_dialog();
+static void
+on_open_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	game_in_progress = FALSE;
+	g_timer_stop (b_timer);
+	g_timer_stop (w_timer);
+	g_timer_reset (b_timer);
+	g_timer_reset (w_timer);
+	gui_timer ();
+	kifu[0][0] = 0;
+	file_open_dialog = create_file_open_dialog ();
+	gtk_widget_show (file_open_dialog);
 }
 
-/* this gets called whenever some setting has changed */
-void
-apply_changes() {
-	gtk_gridboard_set_animate (gridboard, props_get_animate());
-	gtk_gridboard_set_theme (gridboard, props_get_theme());
+static void
+on_save_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	GDate *date;
+	gchar filename[17];
+
+	date = g_date_new ();
+	g_date_set_time_t (date, time (NULL));
+	g_date_strftime (filename, 17, _("%y%m%d%H"), date);
+
+	file_save_dialog = create_file_save_dialog ();
+	gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER
+					   (file_save_dialog), filename);
+	gtk_widget_show (file_save_dialog);
+	g_date_free (date);
+}
+
+static void
+on_quit_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	gtk_main_quit ();
+}
+
+static void
+on_new_game_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	init_new_game ();
+}
+
+static void
+on_redo_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	if (game_in_progress)
+		return;
+	if (move_count < 0)
+		return;
+	if (is_game_over ())
+		return;
 	
-	if (props_get_quick_moves()) {
-		timeout=DEF_TIMEOUT/2;
-	} else {
-		timeout=DEF_TIMEOUT;
-	}
-	gtk_gridboard_paint (gridboard);
+	game_in_progress = TRUE;
+	kifu[move_count][0] = 0;
+	check_game_over ();
+	check_computer_players ();
 }
 
-/* menu: Help->About */
-void
-about_cb(GtkWidget *widget, gpointer data)
+static void
+on_hint_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	gint ox, oy, nx, ny;
+
+	if (move_count < 0)
+		return;
+	if (is_game_over())
+		return;
+
+	computer_move (MAX_DEPTH, &ox, &oy, &nx, &ny);
+	gui_hint (oy*7+ox, ny*7+nx, vsquares[0][0]);
+}
+
+static void
+on_sync_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+#ifdef GGZ_CLIENT
+	if (ggz_write_int (fd, RVR_REQ_SYNC) < 0)
+		gui_entry ("Can't send request sync!");
+#endif
+}
+
+static void
+on_again_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+#ifdef GGZ_CLIENT
+	if (ggz_write_int (fd, RVR_REQ_AGAIN) < 0)
+		gui_entry ("Can't send request again!");
+#endif
+}
+
+static void
+on_properties_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	if (properties_dialog)
+		return;
+	properties_dialog = create_properties_dialog ();
+	gtk_widget_show (properties_dialog);
+}
+
+static void
+on_minimum_board_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	board_width = board_height = BOARD_MIN;
+	gtk_window_resize ((GtkWindow *)window, board_width, board_height); 
+	refresh_board ();
+}
+
+static void
+on_help_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+	gnome_help_display ("gataxx.xml", NULL, NULL);
+}
+
+static void
+on_about_activate (GtkMenuItem *menuitem, gpointer user_data)
 {
   const gchar *authors[] = {"Chris Rogers", "Sjoerd Langkemper", 
 			    N_("Based on code from Iagno by Ian Peters"), NULL};
@@ -404,157 +838,461 @@
 			 NULL);
 }
 
+static gboolean
+check_back (void)
+{
+	if (flip_final_id)
+	{
+		g_source_remove (flip_final_id);
+		flip_final_id = 0;
+	}
+	if (game_in_progress)
+	{
+		game_in_progress = FALSE;
+		if (whose_turn == BLACK)
+			g_timer_stop (b_timer);
+		else
+			g_timer_stop (w_timer);
+	}
+	return TRUE;
+}
 
-/* the properties dialog wants to know the gconf client */
-GConfClient * get_gconf_client() {
-	static GConfClient * gconfclient=NULL;
-	if (gconfclient==NULL) gconfclient=gconf_client_get_default();
-	return gconfclient;
-}
-
-static gboolean save_state_cb (GnomeClient * client, gint phase, 
-			       GnomeSaveStyle style, gboolean shutdown,
-			       GnomeInteractStyle interactive, gboolean fast,
-			       gpointer data)
-{
-  gchar * argv[3];
-  gchar * state, * statestr;
-  int i, j;
-
-  argv[0] = "gataxx";  
-
-  state = statestr = g_malloc0 (BWIDTH * BHEIGHT + 1);
-  
-  for (j=0; j<BHEIGHT; j++) {
-    for (i=0; i<BWIDTH; i++) {
-      switch (gtk_gridboard_get_piece (gridboard, i, j)) {
-        case WHITE:
-  	  *state = '1';
-	  break;
-        case BLACK:
-	  *state = '2';
-	  break;
-        default:
-	  *state = '0';
-      }
-      state++;
-    }
-  }
-
-  argv[1] = g_strconcat ("--state=", statestr, NULL);
-
-
-  if (turn == WHITE)
-	argv[2] = "--turn=1";
-  else
-	argv[2] = "--turn=2";
-
-  gnome_client_set_restart_command (client, 3, argv);
-  
-  g_free (statestr);
-  g_free (argv[1]);
-
-  return TRUE;
-}
-
-static void initgnomeclient(int argc, char ** argv) {
-	GnomeClient * client;
-        GOptionContext * option_context;
-
-        option_context = g_option_context_new ("");
-        g_option_context_add_main_entries (option_context,
-                                           options, GETTEXT_PACKAGE);
-	program = gnome_program_init("gataxx", VERSION,
-				     LIBGNOMEUI_MODULE,
-				     argc, argv,
-                        	     GNOME_PARAM_GOPTION_CONTEXT, option_context,
-				     GNOME_PARAM_APP_DATADIR, DATADIR, NULL);
-	gtk_window_set_default_icon_name ("gnome-ataxx");
-	client=gnome_master_client();
+void
+on_head_button_clicked (GtkToolButton *toolbutton, gpointer user_data)
+{
+	if (!check_back ())
+		return;
 
-	g_signal_connect (G_OBJECT (client), "save_yourself",
-                    G_CALLBACK (save_state_cb), argv[0]);
-	g_signal_connect (G_OBJECT (client), "die",
-                    G_CALLBACK (quit_game_cb), argv[0]);
+	init ();
+	copy_board ();
+	redraw_board ();
+	check_game_over ();
 }
 
-static gint resize_cb (GtkWindow *window, GdkEventConfigure *e, gpointer data)
+static void
+on_back_button_clicked (GtkToolButton *toolbutton, gpointer user_data)
 {
-  GConfClient *client;
+	if (move_count < 1)
+		return;
+	if (!check_back ())
+		return;	
 
-  client = gconf_client_get_default ();
+	back ();
+	copy_board ();
+	gui_status ();
+	flip_tiles = TRUE;
+	play_sound = TRUE;
+	check_game_over ();
+}
 
-  gconf_client_set_int (client, GCONF_WINDOW_WIDTH, e->width, NULL);
-  gconf_client_set_int (client, GCONF_WINDOW_HEIGHT, e->height, NULL);
+static void
+on_forward_button_clicked (GtkToolButton *toolbutton, gpointer user_data)
+{
+	game_in_progress = FALSE;
 
-  g_object_unref (client);
+	if (!kifu[move_count][0])
+	{
+		if (!check_game_over ())
+		{
+			game_in_progress = TRUE;
+			check_computer_players ();
+		}
+		return;
+	}
 
-  return FALSE;
+	whose_turn = kifu[move_count][0];
+	move_board (kifu[move_count][1] % 7, kifu[move_count][1] / 7,
+			kifu[move_count][2] % 7, kifu[move_count][2] / 7);
+	copy_board ();
+	gui_status ();
+	flip_tiles = TRUE;
+	play_sound = TRUE;
+	check_game_over ();
 }
 
-static void create_window() {
-	GtkWidget *aspectbox;
-	gint width, height;
-	GConfClient *client;
-	gchar *theme;
+static void
+on_last_button_clicked (GtkToolButton *toolbutton, gpointer user_data)
+{
+	game_in_progress = FALSE;
 
-	client = gconf_client_get_default ();
+	while (kifu[move_count][0])
+	{
+		whose_turn = kifu[move_count][0];
+		move_board (kifu[move_count][1] % 7, kifu[move_count][1] / 7,
+				kifu[move_count][2] % 7, kifu[move_count][2] / 7);
+	}
+	copy_board ();
+	redraw_board ();
+	if (!check_game_over ())
+	{
+		game_in_progress = TRUE;
+		check_computer_players ();
+	}
+}
 
-	width = gconf_client_get_int (client, GCONF_WINDOW_WIDTH, NULL);
-	height = gconf_client_get_int (client, GCONF_WINDOW_HEIGHT, NULL);
+static gboolean
+check_event_move (gint ox, gint oy, gint nx, gint ny)
+{
+	if (whose_turn == WHITE && white_computer_level)
+		return FALSE;
+	if (whose_turn == BLACK && black_computer_level)
+		return FALSE;
+	return move (whose_turn, ox, oy, nx, ny);
+}
 
-	g_object_unref (client);
+static gboolean
+on_drawing_area_button_press_event (GtkWidget *widget,
+				    GdkEventButton *event, gpointer user_data)
+{
+	guint x, y;
+ 	
+	if (event->button != 1)
+		return FALSE;
+
+	x = event->x / (tile_width + GRIDWIDTH);
+	y = event->y / (tile_height + GRIDWIDTH);
+	if (board[y][x] == whose_turn)
+	{
+		old_x = x;
+		old_y = y;
+		return FALSE;
+	}
+	return check_event_move (old_x, old_y, x, y);
+}
 
-	if (width <= 0)
-	  width = 400;
-	if (height <= 0)
-	  height = 450;
+static gboolean
+on_entry_key_press_event (GtkWidget *widget,
+					GdkEventKey *event, gpointer user_data)
+{
+	gchar *ch;
+	gint ox, oy, nx, ny;
 
-	window=gnome_app_new("gataxx", "Ataxx");
-	g_signal_connect (G_OBJECT (window), "delete_event",
-		G_CALLBACK (quit_game_cb), NULL);
-	gtk_window_set_default_size (GTK_WINDOW (window), width, height);
-	g_signal_connect (G_OBJECT (window), "configure_event",
-			  G_CALLBACK (resize_cb), NULL);
+	ch = gtk_entry_get_text (GTK_ENTRY (entry));
+	ox = (gint) ((*ch++ & 0xdf) - 0x41);
+	if (!*ch)
+		return FALSE;
+	oy = (gint) (*ch++ - 0x31);
+	if (!*ch)
+		return FALSE;
+	if (*ch == 0x2D)
+		ch++;
+	nx = (gint) ((*ch++ & 0xdf) - 0x41);
+	if (!*ch)
+		return FALSE;
+	ny = (gint) (*ch - 0x31);
+	
+	return check_event_move (ox, oy, nx, ny);
+}
 
-	gnome_app_create_menus(GNOME_APP(window), mainmenu);
-	menu_undo_set_sensitive(FALSE);
+static gboolean
+on_drawing_area_expose_event (GtkWidget *widget,
+					GdkEventExpose *event, gpointer user_data)
+{
+	gdk_draw_drawable (drawing_area->window, gridGC[0], buffer_pixmap,
+			   event->area.x, event->area.y,
+			   event->area.x, event->area.y,
+			   event->area.width, event->area.height);
+	return FALSE;
+}
 
-	gnome_app_set_statusbar(GNOME_APP(window), appbar_new());
-	gnome_app_install_menu_hints(GNOME_APP(window), mainmenu); 
+static gboolean
+on_drawing_area_configure_event (GtkWidget *widget,
+					GdkEventConfigure *event, gpointer user_data)
+{
+	board_width = (event->width * 99) / 100;
+	board_height = (event->height * 99) / 100;
 
-	props_init(GTK_WINDOW(window), "gataxx");
-	theme = props_get_theme();
+	refresh_board ();
+	return FALSE;
+}
+
+const char manager_definition[] =
+	"<ui>"
+	"  <menubar name='MenuBar'>"
+	"    <menu name='FileMenu'			action='file_menu'>"
+	"      <menuitem name='Open'			action='open'/>"
+	"      <menuitem name='Save'			action='save'/>"
+	"      <separator/>"
+	"      <menuitem name='Quit_Game'		action='quit_game'/>"
+	"    </menu>"
+	"    <menu name='GameMenu'			action='game_menu'>"
+	"      <menuitem name='New_Game'		action='new_game'/>"
+	"      <separator/>"
+	"      <menuitem name='Redo'			action='redo_game'/>"
+	"      <menuitem name='Hint'			action='show_hint'/>"
+	"      <separator/>"
+	"      <menuitem name='Sync'			action='sync'/>"
+	"      <menuitem name='Again'			action='again'/>"
+	"    </menu>"
+	"    <menu name='SettingsMenu'		action='settings_menu'>"
+	"      <menuitem name='Preferences'		action='preferences'/>"
+	"      <menuitem name='Minimum Board'   action='minimum_board'/>"
+	"    </menu>"
+	"    <menu name='HelpMenu'			action='help_menu'>"
+	"      <menuitem name='Contents'		action='help'/>"
+	"      <menuitem name='About'			action='about'/>"
+	"    </menu>"
+	"  </menubar>"
+	"  <toolbar  name='ToolBar'>"
+	"      <toolitem name='Head'		action='head'/>"
+	"      <toolitem name='Back'		action='back'/>"
+	"      <toolitem name='Forward'		action='forward'/>"
+	"      <toolitem name='Last'		action='last'/>"
+	"      <toolitem name='Hint'		action='hint'/>"
+	"      <toolitem name='Redo'		action='redo'/>"
+	"      <toolitem name='New'			action='new'/>"
+	"      <toolitem name='Quit'		action='quit'/>"
+	"  </toolbar>"
+	"</ui>";
+
+const GtkActionEntry entries[] = {
+	{"file_menu", NULL, N_("_File")},
+	{"open", GTK_STOCK_OPEN, NULL, NULL, NULL,
+		G_CALLBACK (on_open_activate)},
+	{"save", GTK_STOCK_SAVE, NULL, NULL, NULL,
+		G_CALLBACK (on_save_activate)},
+	{"quit_game", GTK_STOCK_QUIT, NULL, NULL, NULL,
+		G_CALLBACK (on_quit_activate)},
+	{"game_menu", NULL, N_("_Game")},
+	{"new_game", GAMES_STOCK_NEW_GAME, NULL, NULL, NULL,
+		G_CALLBACK (on_new_game_activate)},
+	{"redo_game", GTK_STOCK_REDO, NULL, NULL, NULL,
+		G_CALLBACK (on_redo_activate)},
+	{"show_hint", GAMES_STOCK_HINT, NULL, NULL, NULL,
+		G_CALLBACK (on_hint_activate)},
+	{"sync", NULL, N_("_Sync"), NULL, NULL,
+		G_CALLBACK (on_sync_activate)},
+	{"again", NULL, N_("Play _Again"), NULL, NULL,
+		G_CALLBACK (on_again_activate)},
+	{"settings_menu", NULL, N_("_Settings")},
+	{"preferences", GTK_STOCK_PREFERENCES, NULL, NULL, NULL,
+		G_CALLBACK (on_properties_activate)},
+	{"minimum_board", GTK_STOCK_ZOOM_OUT, NULL, NULL, NULL,
+		G_CALLBACK (on_minimum_board_activate)},
+	{"help_menu", NULL, N_("_Help")},
+	{"help", GAMES_STOCK_CONTENTS, NULL, NULL, NULL,
+		G_CALLBACK (on_help_activate)},
+	{"about", GTK_STOCK_ABOUT, NULL, NULL, NULL,
+		G_CALLBACK (on_about_activate)},
+	{"head", GTK_STOCK_GOTO_FIRST, NULL, "<Ctl><Shift>f" , NULL,
+		G_CALLBACK (on_head_button_clicked)},
+	{"back", GTK_STOCK_GO_BACK, NULL, "<Ctl>b", NULL,
+		G_CALLBACK (on_back_button_clicked)},
+	{"forward", GTK_STOCK_GO_FORWARD, NULL, "<Ctl>f", NULL,
+		G_CALLBACK (on_forward_button_clicked)},
+	{"last", GTK_STOCK_GOTO_LAST, NULL,"<Ctl>l" , NULL,
+		G_CALLBACK (on_last_button_clicked)},
+	{"hint", GAMES_STOCK_HINT, NULL, "<Ctl>h", NULL,
+		G_CALLBACK (on_hint_activate)},
+	{"redo", GTK_STOCK_REDO, NULL,"<Ctl>r" , NULL,
+		G_CALLBACK (on_redo_activate)},
+	{"new", GAMES_STOCK_NEW_GAME, NULL, NULL, NULL,
+		G_CALLBACK (on_new_game_activate)},
+	{"quit", GTK_STOCK_QUIT, NULL, NULL, NULL,
+		G_CALLBACK (on_quit_activate)},
+};
+
+static void
+set_actions (void)
+{
+	open_action        = gtk_action_group_get_action (action_group, "open");
+	new_game_action    = gtk_action_group_get_action (action_group, "new_game");
+	redo_game_action   = gtk_action_group_get_action (action_group, "redo_game");
+	show_hint_action   = gtk_action_group_get_action (action_group, "show_hint");
+	sync_action        = gtk_action_group_get_action (action_group, "sync");
+	again_action       = gtk_action_group_get_action (action_group, "again");
+	preferences_action = gtk_action_group_get_action (action_group, "preferences");
+}
+
+static GtkWidget *
+create_window (void)
+{	
+	const gchar *strs[] =
+	{
+		N_("Dark:"),
+		N_("Light:"),
+		_("00"),
+		_("00:00")
+	};
+
+	GtkWidget *window;
+	GtkWidget *vbox1;
+	GtkWidget *vbox3;
+	GtkWidget *hbox;
+	GtkWidget *label;
+	GtkAccelGroup *accel_group;
+	
+	gint i,j;
+	gchar name[2] = { 0, 0 };
+	gchar *markup;
+	
+	GError *error = NULL;
+
+	accel_group = gtk_accel_group_new ();
+
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_title (GTK_WINDOW (window), _("gataxx"));
+	g_signal_connect ((gpointer) window, "destroy",
+				G_CALLBACK (on_quit_activate), NULL);
+
+	manager = gtk_ui_manager_new ();
+	gtk_ui_manager_add_ui_from_string (manager, manager_definition, -1, &error);
+	action_group = gtk_action_group_new ("ActionGroup");
+	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), window);
+	gtk_ui_manager_insert_action_group (manager, action_group, 0);
+	gtk_window_add_accel_group (GTK_WINDOW (window), gtk_ui_manager_get_accel_group (manager));
+	set_actions ();
+
+	vbox1 = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (window), vbox1);
+
+	gtk_box_pack_start (GTK_BOX (vbox1), gtk_ui_manager_get_widget (manager, "/MenuBar"), FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox1), gtk_ui_manager_get_widget (manager, "/ToolBar"), FALSE, FALSE, 0);
+	for (i = 0; i < 8; i++)
+	{
+		gtk_tool_item_set_expand (
+			gtk_toolbar_get_nth_item ((GtkToolbar *)gtk_ui_manager_get_widget (
+						manager, "/ToolBar"), i), TRUE);			
+		gtk_tool_item_set_homogeneous (
+			gtk_toolbar_get_nth_item ((GtkToolbar *)gtk_ui_manager_get_widget (
+						manager, "/ToolBar"), i), FALSE);
+	}
+	
+	hbox = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, TRUE, TRUE, 0);
+
+	label = gtk_label_new (_("  "));
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+	gtk_widget_set_size_request (label, 17, 17);
+
+	for (*name = 0x41; *name < 0x48; (*name)++)
+	{
+		label = gtk_label_new (name);
+		gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+		gtk_widget_set_size_request (label, -1, 17);
+		markup = g_markup_printf_escaped (
+			"<span foreground=\"red\">%s</span>", name);
+		gtk_label_set_markup_with_mnemonic ((GtkLabel *)label, markup);
+		g_free (markup);
+	}
+	
+	hbox = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, TRUE, TRUE, 0);
+
+	vbox3 = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 0);
+
+	for (*name = 0x31; *name < 0x38; (*name)++)
+	{
+		label = gtk_label_new (name);
+		gtk_box_pack_start (GTK_BOX (vbox3), label, TRUE, TRUE, 0);
+		gtk_widget_set_size_request (label, 17, -1);
+		markup = g_markup_printf_escaped (
+			"<span foreground=\"red\">%s</span>", name);
+		gtk_label_set_markup_with_mnemonic ((GtkLabel *)label, markup);
+		g_free (markup);
+	}
+
+	drawing_area = gtk_drawing_area_new ();
+    /* We do our own double-buffering. */
+	gtk_widget_set_double_buffered (drawing_area, FALSE);
+	gtk_widget_set_size_request (drawing_area, board_width, board_height);
+	gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
+	gtk_widget_set_events (drawing_area, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect ((gpointer) drawing_area, "button_press_event",
+				G_CALLBACK (on_drawing_area_button_press_event), NULL);
+	g_signal_connect ((gpointer) drawing_area, "expose_event",
+				G_CALLBACK (on_drawing_area_expose_event), NULL);
+	g_signal_connect ((gpointer) drawing_area, "configure_event",
+				G_CALLBACK (on_drawing_area_configure_event), NULL);
+
+	hbox = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
+
+	counter = gtk_label_new (_("00"));
+	gtk_box_pack_start (GTK_BOX (hbox), counter, TRUE, TRUE, 0);
+
+	for (i = 0; i < 2; i++)
+		for (j = 0; j < 2; j++)
+		{
+			label = gtk_label_new (strs[j]);
+			gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+			score[i*2+j] = gtk_label_new (strs[i+2]);
+			gtk_box_pack_start (GTK_BOX (hbox), score[i*2+j], TRUE, TRUE, 0);
+		}
+
+	hbox = gtk_hbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, TRUE, FALSE, 0);
+
+	statusbar = gtk_statusbar_new ();
+	gtk_box_pack_start (GTK_BOX (hbox), statusbar, TRUE, TRUE, 0);
+	gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar), FALSE);
+
+	entry = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
+	gtk_widget_set_events (entry, GDK_KEY_PRESS_MASK);
+	g_signal_connect ((gpointer) entry, "key_press_event",
+			  G_CALLBACK (on_entry_key_press_event), NULL);
+
+	gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
 
-	aspectbox = games_grid_frame_new (BWIDTH, BHEIGHT);
-	gnome_app_set_contents(GNOME_APP(window), aspectbox);
-	gridboard = GTK_GRIDBOARD (gtk_gridboard_new(BWIDTH, BHEIGHT, theme));
-	gtk_container_add (GTK_CONTAINER (aspectbox), GTK_WIDGET (gridboard));
-	g_signal_connect(G_OBJECT (gridboard), "boxclicked",
-			G_CALLBACK(boxclicked_cb), NULL);
 	gtk_widget_show_all (window);
-	apply_changes();
+	gtk_widget_grab_focus (entry);
+	return window;
 }
 
-/* this is where it all starts. After the window is brought up, the user
- * probably starts a new game (new_game_cb()), and clicks some (boxclicked_cb).
- */
-int main(int argc, char ** argv) {
-	gnome_score_init("gataxx");
+static void
+set_sound (void)
+{
+	gchar *tmp;
 
-	settextdomain();
+	tmp = g_build_filename ("iagno", "flip-piece.wav", NULL);
+	flip_sound = gnome_program_locate_file (NULL,
+						GNOME_FILE_DOMAIN_APP_SOUND, tmp, TRUE, NULL);
+	g_free (tmp);
 
-	initgnomeclient(argc, argv);
+	tmp = g_build_filename ("iagno", "gameover.wav", NULL);
+	gameover_sound = gnome_program_locate_file (NULL,
+						GNOME_FILE_DOMAIN_APP_SOUND, tmp, TRUE, NULL);
+	g_free (tmp);
+}
 
-	create_window();
 
-	new_game ();
+int
+main (int argc, char *argv[])
+{	
+	GnomeProgram *program;
 
-	gtk_main();
+	gnome_score_init ("gataxx");
 
-	g_object_unref (program);
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
 
-	return 0;
-}
+	program = gnome_program_init ("gataxx", VERSION, LIBGNOMEUI_MODULE, argc, argv,
+			    GNOME_PARAM_APP_DATADIR, DATADIR, NULL);
+
+	gconf_init (argc, argv, NULL);
+	games_stock_init ();
+	gtk_window_set_default_icon_name ("gnome-ataxx");
 
+	load_properties ();
+	clear_board ();
+	window = create_window ();
+	reset_properties ();
+	apply_changes ();
+
+	set_sound (); 
+	b_timer = g_timer_new ();
+	w_timer = g_timer_new ();
+
+	network_gui_update ();
+
+	gui_message ("Welcome to gataxx!");
+/*	init_new_game (); */ 
+	gtk_main ();
 
+	g_object_unref (program);
+	return 0;
+}
Index: gnome-games/gataxx/gataxx.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gataxx.h,v
retrieving revision 1.11
diff -u -r1.11 gataxx.h
--- gnome-games/gataxx/gataxx.h	31 Dec 2005 10:06:34 -0000	1.11
+++ gnome-games/gataxx/gataxx.h	29 Sep 2006 07:10:03 -0000
@@ -1,6 +1,6 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * gataxx.h -
- * 
+/*
+ * gataxx.h
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -18,48 +18,41 @@
  * For more details see the file COPYING.
  */
 
-#ifndef GATAXX_H
-#define GATAXX_H
+#ifndef _GNOTHELLO_H_
+#define _GNOTHELLO_H_
+
+#define BOARD_SIZE    519
+#define BOARD_MIN     279
+#define BOARD_W_MAX  1214
+#define BOARD_H_MAX   799
+#define GRIDWIDTH       1
+
+#define PIXMAP_FLIP_DELAY      30
+#define PIXMAP_STAGGER_DELAY    3
+#define COMPUTER_MOVE_DELAY  1000
+
+gint clamp_int (gint input, gint low, gint high);
+
+void set_board_size (void);
+
+void set_bg_color (void);
+
+void load_pixmaps (void);
+
+void refresh_board (void);
+
+void gui_message (gchar *message);
+
+void gui_entry (gchar *message);
+
+void set_flip_pixmaps_id (void);
+
+gboolean check_computer_players (void);
+
+gboolean move (gint who, gint ox, gint oy, gint nx, gint ny);
+
+void init_new_game (void);
 
-#include <glib.h>
-#include <libgnomeui/libgnomeui.h>
-#include <gconf/gconf-client.h>
-#include <gtkgridboard.h>
-
-#define BHEIGHT 7		/* board height */
-#define BWIDTH 7		/* board width  */
-#define DEF_TIMEOUT 1000 	/* computer timeout default */
-
-typedef struct {
-	int x;
-	int y;
-	int valid;
-} position;
-
-typedef struct {
-	position from;
-	position to;
-} move;
-
-void new_game_cb(GtkWidget * widget, gpointer data);
-void undo_move_cb(GtkWidget * widget, gpointer data);
-gboolean quit_game_cb(GtkWidget * widget, gpointer data);
-void properties_cb(GtkWidget * widget, gpointer data);
-void about_cb(GtkWidget * widget, gpointer data);
-void boxclicked_cb(GtkWidget * widget, int x, int y);
-GnomeUIInfo * get_mainmenu(void);
-GConfClient * get_gconf_client(void);
-gboolean computer_move_cb(gpointer turn);
-void do_move(move m);
-void do_select(int x, int y);
-void gridboard_move(GtkGridBoard * gridboard, move m);
-void turn_pieces(GtkGridBoard * gridboard, int x, int y);
-void apply_changes(void);
-GConfClient * get_gconf_client(void);
-void menu_undo_set_sensitive(gboolean sens);
-gboolean move_possible(GtkGridBoard * gridboard, int turn);
-gboolean move_possible_to(GtkGridBoard * gridboard, int x, int y, int turn);
-gboolean end_game_cb(gpointer data);
-void flip_final(GtkGridBoard * gridboard, int wc, int bc);
+void on_head_button_clicked (GtkToolButton *toolbutton, gpointer user_data);
 
-#endif /* GATAXX_H */
+#endif
Index: gnome-games/gataxx/gtkgridboard.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gtkgridboard.c,v
retrieving revision 1.24
diff -u -r1.24 gtkgridboard.c
--- gnome-games/gataxx/gtkgridboard.c	17 Jul 2006 06:32:15 -0000	1.24
+++ gnome-games/gataxx/gtkgridboard.c	29 Sep 2006 07:10:03 -0000
@@ -1,677 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <glib-object.h>
-#include <cairo.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include "gtkgridboard.h"
-
-#undef DO_PROFILE
-
-#ifdef DO_PROFILE
-#include <sys/time.h>
-
-/* A temporary profiling counter. Only supports one instance.*/
-long int counter;
-#endif
-
-static GtkWidgetClass *parent_class=NULL;
-static guint gridboard_signals[LAST_SIGNAL] = { 0 };
-
-/* prototypes for private functions */
-static void gtk_gridboard_repaint(GtkGridBoard * gridboard);
-static gint ** make_array(int width, int height, int fill); 
-static gint get_pixmap_num(int piece);
-static gint gtk_gridboard_button_press(GtkWidget *widget, 
-				       GdkEventButton *event) ;
-static gboolean gtk_gridboard_expose(GtkWidget * widget, 
-				     GdkEventExpose * event);
-static void gtk_gridboard_size_allocate(GtkWidget * widget, 
-					GtkAllocation * allocation);
-static void gtk_gridboard_class_init(GtkGridBoardClass * class);
-static void gtk_gridboard_finalize(GObject * object);
-static void gtk_gridboard_init(GtkGridBoard * gridboard);
-static void gtk_gridboard_realize(GtkWidget * widget);
-static void gtk_gridboard_size_request(GtkWidget * widget, GtkRequisition * req);
-static gint gtk_gridboard_flip_pixmaps(gpointer data);
-
-/* init functions */
-
-/* init structures and create signals */
-static void gtk_gridboard_class_init(GtkGridBoardClass * class) {
-        GObjectClass *object_class;
-        GtkWidgetClass *widget_class;
-
-        object_class = (GObjectClass*) class;
-        widget_class = (GtkWidgetClass*) class;
-
-        parent_class = gtk_type_class (gtk_widget_get_type ());
-
-        object_class->finalize = gtk_gridboard_finalize;
-        widget_class->realize = gtk_gridboard_realize;
-        widget_class->expose_event = gtk_gridboard_expose;
-	widget_class->size_allocate = gtk_gridboard_size_allocate;
-	widget_class->size_request = gtk_gridboard_size_request;
-        widget_class->button_press_event = gtk_gridboard_button_press;
-        
-        gridboard_signals[BOXCLICKED] = g_signal_new ("boxclicked",
-                  G_TYPE_FROM_CLASS (class),
-                  G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-                  G_STRUCT_OFFSET (GtkGridBoardClass, boxclicked),
-                  NULL, NULL,
-                  g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
-                  G_TYPE_INT, G_TYPE_INT);
-}
-
-static void gtk_gridboard_init(GtkGridBoard * gridboard) {
-        gridboard->backing_store = NULL;
-	gridboard->tiles_pixbuf = NULL;
-	gridboard->tiles_scale = 1;
-        gridboard->pixmaps=NULL;
-	gridboard->timeoutid = 0;
-        gridboard->tileheight=TILEHEIGHT;
-        gridboard->tilewidth=TILEWIDTH;
-        gridboard->width=0;
-        gridboard->height=0;
-	gridboard->statelist=NULL;
-	gridboard->theme = gtk_gridboard_themes;
-	/* We do our own double-buffering. */
-	gtk_widget_set_double_buffered(GTK_WIDGET (gridboard), FALSE);
-}
-
-GtkWidget * gtk_gridboard_new(gint width, gint height, char * theme) {
-        GtkGridBoard * gridboard=g_object_new(gtk_gridboard_get_type(), NULL);
-
-        gridboard->width=width;
-        gridboard->height=height;
-
-        gridboard->board    = make_array (width, height, 0);
-        gridboard->pixmaps  = make_array (width, height, 0);
-        gridboard->selected = make_array (width, height, SELECTED_NONE);
-	gridboard->changed  = make_array (width, height, TRUE);
-	
-        gtk_gridboard_set_animate(gridboard, TRUE);
-        gtk_gridboard_set_visibility(gridboard, TRUE);
-
-	gtk_gridboard_set_theme (gridboard, theme);
-        
-        return GTK_WIDGET(gridboard);
-        
-}
-
-/* class functions */ 
-
-GtkType gtk_gridboard_get_type() {
-        static GtkType gridboard_type=0;
-
-        if (!gridboard_type) {
-                static GTypeInfo gridboard_info={
-                        sizeof(GtkGridBoardClass),
-                        NULL,
-                        NULL,
-                        (GClassInitFunc) gtk_gridboard_class_init,
-                        NULL,
-                        NULL,
-                        sizeof(GtkGridBoard),
-                        0,
-                        (GInstanceInitFunc) gtk_gridboard_init,
-                };
-                gridboard_type=g_type_register_static (GTK_TYPE_WIDGET,
-                                         "GridBoard",
-                                         &gridboard_info,
-                                         0);
-        }
-        return gridboard_type;
-}
-
-/* event handlers */
-
-static gint gtk_gridboard_button_press(GtkWidget *widget,
-				       GdkEventButton *event)
- {
-   GtkGridBoard *gridboard;
-   int x, y;
-
-   g_return_val_if_fail (GTK_IS_GRIDBOARD(widget), FALSE);
-   
-   gridboard = GTK_GRIDBOARD (widget);
-
-   x = event->x * gridboard->width / widget->allocation.width;
-   y = event->y * gridboard->height / widget->allocation.height;
-
-   x = CLAMP (x, 0, gridboard->width - 1);
-   y = CLAMP (y, 0, gridboard->height - 1);
-
-   g_signal_emit (G_OBJECT(gridboard), gridboard_signals[BOXCLICKED], 
-		  0, x, y);
-
-   return TRUE;
-}
-
-static gboolean gtk_gridboard_expose(GtkWidget *widget,
-				     GdkEventExpose * event)
- {
-        GtkGridBoard *gridboard;
-
-	if (!GTK_WIDGET_DRAWABLE (widget))
-	  return FALSE;
-
-	gridboard = GTK_GRIDBOARD (widget);
-
-	gdk_draw_drawable (widget->window, widget->style->black_gc,
-			   gridboard->backing_store, event->area.x,
-			   event->area.y, event->area.x, event->area.y,
-			   event->area.width, event->area.height);
-
-        return FALSE;
-}
-
-static void gtk_gridboard_size_allocate (GtkWidget * widget,
-					 GtkAllocation *allocation)
-{
-  GtkGridBoard *gridboard = GTK_GRIDBOARD (widget);
-
-  widget->allocation = *allocation;
- 
-  if (gridboard->backing_store != NULL) {
-    g_object_unref (gridboard->backing_store);
-    gridboard->backing_store = NULL;
-  }
-
-  if (GTK_WIDGET_REALIZED (widget)) {
-    gdk_window_move_resize (widget->window, allocation->x, allocation->y,
-			    allocation->width, allocation->height);
-    gtk_gridboard_paint (gridboard);
-  }
-}
-
-static void gtk_gridboard_realize(GtkWidget * widget) 
-{
-        GdkWindowAttr attributes;
-        gint attributes_mask;
-
-        g_return_if_fail (GTK_IS_WIDGET (widget));
-
-        GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-	
-        attributes.x = widget->allocation.x;
-        attributes.y = widget->allocation.y;
-        attributes.width = widget->allocation.width;
-        attributes.height = widget->allocation.height;
-        attributes.wclass = GDK_INPUT_OUTPUT;
-        attributes.window_type = GDK_WINDOW_CHILD;
-        attributes.event_mask = gtk_widget_get_events (widget) | 
-                GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | 
-                GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
-                GDK_POINTER_MOTION_HINT_MASK;
-        attributes.visual = gtk_widget_get_visual (widget);
-        attributes.colormap = gtk_widget_get_colormap (widget);
-
-        attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-        widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
-
-        widget->style = gtk_style_attach (widget->style, widget->window);
-
-        gdk_window_set_user_data (widget->window, widget);
-
-        gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
-	
-	gtk_gridboard_paint (GTK_GRIDBOARD (widget));
-}
-
-static void gtk_gridboard_finalize(GObject * object) {
-        GtkGridBoard *gridboard;
-
-        g_return_if_fail (object != NULL);
-        g_return_if_fail (GTK_IS_GRIDBOARD (object));
-
-        gridboard = GTK_GRIDBOARD(object);
-
-	g_object_unref (gridboard->backing_store);
-        g_free (gridboard->board);
-        g_free (gridboard->pixmaps);
-        g_free (gridboard->selected);
-	g_free (gridboard->changed);
-
-        if (G_OBJECT_CLASS (parent_class)->finalize)
-                (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void gtk_gridboard_size_request(GtkWidget * widget, GtkRequisition * req)
- {
-        GtkGridBoard *gridboard;
-
-	g_return_if_fail (GTK_IS_GRIDBOARD (widget));
-	gridboard = GTK_GRIDBOARD (widget);
-
-        req->width=gridboard->width*gridboard->tilewidth + 1;
-        req->height=gridboard->height*gridboard->tileheight + 1;
-}
-
-/* drawing functions */
-
-static gint get_pixmap_num(int piece) {
-        if (piece==BLACK) return BLACK_PIXMAP;
-        if (piece==WHITE) return WHITE_PIXMAP;
-        return EMPTY_PIXMAP;
-}
-
-void gtk_gridboard_paint (GtkGridBoard *gridboard)
-{
-  GtkWidget *widget;
-
-  g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-  
-  widget = GTK_WIDGET (gridboard);
-  g_return_if_fail (GTK_WIDGET_REALIZED (widget));
-
-  gtk_widget_queue_draw (widget);
-
-  gtk_gridboard_repaint (gridboard);
-}
-
-static void gtk_gridboard_repaint(GtkGridBoard * gridboard) {
-  int x, y;
-  double phase;
-  GtkWidget *widget;
-  gdouble scale;
-  cairo_t *cx;
-  
-#ifdef DO_PROFILE
-  struct timeval tv;
-#endif
-  
-  g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-  if (!gridboard->visibility) return;
-  
-  widget = GTK_WIDGET (gridboard);
-  g_return_if_fail (GTK_WIDGET_REALIZED (widget));
-
-  if (gridboard->backing_store == NULL) {
-    gridboard->backing_store = gdk_pixmap_new (widget->window,
-					       widget->allocation.width,
-					       widget->allocation.height, 
-					       -1);
-    for (x=0; x<gridboard->width; x++)
-      for (y=0; y<gridboard->height; y++)
-	gridboard->changed[x][y] = TRUE;
-  }
-  
-  cx = gdk_cairo_create (gridboard->backing_store);
-  cairo_scale (cx, 1.0*widget->allocation.width/gridboard->width,
-	       1.0*widget->allocation.height/gridboard->height);
-    
-#ifdef DO_PROFILE
-  gettimeofday (&tv, NULL);
-  counter = tv.tv_sec * 1000000 + tv.tv_usec;
-#endif
-    
-  scale = gridboard->tiles_scale;
-  
-  for (x=0; x<gridboard->height; x++) {
-    for (y=0; y<gridboard->width; y++) {
-      if (gridboard->changed[x][y]) {
-	gridboard->theme->draw_bg (cx, x, y);
-	gridboard->theme->draw_grid (cx, x, y);
-	if (gridboard->board[x][y] != EMPTY) {
-	  phase = gridboard->pixmaps[x][y];
-	  phase = (phase - 1.0)/30.0;
-	  gridboard->theme->draw_piece (cx, x, y, phase);
-	} else if (gridboard->selected[x][y] == SELECTED_A) {
-	  gridboard->theme->draw_hilight (cx, x, y);
-	}
-	if (gridboard->selected[x][y] == SELECTED_B) {
-	  gridboard->theme->draw_secondary_hilight (cx, x, y, 
-						    gridboard->board[x][y]);
-	}
-	gridboard->changed[x][y] = FALSE;
-      }
-    }
-  }
-
-  cairo_destroy (cx);
-  
-#ifdef DO_PROFILE
-  gettimeofday (&tv, NULL);
-  g_print ("%ld\n", tv.tv_sec * 1000000 + tv.tv_usec - counter);
-#endif
-}
-
-
-
-void gtk_gridboard_set_selection(GtkGridBoard * gridboard, gint type, 
-				 gint x, gint y) 
-{
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-	g_return_if_fail (x >= 0);
-	g_return_if_fail (y >= 0);
-	g_return_if_fail (x < gridboard->width);
-	g_return_if_fail (y < gridboard->height);
-
-        gridboard->selected[x][y] = type;
-	gridboard->changed[x][y]  = TRUE;
-}
-
-static gint gtk_gridboard_flip_pixmaps(gpointer data) 
-{
-        GtkGridBoard * gridboard=(GtkGridBoard *) data;
-
-        gint x, y;
-        gint curpm; /* current pixmap */
-        gint pcepm; /* this pixmap should be there */
-        gint flipped_tiles;
-
-	if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (gridboard))) {
-	  return FALSE;
-	}
-
-	flipped_tiles=0;
-        for (x=0; x<gridboard->width; x++) {
-                for (y=0; y<gridboard->height; y++) {
-        		/* curpm is the current pixmap being shown.
-			 * pcepm is the target pixmap. We step from
-			 * one to the other during the animation. */
-                        curpm=gridboard->pixmaps[x][y];
-                        pcepm=get_pixmap_num(gridboard->board[x][y]);
-                        if (curpm == pcepm) {
-                                /* Nothing needs to be flipped */
-                                continue;
-                        } else if ((curpm == EMPTY_PIXMAP) ||
-				   (pcepm == EMPTY_PIXMAP)) {
-                                /* Don't animate empty squares */
-                                gridboard->pixmaps[x][y]=pcepm;
-                                flipped_tiles++;
-				gridboard->changed[x][y] = TRUE;
-			} else if (!gridboard->animate) {
-				/* Disabled animations consist of the final frame.*/
-				gridboard->pixmaps[x][y] = pcepm;
-				gridboard->changed[x][y] = TRUE;
-                        } else if (curpm < pcepm) {
-                                gridboard->pixmaps[x][y]++;
-                                flipped_tiles++;
-				gridboard->changed[x][y] = TRUE;
-                        } else { /* curpm > pcepm */
-                                gridboard->pixmaps[x][y]--;
-                                flipped_tiles++;
-				gridboard->changed[x][y] = TRUE;
-                        }
-                }
-        }
-
-	if (flipped_tiles) 
-	  gtk_gridboard_paint (gridboard);
-
-        return TRUE;
-}
-
-/* helper functions */
-
-/* Allocates memory for an array and fills it with the byte fill. */
-static gint ** make_array(int width, int height, int fill) 
-{
-  gint ** result;
-  int valarraysiz, ptrarraysiz;
-  int i;
-  
-  valarraysiz = width*height;       /* size of actual array */
-  ptrarraysiz = width;              /* size of pointer array */
-  result = (gint **) g_malloc (ptrarraysiz*sizeof(gint *)+valarraysiz*sizeof(gint));
-  for (i=0; i<width; i++) {
-    result[i] = (gint *)(result+ptrarraysiz)+i*height;
-    memset (result[i], fill, sizeof (gint)*height);
-  }
-  return result;
-}
-
-int gtk_gridboard_count_pieces(GtkGridBoard * gridboard, int piece) {
-        int x, y;
-        int count=0;
-	
-        g_return_val_if_fail(GTK_IS_GRIDBOARD (gridboard), 0);
-
-        for (x=0; x<gridboard->width; x++) 
-                for (y=0; y<gridboard->height; y++) 
-                        if (gridboard->board[x][y]==piece) count++;
-
-        return count;
-}
-
-/* marshaller VOID:INT,INT */
-void g_cclosure_user_marshal_VOID__INT_INT (GClosure     *closure,
-                                       GValue       *return_value,
-                                       guint         n_param_values,
-                                       const GValue *param_values,
-                                       gpointer      invocation_hint,
-                                       gpointer      marshal_data) {
-        typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1,
-                                                        gint arg_1,
-                                                        gint arg_2,
-                                                        gpointer data2);
-        register GMarshalFunc_VOID__INT_INT callback;
-        register GCClosure *cc = (GCClosure*) closure;
-        register gpointer data1, data2;
-
-        g_return_if_fail (n_param_values == 3);
-
-        if (G_CCLOSURE_SWAP_DATA (closure))
-                {
-                        data1 = closure->data;
-                        data2 = g_value_peek_pointer (param_values + 0);
-                }
-        else
-                {
-                        data1 = g_value_peek_pointer (param_values + 0);
-                        data2 = closure->data;
-                }
-        callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
-
-        callback (data1,
-                g_marshal_value_peek_int (param_values + 1),
-                g_marshal_value_peek_int (param_values + 2),
-                data2);
-}
-
-
-/* option setting functions */
-
-void gtk_gridboard_set_animate(GtkGridBoard *gridboard, gboolean animate) {
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-        gridboard->animate=animate;
-	if (gridboard->timeoutid)
-	  return;
-	gridboard->timeoutid = g_timeout_add(PIXMAP_FLIP_DELAY, 
-					     gtk_gridboard_flip_pixmaps,
-					     (gpointer) gridboard);
-}
-
-void gtk_gridboard_set_visibility(GtkGridBoard *gridboard, gboolean visibility) {
-	g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	gridboard->visibility=visibility;
-}
-
-void gtk_gridboard_set_theme (GtkGridBoard *gridboard, gchar * name)
-{
-        GtkGridBoardTheme *t;
-	gint x, y;
-
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-	g_return_if_fail (name != NULL);
-	g_return_if_fail (name[0] != '\0');
-
-	t = gtk_gridboard_themes;
-	while (t->name != NULL) {
-	  if (g_utf8_collate (t->name, name) == 0) {
-	    gridboard->theme = t;
-	    break;
-	  }
-	  t++;
-	}
-
-	for (x=0; x<gridboard->width; x++)
-	  for (y=0; y<gridboard->height; y++)
-	    gridboard->changed[x][y] = TRUE;
-}
-        
-/* board altering functions */
-void gtk_gridboard_set_piece(GtkGridBoard *gridboard, int x, int y, 
-			     int piece) 
-{
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	if (gridboard->board[x][y] == piece)
-	  return;
-
-        gridboard->board[x][y]=piece;
-	
-}
-
-int gtk_gridboard_get_piece(GtkGridBoard *gridboard, int x, int y) 
-{
-        g_return_val_if_fail (GTK_IS_GRIDBOARD (gridboard), 0);
-
-        return gridboard->board[x][y];
-}
-
-void gtk_gridboard_clear_selections(GtkGridBoard *gridboard) 
-{
-	int x, y;
-
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	for (x=0; x<gridboard->width; x++) {
-		for (y=0; y<gridboard->height; y++) {
-		  if (gridboard->selected[x][y] != SELECTED_NONE) {
-		    gridboard->selected[x][y] = SELECTED_NONE;
-		    gridboard->changed[x][y] = TRUE;
-		  }
-		}
-	}
-}
-
-void gtk_gridboard_clear_pieces(GtkGridBoard *gridboard) 
-{
-	int x, y;
-
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	for (x=0; x<gridboard->width; x++) {
-		for (y=0; y<gridboard->height; y++) {
-			gridboard->board[x][y] = EMPTY;
-			gridboard->changed[x][y] = TRUE;
-		}
-	}
-}
-
-void gtk_gridboard_clear(GtkGridBoard *gridboard) 
-{
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	gtk_gridboard_clear_selections(gridboard);
-	gtk_gridboard_clear_pieces(gridboard);
-	gtk_gridboard_clear_states(gridboard);
-}
-
-int gtk_gridboard_states_present(GtkGridBoard *gridboard) 
-{
-        g_return_val_if_fail (GTK_IS_GRIDBOARD (gridboard), FALSE);
-
-	return (gridboard->statelist)!=NULL;
-}
-
-/* saves the current board on a stack */
-void gtk_gridboard_save_state(GtkGridBoard *gridboard, gpointer data) 
-{
-	StateList * newstate;
-	int x, y;
-
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	newstate = g_malloc(sizeof(StateList));
-
-	newstate->board = make_array (gridboard->width, gridboard->height, 0);
-	for (x=0; x<gridboard->width; x++) {
-		for (y=0; y<gridboard->height; y++) {
-			newstate->board[x][y]=gridboard->board[x][y];
-		}
-	}
-
-	newstate->prev=gridboard->statelist;
-	newstate->data=data;
-	gridboard->statelist=newstate;	
-}
-
-/* reverts to the last state on the stack and deletes it */
-gpointer gtk_gridboard_revert_state(GtkGridBoard *gridboard) 
-{
-	StateList * thisstate, * prevstate;
-	gpointer data;
-	int x, y;
-
-        g_return_val_if_fail (GTK_IS_GRIDBOARD (gridboard), NULL);
-
-	thisstate=gridboard->statelist;
-	if (thisstate==NULL) return NULL;
-	
-	prevstate=gridboard->statelist->prev;
-
-	gtk_gridboard_clear_selections (gridboard);
-	for (x=0; x<gridboard->width; x++) {
-	  for (y=0; y<gridboard->width; y++) {
-	    if (gridboard->board[x][y] != thisstate->board[x][y]) {
-	      gridboard->board[x][y] = thisstate->board[x][y];
-	      gridboard->changed[x][y] = TRUE;
-	    }
-	  }
-	}
-	
-	data=thisstate->data;
-	gridboard->statelist=prevstate;
-	g_free(thisstate->board);
-	g_free(thisstate);
-	return data;
-}
-
-void gtk_gridboard_clear_states(GtkGridBoard *gridboard) 
-{
-	StateList * curstate;
-	StateList * prevstate;
-
-        g_return_if_fail (GTK_IS_GRIDBOARD (gridboard));
-
-	curstate=gridboard->statelist;
-
-	while (curstate!=NULL) {
-		g_free(curstate->board);
-		prevstate=curstate->prev;
-		g_free(curstate);
-		curstate=prevstate;
-	}
-	gridboard->statelist=NULL;
-}
-		
-int gtk_gridboard_get_height(GtkGridBoard *gridboard) 
-{
-        g_return_val_if_fail (GTK_IS_GRIDBOARD (gridboard), 0);
-
-	return gridboard->height;
-}
-		
-int gtk_gridboard_get_width(GtkGridBoard *gridboard) 
-{
-        g_return_val_if_fail (GTK_IS_GRIDBOARD (gridboard), 0);
-
-	return gridboard->width;
-}
Index: gnome-games/gataxx/gtkgridboard.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gtkgridboard.h,v
retrieving revision 1.10
diff -u -r1.10 gtkgridboard.h
--- gnome-games/gataxx/gtkgridboard.h	15 Feb 2006 06:59:03 -0000	1.10
+++ gnome-games/gataxx/gtkgridboard.h	29 Sep 2006 07:10:03 -0000
@@ -1,118 +0,0 @@
-/* FIXME add some comments
- here
- */
-
-#ifndef __GTKGRIDBOARD_H__
-#define __GTKGRIDBOARD_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkwidget.h>
-#include <cairo.h>
-
-#include "gtkgridboardthemes.h"
-
-G_BEGIN_DECLS
-
-/* macro's */
-
-#define GTK_GRIDBOARD(obj) GTK_CHECK_CAST (obj, gtk_gridboard_get_type (), GtkGridBoard)
-#define GTK_GRIDBOARD_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_gridboard_get_type (), GtkGridBoardClass)
-#define GTK_IS_GRIDBOARD(obj) GTK_CHECK_TYPE (obj, gtk_gridboard_get_type ())
-
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-
-/* definitions */
-#define EMPTY 0
-#define WHITE 1
-#define BLACK 2
-
-#define EMPTY_PIXMAP 0
-#define BLACK_PIXMAP 1
-#define WHITE_PIXMAP 31
-
-#define TILEWIDTH 60
-#define TILEHEIGHT 60
-
-#define SELECTED_NONE 0
-#define SELECTED_A 1
-#define SELECTED_B 2
-
-#define PIXMAP_FLIP_DELAY 40
-
-enum {
-        BOXCLICKED,
-        LAST_SIGNAL
-};
-
-/* structs */
-typedef struct _GtkGridBoard            GtkGridBoard;
-typedef struct _GtkGridBoardClass       GtkGridBoardClass;
-typedef struct _StateList		StateList;
-
-struct _StateList {
-	gint ** board;
-	struct _StateList * prev;
-	gpointer data;
-};
-
-struct _GtkGridBoard {
-        GtkWidget widget;       /* parent class */
-        GdkPixmap *backing_store;
-        gint ** pixmaps;
-        gint ** board;
-        gint ** selected;
-        gboolean ** changed;
-        gint width;
-        gint height;
-        gint tilewidth;
-        gint tileheight;
-        guint timeoutid;
-        GdkPixbuf *tiles_pixbuf;
-        gint tiles_scale;
-        gboolean visibility;
-        gboolean animate;
-        gboolean showgrid;
-	StateList * statelist;
-        GtkGridBoardTheme *theme;
-};
-	
-struct _GtkGridBoardClass {
-        GtkWidgetClass parent_class;
-        void (* boxclicked) (GtkGridBoard * gridboard, int x, int y);
-};
-
-/* prototypes */
-GType gtk_gridboard_get_type(void);
-GtkWidget *gtk_gridboard_new(gint width, gint height, char * tileset);
-void g_cclosure_user_marshal_VOID__INT_INT (GClosure     *closure,
-                                       GValue       *return_value,
-                                       guint         n_param_values,
-                                       const GValue *param_values,
-                                       gpointer      invocation_hint,
-                                       gpointer      marshal_data); 
-
-void gtk_gridboard_set_animate(GtkGridBoard * gridboard, gboolean animate); 
-void gtk_gridboard_set_visibility(GtkGridBoard *gridboard, gboolean visibility);
-void gtk_gridboard_set_piece(GtkGridBoard * gridboard, int x, int y, int piece);
-void gtk_gridboard_set_selection (GtkGridBoard *widget, gint type, 
-				  gint x, gint y);
-int gtk_gridboard_count_pieces(GtkGridBoard * gridboard, int piece);
-int gtk_gridboard_get_piece(GtkGridBoard * gridboard, int x, int y);
-void gtk_gridboard_clear_selections(GtkGridBoard * widget);
-void gtk_gridboard_clear_pieces(GtkGridBoard * widget);
-void gtk_gridboard_clear(GtkGridBoard * widget);
-void gtk_gridboard_save_state(GtkGridBoard * widget, gpointer data);
-gpointer gtk_gridboard_revert_state(GtkGridBoard * widget);
-void gtk_gridboard_clear_states(GtkGridBoard * widget);
-int gtk_gridboard_get_height(GtkGridBoard * widget);
-int gtk_gridboard_get_width(GtkGridBoard * widget);
-void gtk_gridboard_paint(GtkGridBoard * gridboard); 
-int gtk_gridboard_states_present(GtkGridBoard * widget);
-void gtk_gridboard_set_theme (GtkGridBoard *gridboard, gchar * name);
-
-G_END_DECLS
-
-#endif /* __GTKGRIDBOARD_H__ */
-
-
Index: gnome-games/gataxx/gtkgridboardthemes.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gtkgridboardthemes.c,v
retrieving revision 1.3
diff -u -r1.3 gtkgridboardthemes.c
--- gnome-games/gataxx/gtkgridboardthemes.c	15 Mar 2006 04:55:29 -0000	1.3
+++ gnome-games/gataxx/gtkgridboardthemes.c	29 Sep 2006 07:10:03 -0000
@@ -1,205 +0,0 @@
-/* gtk-gridboard-themes.c : Themes for gtk-gridboard.
- *
- * Copyright (C) 2005 by Callum McKenzie
- *
- * Time-stamp: <2006-03-15 17:53:48 callum>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- *
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <cairo.h>
-
-#include "gtkgridboardthemes.h"
-
-#include <math.h>
-
-/* This file consists of various static routines for drawing sections of the
- * board. They are assembled into the gtk_gridboard_themes structure at the
- * end of this file to create the themes. gtk_gridboard_themes (and the
- * associated function typedefs) should be the only public interface 
- * that this file presents. 
- */
-
-/* ---- The default theme. Several of these are suitable for resuse. --- */
-
-#define COIN_RADIUS 0.4
-
-static void default_draw_bg (cairo_t *cx, gdouble x, gdouble y)
-{
-  cairo_set_source_rgba (cx, 0.43, 0.55, 0.65, 1.0);
-  cairo_rectangle (cx, x, y, 1.0, 1.0);
-  cairo_fill (cx);
-}
-
-static void default_draw_piece (cairo_t *cx, gdouble x, gdouble y, 
-				gdouble phase)
-{
-  x += 0.5;
-  y += 0.5;
-
-  if (phase > 0.5) {
-    cairo_set_source_rgb (cx, 1.0, 1.0, 1.0);
-  } else {
-    cairo_set_source_rgb (cx, 0.0, 0.0, 0.0);
-  }
-
-  /* We special-case the two "pure" ends of the flip to avoid
-   * floating point errors in calculating the phase. */
-  if ((phase > 0.98) || (phase < 0.02)) {
-    cairo_arc (cx, x, y, COIN_RADIUS, 0, 2*G_PI);
-    cairo_fill (cx);
-  } else {
-    cairo_save (cx);
-    cairo_translate (cx, x, y);
-    cairo_scale (cx, cos (phase*G_PI), 1.0);
-    cairo_arc (cx, 0, 0, COIN_RADIUS, 0, 2*G_PI);
-    cairo_fill (cx);
-    cairo_restore (cx);
-  }
-}
-
-static void default_draw_hilight (cairo_t *cx, gdouble x, gdouble y)
-{
-  x += 0.5;
-  y += 0.5;
-
-  cairo_set_source_rgba (cx, 1.0, 1.0, 1.0, 0.3);
-  cairo_arc (cx, x, y, COIN_RADIUS, 0, 2*G_PI);
-  cairo_fill (cx);
-}
-
-static void default_draw_secondary_hilight (cairo_t *cx, gdouble x, gdouble y,
-					    gint piece)
-{
-  x += 0.5;
-  y += 0.5;
-
-  cairo_set_source_rgba (cx, 1.0, 1.0, 1.0, 0.3);
-  cairo_set_line_width (cx, 0.02);
-  cairo_arc (cx, x, y, COIN_RADIUS*1.15, 0, 2*G_PI);
-  cairo_stroke (cx);
-}
-
-static void default_draw_grid (cairo_t *cx, gdouble x, gdouble y)
-{
-  cairo_save (cx);
-
-  cairo_rectangle (cx, x, y, 1.0, 1.0);
-  cairo_clip_preserve (cx);
-  cairo_set_line_width (cx, 0.02);
-  cairo_set_source_rgba (cx, 0.0, 0.0, 0.0, 1.0);
-  cairo_stroke (cx);
-
-  cairo_restore (cx);
-}
-
-/* ---- Squares and Diamonds, a slightly fancier theme ---- */
-
-#define BLOCK_SIZE (0.8)
-#define BLOCK_OFFSET ((1.0 - BLOCK_SIZE)/2.0)
-
-static void sandd_draw_piece (cairo_t *cx, gdouble x, gdouble y, 
-			      gdouble phase)
-{
-  gdouble ofs;
-
-  cairo_save (cx);
-  cairo_translate (cx, x, y);
-
-  cairo_set_source_rgb (cx, phase, phase, phase);
-
-  /* We special-case the two "pure" ends of the flip to avoid
-   * floating point errors in calculating the phase. */
-  if (phase > 0.98) {
-    cairo_move_to (cx, 0.5, BLOCK_OFFSET);
-    cairo_line_to (cx, 1.0 - BLOCK_OFFSET, 0.5);
-    cairo_line_to (cx, 0.5, 1.0 - BLOCK_OFFSET);
-    cairo_line_to (cx, BLOCK_OFFSET, 0.5);
-    cairo_close_path (cx);
-  } else if (phase < 0.02) {
-    cairo_move_to (cx, BLOCK_OFFSET, BLOCK_OFFSET);
-    cairo_rel_line_to (cx, BLOCK_SIZE, 0.0);
-    cairo_rel_line_to (cx, 0.0, BLOCK_SIZE);
-    cairo_rel_line_to (cx, -BLOCK_SIZE, 0.0);
-    cairo_close_path (cx);
-  } else {
-    cairo_translate (cx, 0.5, 0.5);
-    ofs = BLOCK_SIZE*(2.0 - phase)*0.25;
-
-    cairo_move_to (cx, 0.0, -BLOCK_SIZE/2.0);
-    cairo_line_to (cx, ofs, -ofs);
-    cairo_line_to (cx, BLOCK_SIZE/2.0, 0.0);
-    cairo_line_to (cx, ofs, ofs);
-    cairo_line_to (cx, 0.0, BLOCK_SIZE/2.0);
-    cairo_line_to (cx, -ofs, ofs);
-    cairo_line_to (cx, -BLOCK_SIZE/2.0, 0.0);
-    cairo_line_to (cx, -ofs, -ofs);
-    cairo_close_path (cx);
-  }
-
-  cairo_set_line_width (cx, 0.02);
-  cairo_fill_preserve (cx);
-  cairo_set_source_rgb (cx, 0.0, 0.0, 0.0);
-  cairo_stroke (cx);
-
-  cairo_restore (cx);
-}
-
-static void sandd_draw_hilight (cairo_t *cx, gdouble x, gdouble y)
-{
-  x += 0.5;
-  y += 0.5;
-
-  cairo_set_source_rgba (cx, 1.0, 1.0, 1.0, 1.0);
-  cairo_arc (cx, x, y, 0.1, 0, 2*G_PI);
-  cairo_fill (cx);
-}
-
-static void sandd_draw_secondary_hilight (cairo_t *cx, gdouble x, gdouble y,
-					  gint piece)
-{
-  gdouble holesize;
-
-  x += 0.5;
-  y += 0.5;
-
-  holesize = 0.05;
-  /* Slightly increase the hole size for squares to allow for the lack of
-   * a visible border around the hole. */
-  if (piece != 1) 
-    holesize = 0.06;
-
-  cairo_set_line_width (cx, 0.02);
-  cairo_arc (cx, x, y, holesize, 0, 2*G_PI);
-  cairo_set_source_rgb (cx,  0.43, 0.55, 0.65);
-  cairo_fill_preserve (cx);
-  cairo_set_source_rgb (cx, 0.0, 0.0, 0.0);
-  cairo_stroke (cx);
-}
-
-/* This should be the only public interface. */
-
-GtkGridBoardTheme gtk_gridboard_themes[] = {
-  { N_("Plain"), default_draw_bg, default_draw_piece, 
-    default_draw_hilight, default_draw_secondary_hilight, default_draw_grid },
-  { N_("Squares and Diamonds"), default_draw_bg, sandd_draw_piece, 
-    sandd_draw_hilight, sandd_draw_secondary_hilight, default_draw_grid },
-  { NULL, NULL, NULL, NULL, NULL }
-};
Index: gnome-games/gataxx/gtkgridboardthemes.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/gtkgridboardthemes.h,v
retrieving revision 1.3
diff -u -r1.3 gtkgridboardthemes.h
--- gnome-games/gataxx/gtkgridboardthemes.h	15 Mar 2006 04:55:29 -0000	1.3
+++ gnome-games/gataxx/gtkgridboardthemes.h	29 Sep 2006 07:10:03 -0000
@@ -1,49 +0,0 @@
-/* gtk-gridboard-themes.h :
- *
- * Copyright (C) 2005 by Callum McKenzie
- *
- * Time-stamp: <2006-03-15 17:46:43 callum>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- *
- */
-
-
-#ifndef GTK_GRIDBOARD_THEMES_H
-#define GTK_GRIDBOARD_THEMES_H
-
-#include <gtk/gtk.h>
-#include <cairo.h>
-
-typedef void GtkGridboardThemeBGFunc (cairo_t *, gdouble, gdouble);
-typedef void GtkGridboardThemePieceFunc (cairo_t *, gdouble, gdouble, gdouble);
-typedef void GtkGridboardThemeHiliteFunc (cairo_t *, gdouble, gdouble);
-typedef void GtkGridboardThemeSecondaryHiliteFunc (cairo_t *, gdouble, gdouble, gint);
-typedef void GtkGridboardThemeGridFunc (cairo_t *, gdouble, gdouble);
-
-typedef struct _GtkGridBoardTheme {
-  gchar *name;
-  GtkGridboardThemeBGFunc *draw_bg;
-  GtkGridboardThemePieceFunc *draw_piece;
-  GtkGridboardThemeHiliteFunc *draw_hilight;
-  GtkGridboardThemeSecondaryHiliteFunc *draw_secondary_hilight;
-  GtkGridboardThemeGridFunc *draw_grid;
-} GtkGridBoardTheme;
-
-extern GtkGridBoardTheme gtk_gridboard_themes[];
-
-#endif /* GTK_GRIDBOARD_THEMES_H */
Index: gnome-games/gataxx/menus.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/menus.c,v
retrieving revision 1.1
diff -u -r1.1 menus.c
--- gnome-games/gataxx/menus.c	25 Mar 2004 08:03:44 -0000	1.1
+++ gnome-games/gataxx/menus.c	29 Sep 2006 07:10:03 -0000
@@ -1,56 +0,0 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * menus.c - drop down menus
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- */
-
-#include "gataxx.h"
-#include <glib.h>
-#include <gnome.h>
-
-static GnomeUIInfo game_menu[] = {
-  GNOMEUIINFO_MENU_NEW_GAME_ITEM(new_game_cb, NULL),
-  GNOMEUIINFO_SEPARATOR,
-  GNOMEUIINFO_MENU_UNDO_MOVE_ITEM(undo_move_cb, NULL),
-  GNOMEUIINFO_SEPARATOR,
-  GNOMEUIINFO_MENU_QUIT_ITEM(quit_game_cb, NULL),
-  GNOMEUIINFO_END
-};
-
-static GnomeUIInfo settings_menu[] = {
-  GNOMEUIINFO_MENU_PREFERENCES_ITEM (properties_cb, NULL),
-  GNOMEUIINFO_END
-};
-
-static GnomeUIInfo help_menu[] = {
-  GNOMEUIINFO_HELP("gataxx"),
-  GNOMEUIINFO_MENU_ABOUT_ITEM(about_cb, NULL),
-  GNOMEUIINFO_END
-};
-
-GnomeUIInfo mainmenu[] = {
-  GNOMEUIINFO_MENU_GAME_TREE(game_menu),
-  GNOMEUIINFO_MENU_SETTINGS_TREE(settings_menu),
-  GNOMEUIINFO_MENU_HELP_TREE(help_menu),
-  GNOMEUIINFO_END
-};
-
-void menu_undo_set_sensitive(gboolean sens) {
-	GnomeUIInfo * gamemenu=mainmenu[0].moreinfo;
-	gtk_widget_set_sensitive(gamemenu[2].widget, sens);
-}
-	
Index: gnome-games/gataxx/menus.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/menus.h,v
retrieving revision 1.1
diff -u -r1.1 menus.h
--- gnome-games/gataxx/menus.h	25 Mar 2004 08:03:44 -0000	1.1
+++ gnome-games/gataxx/menus.h	29 Sep 2006 07:10:03 -0000
@@ -1,29 +0,0 @@
-/* 
- * menus.h - Menu definitions
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * For more details see the file COPYING.
- */
-
-
-#ifndef MENUS_H
-#define MENUS_H
-
-#include <gnome.h>
-
-extern GnomeUIInfo mainmenu[];
-
-#endif /* MENUS_H */
Index: gnome-games/gataxx/properties.c
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/properties.c,v
retrieving revision 1.41
diff -u -r1.41 properties.c
--- gnome-games/gataxx/properties.c	11 Feb 2006 08:45:28 -0000	1.41
+++ gnome-games/gataxx/properties.c	29 Sep 2006 07:10:03 -0000
@@ -1,7 +1,6 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * (C) 1999-2003 Chris Rogers
- * properties.c - properties dialog and info 
- * 
+/*
+ * properties.c
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -19,398 +18,587 @@
  * For more details see the file COPYING.
  */
 
-#include "config.h"
+#include <config.h>
+#include <stdio.h>
+#include <fcntl.h>
 #include <gnome.h>
-#include <glib/gi18n.h>
-#include <string.h>
-#include <dirent.h>
-#include <games-clock.h>
-#include <games-frame.h>
 #include <gconf/gconf-client.h>
-#include "gtkgridboard.h"
-
-#include "games-files.h"
 
-#include "properties.h"
 #include "gataxx.h"
+#include "ai.h"
+#include "properties.h"
 
-#define GCONF_PREFIX "/apps/gataxx/"
-
-#define GCONF_BLACKLEVEL GCONF_PREFIX "blacklevel"
-#define GCONF_WHITELEVEL GCONF_PREFIX "whitelevel"
-#define GCONF_QUICKMOVES GCONF_PREFIX "quickmoves"
-#define GCONF_THEME GCONF_PREFIX "theme"
-#define GCONF_ANIMATE GCONF_PREFIX "animate"
-
-typedef struct {
-	gint black_level;
-	gint white_level;
-	gboolean animate;
-	gboolean quick_moves;
-        gchar * theme;
-} PropertiesData;
-
-PropertiesData _props;
-PropertiesData * props=&_props;
-
-static GtkWidget *propbox = NULL;
-static GtkWindow * mainwindow = NULL;
-static GtkTooltips *tooltips = NULL;
-
-/* functions to get things from the PropertiesData struct */
+#define KEY_BLACK_LEVEL        "/apps/gataxx/blacklevel"
+#define KEY_WHITE_LEVEL        "/apps/gataxx/whitelevel"
+#define KEY_ANIMATE            "/apps/gataxx/animate"
+#define KEY_QUICK_MOVES        "/apps/gataxx/quickmoves"
+#define KEY_ANIMATE_STAGGER    "/apps/gataxx/animate_stagger"
+#define KEY_SHOW_GRID          "/apps/gataxx/show_grid"
+#define KEY_FLIP_FINAL_RESULTS "/apps/gataxx/flip_final_results"
+#define KEY_TILESET            "/apps/gataxx/tileset"
+#define KEY_BG_COLOR           "/apps/gataxx/bg_color_name"
+#define KEY_BOARD_WIDTH        "/apps/gataxx/width"
+#define KEY_BOARD_HEIGHT       "/apps/gataxx/height"
+
+static guint    t_computer_level[2];
+static gboolean t_options[5];
+static gchar    *t_tile_set;
+static gchar    *t_bg_color_name;
+
+extern gint     kifu[150][3];
+
+extern GtkWidget *window;
+extern GtkWidget *properties_dialog;
+extern GtkWidget *file_open_dialog;
+extern GtkWidget *file_save_dialog;
+extern GtkWidget *drawing_area;
+extern GtkWidget *entry;
+
+extern guint    black_computer_level;
+extern guint    white_computer_level;
+extern gboolean animate;
+extern gboolean quick_moves;
+extern gboolean animate_stagger;
+extern gboolean grid;
+extern gboolean flip_final;
+extern gchar    *tile_set;
+extern gchar    *bg_color_name;
+extern GdkColor bg_color[3];
+extern guint    computer_speed;
+extern guint    flip_speed;
+extern guint    board_width;
+extern guint    board_height;
+extern guint    game_in_progress;
 
-int props_is_human(int piece) {
-	return props_get_level(piece)==0;
-}
+void
+load_properties (void)
+{
+	GConfClient *client;
 
-int props_get_level(int piece) {
-	if (piece==WHITE) return props_get_white_level();
-		     else return props_get_black_level();
-}
+	client = gconf_client_get_default ();
 
-int props_get_white_level() {
-	return props->white_level;
+	if (tile_set)
+		g_free (tile_set);
+	if (bg_color_name)
+		g_free (bg_color_name);
+
+	black_computer_level = clamp_int (gconf_client_get_int (client, KEY_BLACK_LEVEL, NULL), 0, MAX_DEPTH - 1);
+	white_computer_level = clamp_int (gconf_client_get_int (client, KEY_WHITE_LEVEL, NULL), 0, MAX_DEPTH - 1);
+	animate              = gconf_client_get_bool           (client, KEY_ANIMATE,     NULL);
+	quick_moves          = gconf_client_get_bool           (client, KEY_QUICK_MOVES, NULL);
+	animate_stagger      = gconf_client_get_bool           (client, KEY_ANIMATE_STAGGER, NULL);
+	grid                 = gconf_client_get_bool           (client, KEY_SHOW_GRID,   NULL);
+	flip_final           = gconf_client_get_bool           (client, KEY_FLIP_FINAL_RESULTS, NULL);
+	tile_set             = gconf_client_get_string         (client, KEY_TILESET,     NULL);
+	bg_color_name        = gconf_client_get_string         (client, KEY_BG_COLOR,    NULL);
+	board_width          = gconf_client_get_int            (client, KEY_BOARD_WIDTH, NULL);
+	board_height         = gconf_client_get_int            (client, KEY_BOARD_HEIGHT, NULL);
+
+	if (!bg_color_name)
+		bg_color_name    = g_strdup (_("#000066660000"));
+	if (!board_width || !board_height)
+		board_width = board_height = BOARD_SIZE;
+	
+	g_object_unref (client);
 }
 
-int props_get_black_level() {
-	return props->black_level;
-}
+void
+save_properties (void)
+{
+	GConfClient *client;
 
-gboolean props_get_animate() {
-	return props->animate;
-}
+	client = gconf_client_get_default ();
 
-gboolean props_get_quick_moves() {
-	return props->quick_moves;
-}
+	gconf_client_set_int    (client, KEY_BLACK_LEVEL, black_computer_level, NULL);
+	gconf_client_set_int    (client, KEY_WHITE_LEVEL, white_computer_level, NULL);
+	gconf_client_set_bool   (client, KEY_ANIMATE,     animate,              NULL);
+	gconf_client_set_bool   (client, KEY_QUICK_MOVES, quick_moves,          NULL);
+	gconf_client_set_bool   (client, KEY_ANIMATE_STAGGER, animate_stagger,  NULL);
+	gconf_client_set_bool   (client, KEY_SHOW_GRID,   grid,                 NULL);
+	gconf_client_set_bool   (client, KEY_FLIP_FINAL_RESULTS, flip_final,    NULL);
+	gconf_client_set_string (client, KEY_TILESET,     tile_set,             NULL);
+	gconf_client_set_string (client, KEY_BG_COLOR,    bg_color_name,        NULL);
+	gconf_client_set_int    (client, KEY_BOARD_WIDTH, board_width,          NULL);
+	gconf_client_set_int    (client, KEY_BOARD_HEIGHT, board_height,        NULL);
 
-gchar * props_get_theme() {
-	return props->theme;
+	g_object_unref (client);
 }
 
-/* functions to get things from gconf */
-static int props_get_int(const gchar * key, int def, int low, int high) {
-	int result;
-	GError * error=NULL;
-
-	result=gconf_client_get_int(get_gconf_client(), key, &error);
-	if (error!=NULL) {
-		g_error_free(error);
-		return def;
-	}
-	
-	return CLAMP (result, low, high);
+void
+reset_properties (void)
+{
+	if (t_tile_set)
+		g_free (t_tile_set);
+	if (t_bg_color_name)
+		g_free (t_bg_color_name);
+
+	t_computer_level[0] = black_computer_level;
+	t_computer_level[1] = white_computer_level;
+	t_options[0]        = animate;
+	t_options[1]        = quick_moves;
+	t_options[2]        = animate_stagger;
+	t_options[3]        = grid;
+	t_options[4]        = flip_final;
+	t_tile_set          = g_strdup (tile_set);
+	t_bg_color_name     = g_strdup (bg_color_name);
+	gdk_color_parse (t_bg_color_name, &bg_color[2]);
+	if (drawing_area)
+		gdk_colormap_alloc_color (gtk_widget_get_colormap (drawing_area),
+				&bg_color[2], FALSE, TRUE);
 }
 
-static gboolean props_get_bool(const gchar * key, gboolean def) {
-	GError * error=NULL;
-	gboolean result;
-
-	result=gconf_client_get_bool(get_gconf_client(), key, &error);
-	if (error!=NULL) {
-		g_error_free(error);
-		return def;
+void
+apply_changes (void)
+{
+	if (bg_color_name)
+		g_free (bg_color_name);
+	if (tile_set)
+		g_free (tile_set);
+
+	black_computer_level = t_computer_level[0];
+	white_computer_level = t_computer_level[1];
+	animate              = t_options[0];
+	quick_moves          = t_options[1];
+	animate_stagger      = t_options[2];
+	grid                 = t_options[3];
+	flip_final           = t_options[4];
+	tile_set             = g_strdup (t_tile_set);
+	bg_color_name        = g_strdup (t_bg_color_name);
+	computer_speed       = COMPUTER_MOVE_DELAY;
+	flip_speed           = PIXMAP_FLIP_DELAY;
+	if (quick_moves)
+	{
+		computer_speed   /= 2;
+		flip_speed       /= 2;
 	}
+	set_flip_pixmaps_id ();
 
-	return result;
+	refresh_board ();
+	if (game_in_progress)
+		check_computer_players ();
 }
 
-/* FIXME: watch this: */
-/* Returns gchar* you should free with g_free(). Returns NULL on not-found
- * or other error. */
-static gchar * props_get_string(const gchar *key)
+static void
+on_computer_level_changed (GtkToggleButton *togglebutton, gpointer user_data)
 {
-	GError *error = NULL;
-	gchar *retval;
-
-	retval = gconf_client_get_string (get_gconf_client(), key, &error);
-	if (error != NULL) {
-		g_error_free (error);
-		return NULL;
-	}
-
-	return retval;
+	if (togglebutton->active)
+		t_computer_level[GPOINTER_TO_INT (user_data) / 8] =
+				GPOINTER_TO_INT (user_data) % 8;
 }
 
-void load_properties (void)
+static void
+on_options_toggled (GtkToggleButton *togglebutton, gpointer user_data)
 {
-	props->black_level=props_get_int(GCONF_BLACKLEVEL, 0, 0, 3);
-	props->white_level=props_get_int(GCONF_WHITELEVEL, 0, 0, 3);
-
-	props->theme=props_get_string(GCONF_THEME);
-	if (props->theme == NULL) props->theme = g_strdup("Plain");
+	t_options [GPOINTER_TO_INT (user_data)] = togglebutton->active;
+}
 
-	props->animate=props_get_bool(GCONF_ANIMATE, TRUE);
-	props->quick_moves=props_get_bool(GCONF_QUICKMOVES, FALSE);
+static void
+on_tile_set_box_changed (GtkComboBox *combobox, gpointer user_data)
+{
+	if (t_tile_set)
+		g_free (t_tile_set);
+	t_tile_set = gtk_combo_box_get_active_text (combobox);
 }
 
 static void
-save_properties (void)
+on_color_button_color_set (GtkColorButton *colorbutton, gpointer user_data)
 {
-	gconf_client_set_int (get_gconf_client(), GCONF_BLACKLEVEL,
-	                      props->black_level, NULL);
-	gconf_client_set_int (get_gconf_client(), GCONF_WHITELEVEL,
-	                      props->white_level, NULL);
-	gconf_client_set_bool (get_gconf_client(), GCONF_QUICKMOVES,
-	                       props->quick_moves, NULL);
-	gconf_client_set_string (get_gconf_client(), GCONF_THEME,
-	                         props->theme, NULL);
-	gconf_client_set_bool (get_gconf_client(), GCONF_ANIMATE,
-	                      props->animate, NULL);
-}
-
-/* callbacks for the various check and radiobuttons */
-static void
-black_level_select (GtkWidget *widget, gpointer data) {
-	if (GTK_TOGGLE_BUTTON (widget)->active) {
-		props->black_level = GPOINTER_TO_INT(data);
-	}
-	save_properties ();
-	apply_changes ();
+	gtk_color_button_get_color (colorbutton, &bg_color[2]);
+	if (t_bg_color_name)
+		g_free (t_bg_color_name);
+	t_bg_color_name = g_strdup_printf ("#%04X%04X%04X",
+				bg_color[2].red, bg_color[2].green, bg_color[2].blue);
 }
 
 static void
-white_level_select (GtkWidget *widget, gpointer data) {
-	if (GTK_TOGGLE_BUTTON (widget)->active) {
-		props->white_level = GPOINTER_TO_INT(data);
-	}
-	save_properties ();
+on_apply_button_clicked (GtkButton *button, gpointer user_data)
+{
 	apply_changes ();
+	save_properties ();
 }
 
 static void
-set_variable_cb(GtkWidget * widget, gpointer data) {
-	*((gint *)data)=GTK_TOGGLE_BUTTON(widget)->active;
-	apply_changes();
+on_properties_cancel_clicked (GtkButton *button, gpointer user_data)
+{
+	reset_properties ();
+	gtk_widget_destroy (properties_dialog);
+	properties_dialog = NULL;
 }
 
 static void
-set_selection (GtkWidget *widget, gpointer data)
+on_ok_button_clicked (GtkButton *button, gpointer user_data)
 {
-	int n;
-
-	if (props->theme)
-		g_free (props->theme);
-
-	/* We can't use _get_active_text since the text may be
-	 * translated. */
-	n = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
-	props->theme = g_strdup (gtk_gridboard_themes[n].name);
-
+	apply_changes ();
 	save_properties ();
-	apply_changes();
-}
-
-/* fills the pixmap options menu */
-static GtkWidget *
-fill_theme_menu (void)
-{
-        GtkWidget *combo_box;
-	GtkGridBoardTheme *t;
-	int n;
-
-	combo_box = gtk_combo_box_new_text ();
-
-	t = gtk_gridboard_themes;
-	n = 0;
-	while (t->name != NULL) {
-	  gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), _(t->name));
-	  if (g_utf8_collate (t->name, props->theme) == 0)
-	    gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), n);
-	  n++;
-	  t++;
-	}
-
-	return combo_box;
+	gtk_widget_destroy (properties_dialog);
+	properties_dialog = NULL;
 }
 
-/* makes a perty radio button for a particular computer level */
-static GtkWidget * add_level(GtkWidget * container, 
-		GtkWidget * prev,
-		const gchar * caption,
-		gint level,
-		gint piece) {
-	GtkWidget * button;
-	int computer_level;
-	GCallback callback;
-
-	if (piece==BLACK) {
-		computer_level=props->black_level;
-		callback=G_CALLBACK(black_level_select);
-	} else {
-		computer_level=props->white_level;
-		callback=G_CALLBACK(white_level_select);
-	}
+GtkWidget *
+create_properties_dialog (void)
+{
+	const gchar *strs [] = 
+	{
+		N_("Human"),            /* 0 */
+		N_("Level "),           /* 1 */
+		N_("Dark"),             /* 2 */
+		N_("Light"),            /* 3 */
+		N_("A_nimation"),       /* 4 */
+		N_("Use _Quick moves"), /* 5 */
+		N_("_Stagger flips"),   /* 6 */
+		N_("Show _Grid"),       /* 7 */
+		N_("_Flip final results"), /* 8 */
+		N_("Tile set:"),        /* 9 */
+		N_("Background color:"),/* 10 */
+		N_("Options"),          /* 11 */
+		N_("Players"),          /* 12 */
+		N_("Appearance"),       /* 13 */
+		N_("Gataxx Preferences"),/* 14 */
+		_("gtk-apply"),         /* 15 */
+		_("gtk-cancel"),        /* 16 */
+		_("gtk-ok"),            /* 17 */
+		_("coin.svg"),			/* 18 */
+		_("marble.svg"),        /* 19 */
+		_("sun_and_star.svg")   /* 20 */
+	};
+	
+	const GtkSignalFunc *signalfunc[3] =
+	{
+		(GtkSignalFunc *)on_apply_button_clicked,
+		(GtkSignalFunc *)on_properties_cancel_clicked,
+		(GtkSignalFunc *)on_ok_button_clicked
+	};
 	
-	button=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(prev), caption);
-	if (computer_level==level) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
-	}
-	g_signal_connect(G_OBJECT(button), "toggled", callback,
-                         GINT_TO_POINTER(level));
-	gtk_box_pack_start(GTK_BOX(container), button, FALSE, FALSE, 0);
-	return button;
-}
-
-static gboolean quit_properties_dialog(GtkWidget * widget, gpointer data) {
-	save_properties();
-	apply_changes();
-	g_object_unref (tooltips);
-	tooltips = NULL;
-	gtk_widget_destroy(propbox);
-	propbox = NULL;
-	return FALSE;
-}
-
-void props_init(GtkWindow * window, char * title) {
-	mainwindow=window;
-	load_properties();
-}
-
-void show_properties_dialog (void) {
+	GtkWidget *properties_dialog;
+	GtkWidget *dialog_vbox;
 	GtkWidget *notebook;
+	GtkWidget *hbox;
 	GtkWidget *frame;
+	GtkWidget *alignment;
+	GtkWidget *vbox;
+	GtkWidget *button;
 	GtkWidget *label;
+	GSList    *human_group[2] = {NULL, NULL};
 	GtkWidget *table;
-	GtkWidget *button;
-	GtkWidget *vbox, *vbox2;
-	GtkWidget *hbox;
-	GtkWidget *menu;
-	
-	if (propbox != NULL) {
-		gtk_window_present (GTK_WINDOW(propbox));
-		return;
+	GtkWidget *tile_set_box;
+	GtkWidget *color_button;
+	GtkWidget *dialog_action_area;
+	GString   *string;
+	
+	gint n, f, v;
+	
+	properties_dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (properties_dialog),strs[14]);
+	gtk_window_set_resizable (GTK_WINDOW (properties_dialog), FALSE);
+	gtk_window_set_type_hint (GTK_WINDOW (properties_dialog),
+				  GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	dialog_vbox = GTK_DIALOG (properties_dialog)->vbox;
+
+	notebook = gtk_notebook_new ();
+	gtk_box_pack_start (GTK_BOX (dialog_vbox), notebook, TRUE, TRUE, 0);
+
+	for (n = 0; n < 2; n++)
+	{
+		hbox = gtk_hbox_new (FALSE, 0);
+		gtk_container_add (GTK_CONTAINER (notebook), hbox);
+
+		if ( n == 0)
+		{
+			for (f = 0; f < 2; f++)
+			{
+				frame = gtk_frame_new (NULL);
+				gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
+				gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+
+				alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+				gtk_container_add (GTK_CONTAINER (frame), alignment);
+				gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
+
+				vbox = gtk_vbox_new (FALSE, 0);
+				gtk_container_add (GTK_CONTAINER (alignment), vbox);
+
+				for (v = 0; v < MAX_DEPTH; v++)
+				{
+					if (!v)
+						button = gtk_radio_button_new_with_mnemonic (NULL, strs[0]);
+					else
+					{
+						string = g_string_new (strs[1]);
+						g_string_append_printf (string,"%d",v);
+						button = gtk_radio_button_new_with_mnemonic (NULL, string->str);
+						g_string_free (string, TRUE);
+					}
+					gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+					gtk_radio_button_set_group (GTK_RADIO_BUTTON (button), human_group[f]);
+					human_group[f] = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+					gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+							(t_computer_level[f] == v));
+					g_signal_connect ((gpointer) button, "toggled",
+							G_CALLBACK (on_computer_level_changed), GINT_TO_POINTER (f*8+v));
+				}
+
+				label = gtk_label_new (strs[f+2]);
+				gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+				gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+			}
+		}
+		else
+		{
+			for (f = 0; f < 2; f++)
+			{
+				frame = gtk_frame_new (NULL);
+				gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
+				gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+
+				alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+				gtk_container_add (GTK_CONTAINER (frame), alignment);
+				gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
+
+				vbox = gtk_vbox_new (FALSE, 0);
+				gtk_container_add (GTK_CONTAINER (alignment), vbox);
+				if (f == 0)
+				{
+					for (v = 0; v < 5; v++)
+					{
+						button = gtk_check_button_new_with_mnemonic (strs[v+4]);
+						gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+						gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), t_options[v]);
+						g_signal_connect ((gpointer) button, "toggled",
+							G_CALLBACK (on_options_toggled), GINT_TO_POINTER (v));
+					}
+				}	
+				else
+				{
+
+					table = gtk_table_new (2, 2, FALSE);
+					gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
+			
+					for (v = 0; v < 2; v++)
+					{
+						label = gtk_label_new (strs[v+9]);
+						gtk_table_attach (GTK_TABLE (table), label, 0, 1, v, v+1,
+							(GtkAttachOptions) (0),
+							(GtkAttachOptions) (0), 0, 0);
+						gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+					}
+			
+					tile_set_box = gtk_combo_box_new_text ();
+					gtk_table_attach (GTK_TABLE (table), tile_set_box, 1, 2, 0, 1,
+						(GtkAttachOptions) (0),
+						(GtkAttachOptions) (0), 0, 0);
+					for (v = 0; v < 3; v ++)
+					{
+						gtk_combo_box_append_text (GTK_COMBO_BOX (tile_set_box), strs[v+18]);
+						if (g_str_equal (t_tile_set, strs[v+18]))
+							gtk_combo_box_set_active (GTK_COMBO_BOX (tile_set_box), v);
+					}
+					g_signal_connect ((gpointer) tile_set_box, "changed",
+						G_CALLBACK (on_tile_set_box_changed), NULL);
+
+					color_button = gtk_color_button_new ();
+					gtk_table_attach (GTK_TABLE (table), color_button, 1, 2, 1, 2,
+						(GtkAttachOptions) (0),
+						(GtkAttachOptions) (0), 0, 0);
+					gtk_color_button_set_color ((GtkColorButton *) color_button, &bg_color[2]);
+					g_signal_connect ((gpointer) color_button, "color_set",
+						G_CALLBACK (on_color_button_color_set), NULL);
+				}
+				label = gtk_label_new (strs[11]);
+				gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+				gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+			}
+		}
+		label = gtk_label_new (strs[n+12]);
+		gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook),
+		gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), n),label);
 	}
 
-	/* create window */
-        propbox = gtk_dialog_new_with_buttons (_("Ataxx Preferences"),
-					       GTK_WINDOW (mainwindow),
-					       GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-					       GTK_STOCK_CLOSE,
-					       GTK_RESPONSE_CLOSE,
-					       NULL);
-	
-	gtk_window_set_resizable (GTK_WINDOW (propbox), FALSE);
-	gtk_container_set_border_width (GTK_CONTAINER (propbox), 5);
-	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (propbox)->vbox), 2);
-	
-	g_signal_connect (G_OBJECT (propbox), "response",
-			  G_CALLBACK (quit_properties_dialog), &propbox);
+	dialog_action_area = GTK_DIALOG (properties_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area),
+				GTK_BUTTONBOX_END);
+
+	for (n = 0; n < 3; n++)
+	{
+		button = gtk_button_new_from_stock (strs[n+15]);
+		gtk_dialog_add_action_widget (GTK_DIALOG (properties_dialog),
+				      	button, GTK_RESPONSE_APPLY);
+		GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+		g_signal_connect ((gpointer) button, "clicked",
+					G_CALLBACK (signalfunc[n]), NULL);
+	};
 
-	g_signal_connect (G_OBJECT (propbox), "delete_event",
-			  G_CALLBACK (quit_properties_dialog), &propbox);
+	gtk_widget_show_all (properties_dialog);
+	return properties_dialog;
+}
 
-	/* create tooltips */	
-	tooltips = gtk_tooltips_new();
-	g_object_ref (tooltips);
-	gtk_object_sink (GTK_OBJECT (tooltips));
+static void
+write_kifu (int fd)
+{
+	gchar buf[12] = {0,0,0x20,0,0x20,0,0,0x2D,0,0,0x0A,0};
+	gint8 i = 0;
+	ssize_t err;
+
+	err = write (fd, _("gataxx\n"), 7);
+	while (kifu[i][0] && err > 0)
+	{
+		buf[0] = (i + 1) / 10 + 0x30;
+		buf[1] = (i + 1) % 10 + 0x30;
+		buf[3] = (kifu[i][0] == BLACK) ? 0x42 : 0x57;
+		buf[5] = (gchar)(kifu[i][1] % 7 + 0x41);
+		buf[6] = (gchar)(kifu[i][1] / 7 + 0x31);
+		buf[8] = (gchar)(kifu[i][2] % 7 + 0x41);
+		buf[9] = (gchar)(kifu[i][2] / 7 + 0x31);
 
-	/* create notebook (tabs) */
-	notebook = gtk_notebook_new ();
-	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
-	gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (propbox)->vbox), notebook, TRUE, TRUE, 0);
-	
-	/* Players tab */
-	
-	label = gtk_label_new (_("Players"));
+		err = write (fd, buf, 11);
+		i++;
+	}
+}
 
-	vbox = gtk_vbox_new (FALSE, 18);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
-
-	table = gtk_table_new (1, 2, FALSE);
-	gtk_table_set_col_spacings (GTK_TABLE (table), 18);
-        gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-	vbox2 = gtk_vbox_new (FALSE, 0);
-        gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
-	button = gtk_check_button_new_with_mnemonic (_("_Quick moves"));
-	gtk_tooltips_set_tip(tooltips, button, _("Shortens the time a computer waits before doing a move"), NULL);	
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-				     props->quick_moves);
-	g_signal_connect (G_OBJECT (button), "toggled",
-			  G_CALLBACK (set_variable_cb), &(props->quick_moves));
-	gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
-	
-	
-	/* Dark level select */
-	frame = games_frame_new (_("Dark"));
-	
-	vbox2 = gtk_vbox_new (FALSE, 6);
-	
-	button=add_level(vbox2, NULL,    _("Human"), 	        0, BLACK);
-	button=add_level(vbox2, button,  _("Very easy"),	1, BLACK);
-	button=add_level(vbox2, button, Q_("gataxx|Easy"), 	2, BLACK);
-	button=add_level(vbox2, button, Q_("gataxx|Medium"), 	3, BLACK);
-	button=add_level(vbox2, button,  _("Hard"), 	        4, BLACK);
-	button=add_level(vbox2, button,  _("Very hard"),        5, BLACK);
+static void
+read_kifu (int fd)
+{
+	gchar buf[12];
+	gint i = 0;
+	ssize_t err;
+
+	err = read (fd, buf, 7);
+	buf[7] = 0;
+	if (!g_str_equal (buf, _("gataxx\n")))
+	{
+		gui_message (_("not gataxx's file"));
+		return;
+	}
+	err = read (fd, buf, 11);
+	while (err > 0)
+	{
+		i = (gint)((buf[0] - 0x30) * 10 + buf[1] - 0x30 - 1);
+		kifu[i][0] = (buf[3] == 0x42) ? BLACK : WHITE;
+		kifu[i][1] = (gint)((buf[6] - 0x31) * 7 + buf[5] - 0x41);
+		kifu[i][2] = (gint)((buf[9] - 0x31) * 7 + buf[8] - 0x41);
+		err = read (fd, buf, 11);
+	}
+	kifu[i + 1][0] = 0;
+}
 
-	gtk_container_add (GTK_CONTAINER (frame), vbox2);
-	
-	gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1,
-			  GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
-			  0, 0);
-	
-	/* Light level select */
-	frame = games_frame_new (_("Light"));
+static void
+on_save_clicked (GtkButton *button, gpointer user_data)
+{
+	gchar *filename;
+	int fd;
 
-	vbox2 = gtk_vbox_new (FALSE, 6);
-	
-	button=add_level(vbox2, NULL, _("Human"), 0, WHITE);
-	button=add_level(vbox2, button, _("Very easy"), 1, WHITE);
-	button=add_level(vbox2, button, _("Easy"), 	2, WHITE);
-	button=add_level(vbox2, button, _("Medium"), 	3, WHITE);
-	button=add_level(vbox2, button, _("Hard"), 	4, WHITE);
-	button=add_level(vbox2, button, _("Very hard"), 5, WHITE);
-	
-	gtk_container_add (GTK_CONTAINER (frame), (vbox2));
+	filename =
+		gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_save_dialog));
 
-	gtk_table_attach (GTK_TABLE (table), frame, 0, 1, 0, 1,
-			  GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
-			  0, 0);
-
-	/* Appearance tab */
-	label = gtk_label_new (_("Appearance"));
-	vbox = gtk_vbox_new (FALSE, 6);
-
-        frame = games_frame_new (_("Appearance"));
-	gtk_container_add (GTK_CONTAINER (frame), vbox);
-	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
-	gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
-
-	/* animation button */
-	button=gtk_check_button_new_with_mnemonic(_("_Animation"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), props->animate);
-	g_signal_connect(G_OBJECT(button), "toggled",
-			G_CALLBACK(set_variable_cb), &(props->animate));
-	gtk_tooltips_set_tip(tooltips, button, _("Flip the pieces with some visual effects"), NULL);	
-	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
-	/*  theme select */
-	hbox=gtk_hbox_new(FALSE, 12);
-	label=gtk_label_new_with_mnemonic(_("_Tile set:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-	menu = fill_theme_menu ();
-	g_signal_connect (G_OBJECT (menu), "changed",
-			  G_CALLBACK (set_selection), NULL);
-	gtk_tooltips_set_tip(tooltips, menu, _("The appearance of the pieces"), NULL);	
-	gtk_box_pack_start(GTK_BOX(hbox), menu, TRUE, TRUE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	gtk_label_set_mnemonic_widget(GTK_LABEL (label), menu);
+	fd = creat (filename, 0644);
+	if (fd)
+	{
+		write_kifu (fd);
+		close (fd);
+	}
+	gtk_widget_destroy (file_save_dialog);
+	g_free (filename);
+}
 
-	/* end of appearance tab */
-	gtk_widget_show_all (propbox);
+static void
+on_open_clicked (GtkButton *button, gpointer user_data)
+{
+	gchar *filename;
+	int fd;
 
-}	
+	filename =
+		gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_open_dialog));
+	fd = open (filename, 0, 0644);
+	if (fd)
+	{
+		read_kifu (fd);
+		close (fd);
+	}
+	gtk_widget_destroy (file_open_dialog);
+	g_free (filename);
+	on_head_button_clicked (NULL, NULL);
+}
 
-/* FIXME rewrite this to clear the whole struct */
-void
-reload_properties (void)
+GtkWidget *
+create_file_save_dialog (void)
 {
-	g_free (props->theme);
-	props->theme = NULL;
-	load_properties ();
-	apply_changes ();
+	GtkWidget *file_save_dialog;
+	GtkWidget *dialog_vbox;
+	GtkWidget *dialog_action_area;
+	GtkWidget *save_cancel;
+	GtkWidget *save;
+
+	file_save_dialog =
+		gtk_file_chooser_dialog_new ("", (GtkWindow *)window,
+				GTK_FILE_CHOOSER_ACTION_SAVE, NULL);
+	gtk_window_set_type_hint (GTK_WINDOW (file_save_dialog),
+				GDK_WINDOW_TYPE_HINT_DIALOG);
+	g_signal_connect ((gpointer) file_save_dialog, "destroy",
+				G_CALLBACK (gtk_widget_destroy), NULL);
+
+	dialog_vbox = GTK_DIALOG (file_save_dialog)->vbox;
+
+	dialog_action_area = GTK_DIALOG (file_save_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area),
+				GTK_BUTTONBOX_END);
+
+	save_cancel = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (file_save_dialog),
+				save_cancel, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (save_cancel, GTK_CAN_DEFAULT);
+	g_signal_connect_swapped ((gpointer) save_cancel, "clicked",
+				G_CALLBACK (gtk_widget_destroy), (gpointer) file_save_dialog);
+
+	save = gtk_button_new_from_stock ("gtk-save");
+	gtk_dialog_add_action_widget (GTK_DIALOG (file_save_dialog), save,
+				GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (save, GTK_CAN_DEFAULT);
+	g_signal_connect ((gpointer) save, "clicked",
+				G_CALLBACK (on_save_clicked), NULL);
+
+	gtk_widget_show_all (file_save_dialog);
+	gtk_widget_grab_default (save);
+	return file_save_dialog;
 }
 
+GtkWidget *
+create_file_open_dialog (void)
+{
+	GtkWidget *file_open_dialog;
+	GtkWidget *dialog_vbox;
+	GtkWidget *dialog_action_area;
+	GtkWidget *open_cancel;
+	GtkWidget *open;
+
+	file_open_dialog =
+		gtk_file_chooser_dialog_new ("", (GtkWindow *)window,
+				GTK_FILE_CHOOSER_ACTION_OPEN, NULL);
+	gtk_window_set_type_hint (GTK_WINDOW (file_open_dialog),
+				GDK_WINDOW_TYPE_HINT_DIALOG);
+	g_signal_connect ((gpointer) file_open_dialog, "destroy",
+				G_CALLBACK (gtk_widget_destroy), NULL);
+
+	dialog_vbox = GTK_DIALOG (file_open_dialog)->vbox;
+
+	dialog_action_area = GTK_DIALOG (file_open_dialog)->action_area;
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area),
+				GTK_BUTTONBOX_END);
+
+	open_cancel = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (file_open_dialog),
+				      open_cancel, GTK_RESPONSE_CANCEL);
+	GTK_WIDGET_SET_FLAGS (open_cancel, GTK_CAN_DEFAULT);
+	g_signal_connect_swapped ((gpointer) open_cancel, "clicked",
+				G_CALLBACK (gtk_widget_destroy), (gpointer) file_open_dialog);
+
+	open = gtk_button_new_from_stock ("gtk-open");
+	gtk_dialog_add_action_widget (GTK_DIALOG (file_open_dialog), open,
+				GTK_RESPONSE_OK);
+	GTK_WIDGET_SET_FLAGS (open, GTK_CAN_DEFAULT);
+	g_signal_connect ((gpointer) open, "clicked",
+				G_CALLBACK (on_open_clicked), NULL);
+
+	gtk_widget_show_all (file_open_dialog);
+	gtk_widget_grab_default (open);
+	return file_open_dialog;
+}
Index: gnome-games/gataxx/properties.h
===================================================================
RCS file: /cvs/gnome/gnome-games/gataxx/properties.h,v
retrieving revision 1.7
diff -u -r1.7 properties.h
--- gnome-games/gataxx/properties.h	31 Dec 2005 10:06:34 -0000	1.7
+++ gnome-games/gataxx/properties.h	29 Sep 2006 07:10:03 -0000
@@ -1,6 +1,6 @@
-/* (C) 2003/2004 Sjoerd Langkemper
- * properties.h - 
- * 
+/*
+ * properties.h
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -13,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * For more details see the file COPYING.
  */
@@ -21,21 +21,18 @@
 #ifndef _PROPERTIES_H_
 #define _PROPERTIES_H_
 
-#include <glib.h>
-
 void load_properties (void);
-void reload_properties (void);
-void show_properties_dialog (void);
-int props_get_level(int piece);
-int props_get_white_level(void);
-int props_get_black_level(void);
-void load_properties(void);
-void show_properties_dialog(void);
-void reload_properties(void);
-gboolean props_get_animate(void);
-gboolean props_get_quick_moves(void);
-gchar * props_get_theme(void);
-int props_is_human(int piece);
-void props_init(GtkWindow * window, char * title);
+
+void save_properties (void);
+
+void reset_properties (void);
+
+void apply_changes (void);
+
+GtkWidget* create_properties_dialog (void);
+
+GtkWidget* create_file_save_dialog (void);
+
+GtkWidget* create_file_open_dialog (void);
 
 #endif
