From 9151f107084d0b4cc7718e33e1d64efe2f4e16f3 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 14 Aug 2022 04:36:11 +0300 Subject: [PATCH 39/39] gtk4: Add players dialog menu See osdn #45337 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/cityrep.c | 32 ++--- client/gui-gtk-4.0/diplodlg.c | 18 +-- client/gui-gtk-4.0/gui_stuff.c | 22 +--- client/gui-gtk-4.0/gui_stuff.h | 2 +- client/gui-gtk-4.0/plrdlg.c | 229 +++++++++++++++++++-------------- client/gui-gtk-4.0/wldlg.c | 8 +- 6 files changed, 163 insertions(+), 148 deletions(-) diff --git a/client/gui-gtk-4.0/cityrep.c b/client/gui-gtk-4.0/cityrep.c index bbea639e65..c3924afbf2 100644 --- a/client/gui-gtk-4.0/cityrep.c +++ b/client/gui-gtk-4.0/cityrep.c @@ -1027,7 +1027,7 @@ static void toggle_view(GtkCheckMenuItem *item, gpointer data) } /************************************************************************//** - Create view menu for city report menubar. + Create view menu for city report menu. ****************************************************************************/ static void update_view_menu(GtkWidget *show_item) { @@ -1047,12 +1047,12 @@ static void update_view_menu(GtkWidget *show_item) #endif /* MENUS_GTK3 */ /************************************************************************//** - Create menubar for city report + Create menu for city report ****************************************************************************/ -static GtkWidget *create_city_report_menubar(void) +static GtkWidget *create_city_report_menu(void) { GtkWidget *vgrid, *sep; - GtkWidget *menubar; + GtkWidget *aux_menu; int grid_row = 0; vgrid = gtk_grid_new(); @@ -1061,15 +1061,15 @@ static GtkWidget *create_city_report_menubar(void) sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_grid_attach(GTK_GRID(vgrid), sep, 0, grid_row++, 1, 1); - menubar = gtk_aux_menu_bar_new(); - gtk_grid_attach(GTK_GRID(vgrid), menubar, 0, grid_row++, 1, 1); + aux_menu = aux_menu_new(); + gtk_grid_attach(GTK_GRID(vgrid), aux_menu, 0, grid_row++, 1, 1); #ifdef MENUS_GTK3 GtkWidget *menu, *item; item = gtk_menu_item_new_with_mnemonic(_("_Production")); city_production_command = item; - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); menu = gtk_menu_button_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); @@ -1116,20 +1116,20 @@ static GtkWidget *create_city_report_menubar(void) item = gtk_menu_item_new_with_mnemonic(_("Gover_nor")); city_governor_command = item; - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); append_cma_to_menu_item(GTK_MENU_ITEM(item), TRUE); item = gtk_menu_item_new_with_mnemonic(_("S_ell")); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); city_sell_command = item; create_sell_menu(item); item = gtk_menu_item_new_with_mnemonic(_("_Select")); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); create_select_menu(item); item = gtk_menu_item_new_with_mnemonic(_("_Display")); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); update_view_menu(item); #endif /* MENUS_GTK3 */ @@ -1160,7 +1160,7 @@ static void create_city_report_dialog(bool make_modal) static char (*buf)[128]; struct city_report_spec *spec; - GtkWidget *w, *sw, *menubar; + GtkWidget *w, *sw, *aux_menu; int i; gui_dialog_new(&city_dialog_shell, GTK_NOTEBOOK(top_notebook), NULL, TRUE); @@ -1169,11 +1169,11 @@ static void create_city_report_dialog(bool make_modal) gui_dialog_set_default_size(city_dialog_shell, -1, 420); gui_dialog_response_set_callback(city_dialog_shell, - city_command_callback); + city_command_callback); - /* menubar */ - menubar = create_city_report_menubar(); - gui_dialog_add_action_widget(city_dialog_shell, menubar); + /* Menu */ + aux_menu = create_city_report_menu(); + gui_dialog_add_action_widget(city_dialog_shell, aux_menu); /* buttons */ city_total_buy_cost_label = gtk_label_new(NULL); diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c index e7e08ad9e5..22a1de4952 100644 --- a/client/gui-gtk-4.0/diplodlg.c +++ b/client/gui-gtk-4.0/diplodlg.c @@ -690,7 +690,7 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, #ifdef MENUS_GTK3 GtkWidget *menuitem; #endif /* MENUS_GTK3 */ - GtkWidget *menubar, *notebook; + GtkWidget *aux_menu, *notebook; struct sprite *flag_spr; GtkListStore *store; GtkCellRenderer *rend; @@ -795,7 +795,7 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, gtk_grid_attach(GTK_GRID(hgrid), image, grid_col++, 0, 1, 1); /* Menu for clauses: we. */ - menubar = gtk_aux_menu_bar_new(); + aux_menu = aux_menu_new(); menu = gtk_menu_button_new(); pdialog->menu0 = menu; @@ -803,7 +803,7 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, #ifdef MENUS_GTK3 menuitem = gtk_menu_item_new_with_label(_("Add Clause...")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), menuitem); g_object_set_data(G_OBJECT(menu), "plr", plr0); g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog); #endif /* MENUS_GTK3 */ @@ -830,9 +830,9 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, "xalign", 0.0, "yalign", 0.5, NULL); gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1); - gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1); + gtk_grid_attach(GTK_GRID(table), aux_menu, 2, 0, 1, 1); } else { - gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1); + gtk_grid_attach(GTK_GRID(table), aux_menu, 0, 0, 1, 1); } /* them. */ @@ -884,7 +884,7 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, gtk_grid_attach(GTK_GRID(hgrid), image, grid_col++, 0, 1, 1); /* Menu for clauses: they. */ - menubar = gtk_aux_menu_bar_new(); + aux_menu = aux_menu_new(); menu = gtk_menu_button_new(); pdialog->menu1 = menu; @@ -892,7 +892,7 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, #ifdef MENUS_GTK3 menuitem = gtk_menu_item_new_with_label(_("Add Clause...")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), menuitem); g_object_set_data(G_OBJECT(menu), "plr", plr1); g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog); #endif /* MENUS_GTK3 */ @@ -919,9 +919,9 @@ static struct Diplomacy_dialog *create_diplomacy_dialog(struct Treaty *ptreaty, "xalign", 0.0, "yalign", 0.5, NULL); gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1); - gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1); + gtk_grid_attach(GTK_GRID(table), aux_menu, 2, 0, 1, 1); } else { - gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1); + gtk_grid_attach(GTK_GRID(table), aux_menu, 0, 0, 1, 1); } /* Clauses. */ diff --git a/client/gui-gtk-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c index bb1fac4ee8..e827241964 100644 --- a/client/gui-gtk-4.0/gui_stuff.c +++ b/client/gui-gtk-4.0/gui_stuff.c @@ -233,27 +233,11 @@ void gtk_tree_view_focus(GtkTreeView *view) Create an auxiliary menubar (i.e., not the main menubar at the top of the window). **************************************************************************/ -GtkWidget *gtk_aux_menu_bar_new(void) +GtkWidget *aux_menu_new(void) { -#ifdef MENUS_GTK3 - GtkWidget *menubar = gtk_menu_bar_new(); - - /* - * Ubuntu Linux's Ayatana/Unity desktop environment likes to steal the - * application's main menu bar from its window and put it at the top of - * the screen. It needs a hint in order not to steal menu bars other - * than the main one. Gory details at - * https://bugs.launchpad.net/ubuntu/+source/freeciv/+bug/743265 - */ - if (g_object_class_find_property( - G_OBJECT_CLASS(GTK_MENU_BAR_GET_CLASS(menubar)), "ubuntu-local")) { - g_object_set(G_OBJECT(menubar), "ubuntu-local", TRUE, NULL); - } + GtkWidget *menu_button = gtk_menu_button_new(); - return menubar; -#else /* MENUS_GTK3 */ - return NULL; -#endif /* MENUS_GTK3 */ + return menu_button; } /**********************************************************************//** diff --git a/client/gui-gtk-4.0/gui_stuff.h b/client/gui-gtk-4.0/gui_stuff.h index 30b634d9a6..3809bb85d0 100644 --- a/client/gui-gtk-4.0/gui_stuff.h +++ b/client/gui-gtk-4.0/gui_stuff.h @@ -54,7 +54,7 @@ void setup_dialog(GtkWidget *shell, GtkWidget *parent); GtkTreeViewColumn *add_treeview_column(GtkWidget *view, const char *title, GType gtype, int model_index); -GtkWidget *gtk_aux_menu_bar_new(void); +GtkWidget *aux_menu_new(void); enum gui_dialog_type { GUI_DIALOG_WINDOW, diff --git a/client/gui-gtk-4.0/plrdlg.c b/client/gui-gtk-4.0/plrdlg.c index 5605ba5de1..68824d484b 100644 --- a/client/gui-gtk-4.0/plrdlg.c +++ b/client/gui-gtk-4.0/plrdlg.c @@ -58,11 +58,11 @@ struct gui_dialog *players_dialog_shell; static GtkWidget *players_list; static GtkTreeSelection *players_selection; -static GtkWidget *players_int_command; -static GtkWidget *players_meet_command; -static GtkWidget *players_war_command; -static GtkWidget *players_vision_command; -static GtkWidget *players_sship_command; +static GSimpleAction *players_int_command; +static GSimpleAction *players_meet_command; +static GSimpleAction *players_war_command; +static GSimpleAction *players_vision_command; +static GSimpleAction *players_sship_command; static GtkListStore *players_dialog_store; #define PLR_DLG_COL_STYLE (0 + num_player_dlg_columns) @@ -70,13 +70,20 @@ static GtkListStore *players_dialog_store; #define PLR_DLG_COL_ID (2 + num_player_dlg_columns) static void create_players_dialog(void); +static void players_meet_callback(GSimpleAction *action, GVariant *parameter, + gpointer data); +static void players_war_callback(GSimpleAction *action, GVariant *parameter, + gpointer data); +static void players_vision_callback(GSimpleAction *action, GVariant *parameter, + gpointer data); +static void players_intel_callback(GSimpleAction *action, GVariant *parameter, + gpointer data); +static void players_intel_wonder_callback(GSimpleAction *action, + GVariant *parameter, gpointer data); +static void players_sship_callback(GSimpleAction *action, GVariant *parameter, + gpointer data); + #ifdef MENUS_GTK3 -static void players_meet_callback(GtkMenuItem *item, gpointer data); -static void players_war_callback(GtkMenuItem *item, gpointer data); -static void players_vision_callback(GtkMenuItem *item, gpointer data); -static void players_intel_callback(GtkMenuItem *item, gpointer data); -static void players_intel_wonder_callback(GtkMenuItem *item, gpointer data); -static void players_sship_callback(GtkMenuItem *item, gpointer data); static void players_ai_toggle_callback(GtkMenuItem *item, gpointer data); static void players_ai_skill_callback(GtkMenuItem *item, gpointer data); #endif /* MENUS_GTK3 */ @@ -162,35 +169,35 @@ static void update_players_menu(void) plr = player_by_number(plrno); if (plr->spaceship.state != SSHIP_NONE) { - gtk_widget_set_sensitive(players_sship_command, TRUE); + g_simple_action_set_enabled(players_sship_command, TRUE); } else { - gtk_widget_set_sensitive(players_sship_command, FALSE); + g_simple_action_set_enabled(players_sship_command, FALSE); } if (NULL != client.conn.playing) { /* We keep button sensitive in case of DIPL_SENATE_BLOCKING, so that player * can request server side to check requirements of those effects with omniscience */ - gtk_widget_set_sensitive(players_war_command, - can_client_issue_orders() - && pplayer_can_cancel_treaty(client_player(), - player_by_number(plrno)) - != DIPL_ERROR); + g_simple_action_set_enabled(players_war_command, + can_client_issue_orders() + && pplayer_can_cancel_treaty(client_player(), + player_by_number(plrno)) + != DIPL_ERROR); } else { - gtk_widget_set_sensitive(players_war_command, FALSE); + g_simple_action_set_enabled(players_war_command, FALSE); } - gtk_widget_set_sensitive(players_vision_command, - can_client_issue_orders() - && gives_shared_vision(client.conn.playing, plr) - && !players_on_same_team(client.conn.playing, plr)); + g_simple_action_set_enabled(players_vision_command, + can_client_issue_orders() + && gives_shared_vision(client.conn.playing, plr) + && !players_on_same_team(client.conn.playing, plr)); - gtk_widget_set_sensitive(players_meet_command, can_meet_with_player(plr)); - gtk_widget_set_sensitive(players_int_command, can_intel_with_player(plr)); + g_simple_action_set_enabled(players_meet_command, can_meet_with_player(plr)); + g_simple_action_set_enabled(players_int_command, can_intel_with_player(plr)); return; } - gtk_widget_set_sensitive(players_meet_command, FALSE); - gtk_widget_set_sensitive(players_int_command, FALSE); + g_simple_action_set_enabled(players_meet_command, FALSE); + g_simple_action_set_enabled(players_int_command, FALSE); } /**********************************************************************//** @@ -359,34 +366,40 @@ static void toggle_dead_players(GtkCheckMenuItem* item, gpointer data) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)); real_players_dialog_update(NULL); } +#endif /* MENUS_GTK3 */ /**********************************************************************//** Create and return the "diplomacy" menu for the player report. This menu contains diplomacy actions the current player can use on other nations. **************************************************************************/ -static GtkWidget *create_diplomacy_menu(void) +static GMenu *create_diplomacy_menu(GActionGroup *group) { - GtkWidget *menu, *item; - - menu = gtk_menu_button_new(); - - item = gtk_menu_item_new_with_mnemonic(_("_Meet")); - g_signal_connect(item, "activate", - G_CALLBACK(players_meet_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - players_meet_command = item; - - item = gtk_menu_item_new_with_mnemonic(_("Cancel _Treaty")); - g_signal_connect(item, "activate", - G_CALLBACK(players_war_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - players_war_command = item; - - item = gtk_menu_item_new_with_mnemonic(_("_Withdraw Vision")); - g_signal_connect(item, "activate", - G_CALLBACK(players_vision_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - players_vision_command = item; + GMenu *menu; + GMenuItem *item; + GSimpleAction *act; + + menu = g_menu_new(); + + act = g_simple_action_new("meet", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_meet_callback), NULL); + item = g_menu_item_new(_("_Meet"), "win.meet"); + g_menu_append_item(menu, item); + players_meet_command = act; + + act = g_simple_action_new("cancel_treaty", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_war_callback), NULL); + item = g_menu_item_new(_("Cancel _Treaty"), "win.cancel_treaty"); + g_menu_append_item(menu, item); + players_war_command = act; + + act = g_simple_action_new("withdraw_vision", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_vision_callback), NULL); + item = g_menu_item_new(_("_Withdraw Vision"), "win.withdraw_vision"); + g_menu_append_item(menu, item); + players_vision_command = act; return menu; } @@ -395,28 +408,33 @@ static GtkWidget *create_diplomacy_menu(void) Create and return the "intelligence" menu. The items in this menu are used by the player to see more detailed information about other nations. **************************************************************************/ -static GtkWidget *create_intelligence_menu(void) +static GMenu *create_intelligence_menu(GActionGroup *group) { - GtkWidget *menu, *item; - - menu = gtk_menu_button_new(); - - item = gtk_menu_item_new_with_mnemonic(_("_Report")); - g_signal_connect(item, "activate", - G_CALLBACK(players_intel_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - players_int_command = item; - - item = gtk_menu_item_new_with_mnemonic(_("_Wonders")); - g_signal_connect(item, "activate", - G_CALLBACK(players_intel_wonder_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - - item = gtk_menu_item_new_with_mnemonic(_("_Spaceship")); - g_signal_connect(item, "activate", - G_CALLBACK(players_sship_callback), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - players_sship_command = item; + GMenu *menu; + GMenuItem *item; + GSimpleAction *act; + + menu = g_menu_new(); + + act = g_simple_action_new("report", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_intel_callback), NULL); + item = g_menu_item_new(_("_Report"), "win.report"); + g_menu_append_item(menu, item); + players_int_command = act; + + act = g_simple_action_new("wonders", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_intel_wonder_callback), NULL); + item = g_menu_item_new(_("_Wonders"), "win.wonders"); + g_menu_append_item(menu, item); + + act = g_simple_action_new("spaceship", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(players_sship_callback), NULL); + item = g_menu_item_new(_("_Spaceship"), "win.spaceship"); + g_menu_append_item(menu, item); + players_sship_command = act; return menu; } @@ -424,11 +442,14 @@ static GtkWidget *create_intelligence_menu(void) /**********************************************************************//** Create 'show' menu for player dialog **************************************************************************/ -static GtkWidget *create_show_menu(void) +static GMenu *create_show_menu(GActionGroup *group) { + GMenu *menu; + + menu = g_menu_new(); + +#ifdef MENUS_GTK3 int i; - GtkWidget *menu = gtk_menu_button_new(); - GtkWidget *item; /* index starting at one (1) here to force playername to always be shown */ for (i = 1; i < num_player_dlg_columns; i++) { @@ -449,10 +470,10 @@ static GtkWidget *create_show_menu(void) gui_options.player_dlg_show_dead_players); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_signal_connect(item, "toggled", G_CALLBACK(toggle_dead_players), NULL); +#endif /* MENUS_GTK3 */ return menu; } -#endif /* MENUS_GTK3 */ /**********************************************************************//** Create all of player dialog @@ -461,9 +482,10 @@ void create_players_dialog(void) { int i; GtkWidget *sep, *sw; - GtkWidget *menubar; + GtkWidget *aux_menu; + GMenu *topmenu, *submenu; + GActionGroup *group; #ifdef MENUS_GTK3 - GtkWidget *menu, *item; enum ai_level level; #endif /* MENUS_GTK3 */ GtkWidget *vgrid; @@ -582,29 +604,32 @@ void create_players_dialog(void) sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_grid_attach(GTK_GRID(vgrid), sep, 0, grid_row++, 1, 1); - menubar = gtk_aux_menu_bar_new(); - gtk_grid_attach(GTK_GRID(vgrid), menubar, 0, grid_row++, 1, 1); + aux_menu = aux_menu_new(); + gtk_grid_attach(GTK_GRID(vgrid), aux_menu, 0, grid_row++, 1, 1); gui_dialog_add_action_widget(players_dialog_shell, vgrid); -#ifdef MENUS_GTK3 - item = gtk_menu_item_new_with_mnemonic(_("Di_plomacy")); - menu = create_diplomacy_menu(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + group = G_ACTION_GROUP(g_simple_action_group_new()); + topmenu = g_menu_new(); - item = gtk_menu_item_new_with_mnemonic(_("_Intelligence")); - menu = create_intelligence_menu(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + submenu = create_diplomacy_menu(group); + g_menu_append_submenu(topmenu, _("Di_plomacy"), G_MENU_MODEL(submenu)); - item = gtk_menu_item_new_with_mnemonic(_("_Display")); - menu = create_show_menu(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + submenu = create_intelligence_menu(group); + g_menu_append_submenu(topmenu, _("_Intelligence"), G_MENU_MODEL(submenu)); + + submenu = create_show_menu(group); + g_menu_append_submenu(topmenu, _("_Display"), G_MENU_MODEL(submenu)); + + submenu = g_menu_new(); + g_menu_append_submenu(topmenu, _("_AI"), G_MENU_MODEL(submenu)); + gtk_widget_insert_action_group(aux_menu, "win", group); + gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(aux_menu), G_MENU_MODEL(topmenu)); + +#ifdef MENUS_GTK3 item = gtk_menu_item_new_with_mnemonic(_("_AI")); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); menu = gtk_menu_button_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); @@ -801,12 +826,12 @@ void real_players_dialog_update(void *unused) update_views(); } -#ifdef MENUS_GTK3 /**********************************************************************//** Callback for diplomatic meetings button. This button is enabled iff we can meet with the other player. **************************************************************************/ -void players_meet_callback(GtkMenuItem *item, gpointer data) +void players_meet_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -847,7 +872,8 @@ static void confirm_cancel_pact(enum clause_type clause, int plrno, /**********************************************************************//** Pact cancellation requested **************************************************************************/ -void players_war_callback(GtkMenuItem *item, gpointer data) +void players_war_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -888,7 +914,8 @@ void players_war_callback(GtkMenuItem *item, gpointer data) /**********************************************************************//** Withdrawing shared vision **************************************************************************/ -void players_vision_callback(GtkMenuItem *item, gpointer data) +void players_vision_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -915,7 +942,8 @@ void players_vision_callback(GtkMenuItem *item, gpointer data) /**********************************************************************//** Intelligence report query **************************************************************************/ -void players_intel_callback(GtkMenuItem *item, gpointer data) +void players_intel_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -934,7 +962,8 @@ void players_intel_callback(GtkMenuItem *item, gpointer data) /**********************************************************************//** Wonders list report query **************************************************************************/ -void players_intel_wonder_callback(GtkMenuItem *item, gpointer data) +void players_intel_wonder_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -951,7 +980,8 @@ void players_intel_wonder_callback(GtkMenuItem *item, gpointer data) /**********************************************************************//** Spaceship query callback **************************************************************************/ -void players_sship_callback(GtkMenuItem *item, gpointer data) +void players_sship_callback(GSimpleAction *action, GVariant *parameter, + gpointer data) { GtkTreeModel *model; GtkTreeIter it; @@ -964,6 +994,7 @@ void players_sship_callback(GtkMenuItem *item, gpointer data) } } +#ifdef MENUS_GTK3 /**********************************************************************//** AI toggle callback. **************************************************************************/ diff --git a/client/gui-gtk-4.0/wldlg.c b/client/gui-gtk-4.0/wldlg.c index 49e3539f71..c0fed5516b 100644 --- a/client/gui-gtk-4.0/wldlg.c +++ b/client/gui-gtk-4.0/wldlg.c @@ -1073,7 +1073,7 @@ GtkWidget *create_worklist(void) { GtkWidget *editor, *table, *sw, *bbox; GtkWidget *src_view, *dst_view, *label, *button; - GtkWidget *menubar; + GtkWidget *aux_menu; #ifdef MENUS_GTK3 GtkWidget *item, *menu; #endif /* MENUS_GTK3 */ @@ -1231,15 +1231,15 @@ GtkWidget *create_worklist(void) gtk_box_set_spacing(GTK_BOX(bbox), 10); gtk_grid_attach(GTK_GRID(editor), bbox, 0, editor_row++, 1, 1); - menubar = gtk_aux_menu_bar_new(); - gtk_box_append(GTK_BOX(bbox), menubar); + aux_menu = aux_menu_new(); + gtk_box_append(GTK_BOX(bbox), aux_menu); #ifdef MENUS_GTK3 menu = gtk_menu_button_new(); item = gtk_menu_item_new_with_mnemonic(_("_Add Global Worklist")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item); + gtk_menu_shell_append(GTK_MENU_SHELL(aux_menu), item); g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), ptr); ptr->add_cmd = item; -- 2.35.1