From 1acb4d1c569ecf2bcec712d728d5e262f10684e2 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 3 Feb 2023 21:40:01 +0200 Subject: [PATCH 22/22] gtk4: Add Select by production class menu entries to city report See osdn #47301 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/cityrep.c | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/client/gui-gtk-4.0/cityrep.c b/client/gui-gtk-4.0/cityrep.c index 3453e2f30d..217de56c7c 100644 --- a/client/gui-gtk-4.0/cityrep.c +++ b/client/gui-gtk-4.0/cityrep.c @@ -1378,11 +1378,14 @@ static void city_select_same_island_callback(GtkMenuItem *item, gpointer data) { gtk_tree_selection_selected_foreach(city_selection,same_island_iterate,NULL); } +#endif /* MENUS_GTK3 */ /************************************************************************//** User has chosen to select cities with certain target in production ****************************************************************************/ -static void city_select_building_callback(GtkMenuItem *item, gpointer data) +static void city_select_building_callback(GSimpleAction *action, + GVariant *parameter, + gpointer data) { enum production_class_type which = GPOINTER_TO_INT(data); ITree it; @@ -1405,7 +1408,6 @@ static void city_select_building_callback(GtkMenuItem *item, gpointer data) } } } -#endif /* MENUS_GTK3 */ /************************************************************************//** Buy the production in one single city. @@ -1859,30 +1861,28 @@ static GMenu *create_select_menu(GActionGroup *group) menu_item_append_unref(select_menu, g_menu_item_new(_("Invert Selection"), "win.select_invert")); -#if 0 - item = gtk_menu_item_new_with_label(_("Building Units")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - g_signal_connect(item, "activate", - G_CALLBACK(city_select_building_callback), - GINT_TO_POINTER(PCT_UNIT)); - - item = gtk_menu_item_new_with_label( _("Building Improvements")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - g_signal_connect(item, "activate", - G_CALLBACK(city_select_building_callback), - GINT_TO_POINTER(PCT_NORMAL_IMPROVEMENT)); - - item = gtk_menu_item_new_with_label(_("Building Wonders")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - g_signal_connect(item, "activate", - G_CALLBACK(city_select_building_callback), - GINT_TO_POINTER(PCT_WONDER)); - + act = g_simple_action_new("select_build_unit", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(city_select_building_callback), + GINT_TO_POINTER(PCT_UNIT)); + menu_item_append_unref(select_menu, g_menu_item_new(_("Building Units"), + "win.select_build_unit")); - item = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + act = g_simple_action_new("select_build_impr", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(city_select_building_callback), + GINT_TO_POINTER(PCT_NORMAL_IMPROVEMENT)); + menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"), + "win.select_build_impr")); + act = g_simple_action_new("select_build_wonder", NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act)); + g_signal_connect(act, "activate", G_CALLBACK(city_select_building_callback), + GINT_TO_POINTER(PCT_WONDER)); + menu_item_append_unref(select_menu, g_menu_item_new(_("Building Wonders"), + "win.select_build_wonder")); +#if 0 select_bunit_item = gtk_menu_item_new_with_label(_("Building Unit")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), select_bunit_item); -- 2.39.1