From ec99fcd0a630027f741091070f0848bf4f7ff64d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 25 Sep 2022 23:06:18 +0300 Subject: [PATCH 35/35] gtk4: Create toggle button for editor boolean widgets objprop_setup_widget() created check buttons for booleans. Later they are assumed to be a toggle buttons. See osdn #45710 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/editgui.c | 3 ++- client/gui-gtk-4.0/editprop.c | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/gui-gtk-4.0/editgui.c b/client/gui-gtk-4.0/editgui.c index ca5cb9ad0c..ef2c11b084 100644 --- a/client/gui-gtk-4.0/editgui.c +++ b/client/gui-gtk-4.0/editgui.c @@ -511,7 +511,8 @@ static void editbar_add_mode_button(struct editbar *eb, gtk_widget_set_focus_on_click(button, FALSE); g_signal_connect(button, "toggled", - G_CALLBACK(editbar_mode_button_toggled), GINT_TO_POINTER(etm)); + G_CALLBACK(editbar_mode_button_toggled), + GINT_TO_POINTER(etm)); hbox = eb->widget; gtk_box_append(GTK_BOX(hbox), button); diff --git a/client/gui-gtk-4.0/editprop.c b/client/gui-gtk-4.0/editprop.c index d54a634e2e..7d4996263a 100644 --- a/client/gui-gtk-4.0/editprop.c +++ b/client/gui-gtk-4.0/editprop.c @@ -3081,13 +3081,14 @@ static void objprop_setup_widget(struct objprop *op) case OPID_GAME_LAKE_FLOODING: case OPID_GAME_RULESET_LOCKED: case OPID_PLAYER_SCENARIO_RESERVED: - button = gtk_check_button_new(); + button = gtk_toggle_button_new(); gtk_widget_set_hexpand(button, TRUE); gtk_widget_set_halign(button, GTK_ALIGN_END); g_signal_connect(button, "toggled", - G_CALLBACK(objprop_widget_toggle_button_changed), op); + G_CALLBACK(objprop_widget_toggle_button_changed), + op); gtk_grid_attach(GTK_GRID(hgrid), button, grid_col++, 0, 1, 1); - objprop_set_child_widget(op, "checkbutton", button); + objprop_set_child_widget(op, "togglebutton", button); return; } @@ -3301,9 +3302,9 @@ static void objprop_refresh_widget(struct objprop *op, case OPID_GAME_LAKE_FLOODING: case OPID_GAME_RULESET_LOCKED: case OPID_PLAYER_SCENARIO_RESERVED: - button = objprop_get_child_widget(op, "checkbutton"); + button = objprop_get_child_widget(op, "togglebutton"); disable_gobject_callback(G_OBJECT(button), - G_CALLBACK(objprop_widget_toggle_button_changed)); + G_CALLBACK(objprop_widget_toggle_button_changed)); if (pv) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), pv->data.v_bool); @@ -3311,7 +3312,7 @@ static void objprop_refresh_widget(struct objprop *op, gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); } enable_gobject_callback(G_OBJECT(button), - G_CALLBACK(objprop_widget_toggle_button_changed)); + G_CALLBACK(objprop_widget_toggle_button_changed)); gtk_widget_set_sensitive(button, pv != NULL); break; } -- 2.35.1