From 4a0e0c5bc6d94b67094cdf41b5b93548a6b32f57 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 18 Jul 2023 21:03:45 +0300 Subject: [PATCH 24/24] gtk4: Do not refresh menus after disconnecting See osdn #48419 Signed-off-by: Marko Lindqvist --- client/client_main.h | 8 ++++---- client/gui-gtk-4.0/menu.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/client_main.h b/client/client_main.h index b30907d89c..871e6773fa 100644 --- a/client/client_main.h +++ b/client/client_main.h @@ -23,7 +23,7 @@ extern "C" { #include "worklist.h" /* - * Every TIMER_INTERVAL milliseconds real_timer_callback is + * Every TIMER_INTERVAL milliseconds real_timer_callback() is * called. TIMER_INTERVAL has to stay 500 because real_timer_callback * also updates the timeout info. */ @@ -34,9 +34,9 @@ extern "C" { * * C_S_INITIAL: Client boot, only used once on program start. * C_S_DISCONNECTED: The state when the client is not connected - * to a server. In this state, neither game nor ruleset + * to a server. In this state, neither game nor ruleset * is in effect. - * C_S_PREPARING: Connected in pregame. Game and ruleset are done. + * C_S_PREPARING: Connected in pregame. Game and ruleset are done. * C_S_RUNNING: Connected ith game in progress. * C_S_OVER: Connected with game over. */ @@ -136,4 +136,4 @@ extern const bool gui_use_transliteration; } #endif /* __cplusplus */ -#endif /* FC__CLIENT_MAIN_H */ +#endif /* FC__CLIENT_MAIN_H */ diff --git a/client/gui-gtk-4.0/menu.c b/client/gui-gtk-4.0/menu.c index 69cabe9df1..2b53c360b4 100644 --- a/client/gui-gtk-4.0/menu.c +++ b/client/gui-gtk-4.0/menu.c @@ -1316,8 +1316,8 @@ static void leave_callback(GSimpleAction *action, gpointer data) { if (is_server_running()) { - GtkWidget* dialog = - gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING, + GtkWidget *dialog + = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, _("Leaving a local game will end it!")); setup_dialog(dialog, toplevel); @@ -3413,7 +3413,7 @@ void real_menus_update(void) struct extra_type_list *extras; bool conn_possible; - if (!menus_built) { + if (!menus_built || client_state() == C_S_DISCONNECTED) { return; } @@ -3680,7 +3680,7 @@ void real_menus_update(void) struct terrain *pterrain; #endif /* MENUS_GTK3 */ - if (!menus_built || !can_client_change_view()) { + if (!can_client_change_view()) { return; } -- 2.40.1