use board_canTogglePending to disable button

This commit is contained in:
Andy2 2010-07-03 11:39:10 -07:00
parent 5f92491ca3
commit 3452666231
2 changed files with 4 additions and 10 deletions

View file

@ -997,6 +997,9 @@ disenable_buttons( GtkAppGlobals* globals )
{
XP_Bool canFlip = board_canFlip( globals->cGlobals.game.board );
gtk_widget_set_sensitive( globals->flip_button, canFlip );
XP_Bool canToggle = board_canTogglePending( globals->cGlobals.game.board );
gtk_widget_set_sensitive( globals->toggle_undo_button, canToggle );
}
static gboolean
@ -1085,15 +1088,7 @@ handle_toggle_undo( GtkWidget* XP_UNUSED(widget),
GtkAppGlobals* globals )
{
BoardCtxt* board = globals->cGlobals.game.board;
XP_Bool draw = XP_FALSE;
if ( globals->didReplace ) {
draw = board_redoReplacedTiles( board );
} else {
draw = board_replaceTiles( board );
}
globals->didReplace = !globals->didReplace;
if ( draw ) {
if ( board_redoReplacedTiles( board ) || board_replaceTiles( board ) ) {
board_draw( board );
}
}

View file

@ -91,7 +91,6 @@ typedef struct GtkAppGlobals {
GtkWidget* zoomin_button;
GtkWidget* zoomout_button;
GtkWidget* toggle_undo_button;
XP_Bool didReplace;
EngineCtxt* engine;