From bf0582f0aad0c157722db243ddfb749ae2f4f5b9 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 1 Feb 2011 18:56:37 -0800 Subject: [PATCH] make hint buttons en/disabled based on board_canHint() results. --- xwords4/linux/gtkmain.c | 6 ++++++ xwords4/linux/gtkmain.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index 83530042e..fbae9c65b 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -1018,6 +1018,10 @@ disenable_buttons( GtkAppGlobals* globals ) XP_Bool canToggle = board_canTogglePending( globals->cGlobals.game.board ); gtk_widget_set_sensitive( globals->toggle_undo_button, canToggle ); + XP_Bool canHing = board_canHint( globals->cGlobals.game.board ); + gtk_widget_set_sensitive( globals->prevhint_button, canHing ); + gtk_widget_set_sensitive( globals->nexthint_button, canHing ); + XP_Bool canChat = !!globals->cGlobals.game.comms && comms_canChat( globals->cGlobals.game.comms ); gtk_widget_set_sensitive( globals->chat_button, canChat ); @@ -1754,9 +1758,11 @@ makeVerticalBar( GtkAppGlobals* globals, GtkWidget* XP_UNUSED(window) ) button = makeShowButtonFromBitmap( globals, "../hint.xpm", "?-", G_CALLBACK(handle_prevhint_button) ); + globals->prevhint_button = button; gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 ); button = makeShowButtonFromBitmap( globals, "../hint.xpm", "?+", G_CALLBACK(handle_nexthint_button) ); + globals->nexthint_button = button; gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 ); button = makeShowButtonFromBitmap( globals, "../hintNum.xpm", "n", diff --git a/xwords4/linux/gtkmain.h b/xwords4/linux/gtkmain.h index eb5f9c931..92de46fae 100644 --- a/xwords4/linux/gtkmain.h +++ b/xwords4/linux/gtkmain.h @@ -95,6 +95,9 @@ typedef struct GtkAppGlobals { GtkWidget* zoomin_button; GtkWidget* zoomout_button; GtkWidget* toggle_undo_button; + GtkWidget* prevhint_button; + GtkWidget* nexthint_button; + #ifdef XWFEATURE_CHAT GtkWidget* chat_button; #endif