Freeciv-3.1
Loading...
Searching...
No Matches
menu.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdlib.h>
19
20#include <gtk/gtk.h>
21
22/* utility */
23#include "fcintl.h"
24#include "log.h"
25#include "shared.h"
26#include "support.h"
27
28/* common */
29#include "game.h"
30#include "government.h"
31#include "road.h"
32#include "unit.h"
33
34/* client */
35#include "client_main.h"
36#include "clinet.h"
37#include "connectdlg_common.h"
38#include "control.h"
39#include "mapview_common.h"
40#include "options.h"
41#include "tilespec.h"
42
43/* client/gui-gtk-4.0 */
44#include "chatline.h"
45#include "cityrep.h"
46#include "dialogs.h"
47#include "editgui.h"
48#include "editprop.h"
49#include "finddlg.h"
50#include "gamedlgs.h"
51#include "gotodlg.h"
52#include "gui_main.h"
53#include "gui_stuff.h"
54#include "helpdlg.h"
55#include "infradlg.h"
56#include "luaconsole.h"
57#include "mapctrl.h" /* center_on_unit(). */
58#include "messagedlg.h"
59#include "messagewin.h"
60#include "optiondlg.h"
61#include "pages.h"
62#include "plrdlg.h"
63#include "rallypointdlg.h"
64#include "ratesdlg.h"
65#include "repodlgs.h"
66#include "sprite.h"
67#include "spaceshipdlg.h"
68#include "unitselect.h"
69#include "wldlg.h"
70
71#include "menu.h"
72
73static GMenu *main_menubar = NULL;
74static bool menus_built = FALSE;
75
76static GMenu *setup_menus(GtkApplication *app);
77
78static void view_menu_update_sensitivity(GActionMap *map);
79
82
83static GMenu *options_menu = NULL;
84static GMenu *edit_menu = NULL;
85static GMenu *view_menu = NULL;
86static GMenu *gov_menu = NULL;
87static GMenu *unit_menu = NULL;
88static GMenu *work_menu = NULL;
89static GMenu *combat_menu = NULL;
90
91struct menu_entry_info {
92 const char *key;
93 const char *name;
94 const char *action;
95 const char *accl;
97 void (*toggle)(GSimpleAction *act, GVariant *value, gpointer data);
98 bool state; /* Only for toggle actions */
99};
100
101static void setup_app_actions(GApplication *fc_app);
102static GMenuItem *create_toggle_menu_item(struct menu_entry_info *info);
103static GMenuItem *create_toggle_menu_item_for_key(const char *key);
104
105/* Menu entry callbacks */
106static void clear_chat_logs_callback(GSimpleAction *action,
107 GVariant *parameter,
108 gpointer data);
109static void save_chat_logs_callback(GSimpleAction *action,
110 GVariant *parameter,
111 gpointer data);
112static void local_options_callback(GSimpleAction *action,
113 GVariant *parameter,
114 gpointer data);
115static void message_options_callback(GSimpleAction *action,
116 GVariant *parameter,
117 gpointer data);
118static void server_options_callback(GSimpleAction *action,
119 GVariant *parameter,
120 gpointer data);
121static void save_options_callback(GSimpleAction *action,
122 GVariant *parameter,
123 gpointer data);
124static void save_options_on_exit_callback(GSimpleAction *action,
125 GVariant *parameter,
126 gpointer data);
127static void save_game_callback(GSimpleAction *action,
128 GVariant *parameter,
129 gpointer data);
130static void save_game_as_callback(GSimpleAction *action,
131 GVariant *parameter,
132 gpointer data);
133
134#ifdef FREECIV_DEBUG
135static void reload_tileset_callback(GSimpleAction *action,
136 GVariant *parameter,
137 gpointer data);
138#endif /* FREECIV_DEBUG */
139
140static void save_mapimg_callback(GSimpleAction *action,
141 GVariant *parameter,
142 gpointer data);
143static void save_mapimg_as_callback(GSimpleAction *action,
144 GVariant *parameter,
145 gpointer data);
146static void find_city_callback(GSimpleAction *action,
147 GVariant *parameter,
148 gpointer data);
149static void worklists_callback(GSimpleAction *action,
150 GVariant *parameter,
151 gpointer data);
152static void client_lua_script_callback(GSimpleAction *action,
153 GVariant *parameter,
154 gpointer data);
155static void leave_callback(GSimpleAction *action,
156 GVariant *parameter,
157 gpointer data);
158static void quit_callback(GSimpleAction *action,
159 GVariant *parameter,
160 gpointer data);
161static void map_view_callback(GSimpleAction *action,
162 GVariant *parameter,
163 gpointer data);
164static void report_units_callback(GSimpleAction *action,
165 GVariant *parameter,
166 gpointer data);
167static void report_nations_callback(GSimpleAction *action,
168 GVariant *parameter,
169 gpointer data);
170static void report_cities_callback(GSimpleAction *action,
171 GVariant *parameter,
172 gpointer data);
173static void report_wow_callback(GSimpleAction *action,
174 GVariant *parameter,
175 gpointer data);
176static void report_top_cities_callback(GSimpleAction *action,
177 GVariant *parameter,
178 gpointer data);
179static void report_messages_callback(GSimpleAction *action,
180 GVariant *parameter,
181 gpointer data);
182static void report_demographic_callback(GSimpleAction *action,
183 GVariant *parameter,
184 gpointer data);
185static void help_overview_callback(GSimpleAction *action,
186 GVariant *parameter,
187 gpointer data);
188static void help_playing_callback(GSimpleAction *action,
189 GVariant *parameter,
190 gpointer data);
191static void help_policies_callback(GSimpleAction *action,
192 GVariant *parameter,
193 gpointer data);
194static void help_terrain_callback(GSimpleAction *action,
195 GVariant *parameter,
196 gpointer data);
197static void help_economy_callback(GSimpleAction *action,
198 GVariant *parameter,
199 gpointer data);
200static void help_cities_callback(GSimpleAction *action,
201 GVariant *parameter,
202 gpointer data);
203static void help_improvements_callback(GSimpleAction *action,
204 GVariant *parameter,
205 gpointer data);
206static void help_wonders_callback(GSimpleAction *action,
207 GVariant *parameter,
208 gpointer data);
209static void help_units_callback(GSimpleAction *action,
210 GVariant *parameter,
211 gpointer data);
212static void help_combat_callback(GSimpleAction *action,
213 GVariant *parameter,
214 gpointer data);
215static void help_zoc_callback(GSimpleAction *action,
216 GVariant *parameter,
217 gpointer data);
218static void help_government_callback(GSimpleAction *action,
219 GVariant *parameter,
220 gpointer data);
221static void help_diplomacy_callback(GSimpleAction *action,
222 GVariant *parameter,
223 gpointer data);
224static void help_tech_callback(GSimpleAction *action,
225 GVariant *parameter,
226 gpointer data);
227static void help_space_race_callback(GSimpleAction *action,
228 GVariant *parameter,
229 gpointer data);
230static void help_ruleset_callback(GSimpleAction *action,
231 GVariant *parameter,
232 gpointer data);
233static void help_tileset_callback(GSimpleAction *action,
234 GVariant *parameter,
235 gpointer data);
236static void help_nations_callback(GSimpleAction *action,
237 GVariant *parameter,
238 gpointer data);
239static void help_connecting_callback(GSimpleAction *action,
240 GVariant *parameter,
241 gpointer data);
242static void help_controls_callback(GSimpleAction *action,
243 GVariant *parameter,
244 gpointer data);
245static void help_governor_callback(GSimpleAction *action,
246 GVariant *parameter,
247 gpointer data);
248static void help_chatline_callback(GSimpleAction *action,
249 GVariant *parameter,
250 gpointer data);
251static void help_worklist_editor_callback(GSimpleAction *action,
252 GVariant *parameter,
253 gpointer data);
254static void help_language_callback(GSimpleAction *action,
255 GVariant *parameter,
256 gpointer data);
257static void help_copying_callback(GSimpleAction *action,
258 GVariant *parameter,
259 gpointer data);
260static void help_about_callback(GSimpleAction *action,
261 GVariant *parameter,
262 gpointer data);
263static void edit_mode_callback(GSimpleAction *action,
264 GVariant *parameter,
265 gpointer data);
266static void show_city_outlines_callback(GSimpleAction *action,
267 GVariant *parameter,
268 gpointer data);
269static void show_city_output_callback(GSimpleAction *action,
270 GVariant *parameter,
271 gpointer data);
272static void show_map_grid_callback(GSimpleAction *action,
273 GVariant *parameter,
274 gpointer data);
275static void show_national_borders_callback(GSimpleAction *action,
276 GVariant *parameter,
277 gpointer data);
278static void show_native_tiles_callback(GSimpleAction *action,
279 GVariant *parameter,
280 gpointer data);
281static void show_city_full_bar_callback(GSimpleAction *action,
282 GVariant *parameter,
283 gpointer data);
284static void show_city_names_callback(GSimpleAction *action,
285 GVariant *parameter,
286 gpointer data);
287static void show_city_growth_callback(GSimpleAction *action,
288 GVariant *parameter,
289 gpointer data);
290static void show_city_productions_callback(GSimpleAction *action,
291 GVariant *parameter,
292 gpointer data);
293static void show_city_buy_cost_callback(GSimpleAction *action,
294 GVariant *parameter,
295 gpointer data);
296static void show_city_trade_routes_callback(GSimpleAction *action,
297 GVariant *parameter,
298 gpointer data);
299static void show_terrain_callback(GSimpleAction *action,
300 GVariant *parameter,
301 gpointer data);
302static void show_coastline_callback(GSimpleAction *action,
303 GVariant *parameter,
304 gpointer data);
305static void show_paths_callback(GSimpleAction *action,
306 GVariant *parameter,
307 gpointer data);
308static void show_irrigation_callback(GSimpleAction *action,
309 GVariant *parameter,
310 gpointer data);
311static void show_mines_callback(GSimpleAction *action,
312 GVariant *parameter,
313 gpointer data);
314static void show_bases_callback(GSimpleAction *action,
315 GVariant *parameter,
316 gpointer data);
317static void show_resources_callback(GSimpleAction *action,
318 GVariant *parameter,
319 gpointer data);
320static void show_huts_callback(GSimpleAction *action,
321 GVariant *parameter,
322 gpointer data);
323static void show_pollution_callback(GSimpleAction *action,
324 GVariant *parameter,
325 gpointer data);
326static void show_cities_callback(GSimpleAction *action,
327 GVariant *parameter,
328 gpointer data);
329static void show_units_callback(GSimpleAction *action,
330 GVariant *parameter,
331 gpointer data);
332static void show_unit_solid_bg_callback(GSimpleAction *action,
333 GVariant *parameter,
334 gpointer data);
335static void show_unit_shields_callback(GSimpleAction *action,
336 GVariant *parameter,
337 gpointer data);
338static void show_stack_size_callback(GSimpleAction *action,
339 GVariant *parameter,
340 gpointer data);
341static void show_focus_unit_callback(GSimpleAction *action,
342 GVariant *parameter,
343 gpointer data);
344static void show_fog_of_war_callback(GSimpleAction *action,
345 GVariant *parameter,
346 gpointer data);
347static void toggle_fog_callback(GSimpleAction *action,
348 GVariant *parameter,
349 gpointer data);
350static void scenario_properties_callback(GSimpleAction *action,
351 GVariant *parameter,
352 gpointer data);
353static void save_scenario_callback(GSimpleAction *action,
354 GVariant *parameter,
355 gpointer data);
356static void full_screen_callback(GSimpleAction *action,
357 GVariant *parameter,
358 gpointer data);
359static void center_view_callback(GSimpleAction *action,
360 GVariant *parameter,
361 gpointer data);
362static void report_economy_callback(GSimpleAction *action,
363 GVariant *parameter,
364 gpointer data);
365static void report_research_callback(GSimpleAction *action,
366 GVariant *parameter,
367 gpointer data);
368static void multiplier_callback(GSimpleAction *action,
369 GVariant *parameter,
370 gpointer data);
371static void report_spaceship_callback(GSimpleAction *action,
372 GVariant *parameter,
373 gpointer data);
374static void report_achievements_callback(GSimpleAction *action,
375 GVariant *parameter,
376 gpointer data);
377
378static void government_callback(GSimpleAction *action,
379 GVariant *parameter,
380 gpointer data);
381static void revolution_callback(GSimpleAction *action,
382 GVariant *parameter,
383 gpointer data);
384static void tax_rate_callback(GSimpleAction *action,
385 GVariant *parameter,
386 gpointer data);
387static void select_single_callback(GSimpleAction *action,
388 GVariant *parameter,
389 gpointer data);
390static void select_all_on_tile_callback(GSimpleAction *action,
391 GVariant *parameter,
392 gpointer data);
393static void select_same_type_tile_callback(GSimpleAction *action,
394 GVariant *parameter,
395 gpointer data);
396static void select_same_type_cont_callback(GSimpleAction *action,
397 GVariant *parameter,
398 gpointer data);
399static void select_same_type_callback(GSimpleAction *action,
400 GVariant *parameter,
401 gpointer data);
402static void select_dialog_callback(GSimpleAction *action,
403 GVariant *parameter,
404 gpointer data);
405static void rally_dialog_callback(GSimpleAction *action,
406 GVariant *parameter,
407 gpointer data);
408static void infra_dialog_callback(GSimpleAction *action,
409 GVariant *parameter,
410 gpointer data);
411static void unit_wait_callback(GSimpleAction *action,
412 GVariant *parameter,
413 gpointer data);
414static void unit_done_callback(GSimpleAction *action,
415 GVariant *parameter,
416 gpointer data);
417static void unit_goto_callback(GSimpleAction *action,
418 GVariant *parameter,
419 gpointer data);
420static void unit_goto_city_callback(GSimpleAction *action,
421 GVariant *parameter,
422 gpointer data);
423static void unit_return_callback(GSimpleAction *action,
424 GVariant *parameter,
425 gpointer data);
426static void unit_explore_callback(GSimpleAction *action,
427 GVariant *parameter,
428 gpointer data);
429static void unit_patrol_callback(GSimpleAction *action,
430 GVariant *parameter,
431 gpointer data);
432static void unit_sentry_callback(GSimpleAction *action,
433 GVariant *parameter,
434 gpointer data);
435static void fortify_callback(GSimpleAction *action,
436 GVariant *parameter,
437 gpointer data);
438static void unit_homecity_callback(GSimpleAction *action,
439 GVariant *parameter,
440 gpointer data);
441static void unit_upgrade_callback(GSimpleAction *action,
442 GVariant *parameter,
443 gpointer data);
444static void unit_convert_callback(GSimpleAction *action,
445 GVariant *parameter,
446 gpointer data);
447static void unit_disband_callback(GSimpleAction *action,
448 GVariant *parameter,
449 gpointer data);
450static void unsentry_all_callback(GSimpleAction *action,
451 GVariant *parameter,
452 gpointer data);
453static void unit_unload_transporter_callback(GSimpleAction *action,
454 GVariant *parameter,
455 gpointer data);
456static void unit_board_callback(GSimpleAction *action,
457 GVariant *parameter,
458 gpointer data);
459static void unit_deboard_callback(GSimpleAction *action,
460 GVariant *parameter,
461 gpointer data);
462static void build_city_callback(GSimpleAction *action,
463 GVariant *parameter,
464 gpointer data);
465static void auto_settle_callback(GSimpleAction *action,
466 GVariant *parameter,
467 gpointer data);
468static void cultivate_callback(GSimpleAction *action,
469 GVariant *parameter,
470 gpointer data);
471static void plant_callback(GSimpleAction *action,
472 GVariant *parameter,
473 gpointer data);
474
475static void paradrop_callback(GSimpleAction *action,
476 GVariant *parameter,
477 gpointer data);
478static void pillage_callback(GSimpleAction *action,
479 GVariant *parameter,
480 gpointer data);
481static void transform_terrain_callback(GSimpleAction *action,
482 GVariant *parameter,
483 gpointer data);
484static void clean_callback(GSimpleAction *action,
485 GVariant *parameter,
486 gpointer data);
487static void build_road_callback(GSimpleAction *action,
488 GVariant *parameter,
489 gpointer data);
490static void build_irrigation_callback(GSimpleAction *action,
491 GVariant *parameter,
492 gpointer data);
493static void build_mine_callback(GSimpleAction *action,
494 GVariant *parameter,
495 gpointer data);
496static void connect_road_callback(GSimpleAction *action,
497 GVariant *parameter,
498 gpointer data);
499static void connect_rail_callback(GSimpleAction *action,
500 GVariant *parameter,
501 gpointer data);
502static void connect_maglev_callback(GSimpleAction *action,
503 GVariant *parameter,
504 gpointer data);
505static void connect_irrigation_callback(GSimpleAction *action,
506 GVariant *parameter,
507 gpointer data);
508static void do_action_callback(GSimpleAction *action,
509 GVariant *parameter,
510 gpointer data);
511static void build_fortress_callback(GSimpleAction *action,
512 GVariant *parameter,
513 gpointer data);
514static void build_airbase_callback(GSimpleAction *action,
515 GVariant *parameter,
516 gpointer data);
517
518static void bg_select_callback(GSimpleAction *action,
519 GVariant *parameter,
520 gpointer data);
521static void bg_assign_callback(GSimpleAction *action,
522 GVariant *parameter,
523 gpointer data);
524static void bg_append_callback(GSimpleAction *action,
525 GVariant *parameter,
526 gpointer data);
527
529{
530 /* Game menu */
531 { "CLEAR_CHAT_LOGS", N_("_Clear Chat Log"),
532 "clear_chat", NULL, MGROUP_SAFE,
533 NULL, FALSE },
534 { "SAVE_CHAT_LOGS", N_("Save Chat _Log"),
535 "save_chat", NULL, MGROUP_SAFE,
536 NULL, FALSE },
537
538 { "LOCAL_OPTIONS", N_("_Local Client"),
539 "local_options", NULL, MGROUP_SAFE,
540 NULL, FALSE },
541 { "MESSAGE_OPTIONS", N_("_Message"),
542 "message_options", NULL, MGROUP_SAFE,
543 NULL, FALSE },
544 { "SERVER_OPTIONS", N_("_Remote Server"),
545 "server_options", NULL, MGROUP_SAFE,
546 NULL, FALSE },
547 { "SAVE_OPTIONS", N_("Save Options _Now"),
548 "save_options", NULL, MGROUP_SAFE,
549 NULL, FALSE },
550 { "SAVE_OPTIONS_ON_EXIT", N_("Save Options on _Exit"),
551 "save_options_on_exit", NULL, MGROUP_SAFE,
553
554#ifdef FREECIV_DEBUG
555 { "RELOAD_TILESET", N_("_Reload Tileset"),
556 "reload_tileset", "<ctrl><alt>r", MGROUP_SAFE,
557 NULL, FALSE },
558#endif /* FREECIV_DEBUG */
559
560 { "GAME_SAVE", N_("_Save Game"),
561 "game_save", "<ctrl>s", MGROUP_SAFE,
562 NULL, FALSE },
563 { "GAME_SAVE_AS", N_("Save Game _As..."),
564 "game_save_as", NULL, MGROUP_SAFE,
565 NULL, FALSE },
566 { "MAPIMG_SAVE", N_("Save Map _Image"),
567 "save_mapimg", NULL, MGROUP_SAFE,
568 NULL, FALSE },
569 { "MAPIMG_SAVE_AS", N_("Save _Map Image As..."),
570 "save_mapimg_as", NULL, MGROUP_SAFE,
571 NULL, FALSE },
572 { "LEAVE", N_("_Leave"),
573 "leave", NULL, MGROUP_SAFE,
574 NULL, FALSE },
575 { "QUIT", N_("_Quit"),
576 "quit", "<ctrl>q", MGROUP_SAFE,
577 NULL, FALSE },
578
579 /* Edit menu */
580 { "FIND_CITY", N_("_Find City"),
581 "find_city", "<ctrl>f", MGROUP_SAFE,
582 NULL, FALSE },
583 { "WORKLISTS", N_("Work_lists"),
584 "worklists", "<ctrl><shift>l", MGROUP_SAFE,
585 NULL, FALSE },
586 { "RALLY_DLG", N_("Rally point dialog"),
587 "rally_dlg", "<ctrl><shift>r", MGROUP_SAFE,
588 NULL, FALSE },
589 { "INFRA_DLG", N_("Infra dialog"),
590 "infra_dlg", "<ctrl><shift>f", MGROUP_SAFE,
591 NULL, FALSE },
592 { "EDIT_MODE", N_("_Editing Mode"),
593 "edit_mode", "<ctrl>e", MGROUP_SAFE,
595 { "TOGGLE_FOG", N_("Toggle Fog of _War"),
596 "toggle_fog", "<ctrl><shift>w", MGROUP_EDIT,
598 { "SCENARIO_PROPERTIES", N_("Game/Scenario Properties"),
599 "scenario_props", NULL, MGROUP_EDIT,
600 NULL, FALSE },
601 { "SCENARIO_SAVE", N_("Save Scenario"),
602 "scenario_save", NULL, MGROUP_EDIT,
603 NULL, FALSE },
604 { "CLIENT_LUA_SCRIPT", N_("Client _Lua Script"),
605 "lua_script", NULL, MGROUP_SAFE,
606 NULL, FALSE },
607
608 /* View menu */
609 { "SHOW_CITY_OUTLINES", N_("Cit_y Outlines"),
610 "show_city_outlines", "<ctrl>y", MGROUP_SAFE,
612 { "SHOW_CITY_OUTPUT", N_("City Output"),
613 "show_city_output", "<ctrl>v", MGROUP_SAFE,
615 { "SHOW_MAP_GRID", N_("Map _Grid"),
616 "show_map_grid", "<ctrl>g", MGROUP_SAFE,
618 { "SHOW_NAT_BORDERS", N_("National _Borders"),
619 "show_nat_borders", "<ctrl>b", MGROUP_SAFE,
621 { "SHOW_NATIVE_TILES", N_("Native Tiles"),
622 "show_native_tiles", "<ctrl><shift>n", MGROUP_SAFE,
624 { "SHOW_CITY_FULL_BAR", N_("City Full Bar"),
625 "show_city_full_bar", NULL, MGROUP_SAFE,
627 { "SHOW_CITY_NAMES", N_("City _Names"),
628 "show_city_names", "<ctrl>n", MGROUP_SAFE,
630 { "SHOW_CITY_GROWTH", N_("City G_rowth"),
631 "show_city_growth", "<ctrl>o", MGROUP_SAFE,
633 { "SHOW_CITY_PRODUCTIONS", N_("City _Production"),
634 "show_city_productions", "<ctrl>p", MGROUP_SAFE,
636 { "SHOW_CITY_BUY_COST", N_("City Buy Cost"),
637 "show_city_buy_cost", NULL, MGROUP_SAFE,
639 { "SHOW_CITY_TRADE_ROUTES", N_("City Tra_deroutes"),
640 "show_trade_routes", "<ctrl>d", MGROUP_SAFE,
642 { "SHOW_TERRAIN", N_("_Terrain"),
643 "show_terrain", NULL, MGROUP_SAFE,
645 { "SHOW_COASTLINE", N_("C_oastline"),
646 "show_coastline", NULL, MGROUP_SAFE,
648 { "SHOW_PATHS", N_("_Paths"),
649 "show_paths", NULL, MGROUP_SAFE,
651 { "SHOW_IRRIGATION", N_("_Irrigation"),
652 "show_irrigation", NULL, MGROUP_SAFE,
654 { "SHOW_MINES", N_("_Mines"),
655 "show_mines", NULL, MGROUP_SAFE,
657 { "SHOW_BASES", N_("_Bases"),
658 "show_bases", NULL, MGROUP_SAFE,
660 { "SHOW_RESOURCES", N_("_Resources"),
661 "show_resources", NULL, MGROUP_SAFE,
663 { "SHOW_HUTS", N_("_Huts"),
664 "show_huts", NULL, MGROUP_SAFE,
666 { "SHOW_POLLUTION", N_("Po_llution & Fallout"),
667 "show_pollution", NULL, MGROUP_SAFE,
669 { "SHOW_CITIES", N_("Citi_es"),
670 "show_cities", NULL, MGROUP_SAFE,
672 { "SHOW_UNITS", N_("_Units"),
673 "show_units", NULL, MGROUP_SAFE,
675 { "SHOW_UNIT_SOLID_BG", N_("Unit Solid Background"),
676 "show_unit_solid_bg", NULL, MGROUP_SAFE,
678 { "SHOW_UNIT_SHIELDS", N_("Unit shields"),
679 "show_unit_shields", NULL, MGROUP_SAFE,
681 { "SHOW_STACK_SIZE", N_("Unit Stack Size"),
682 "show_stack_size", "<ctrl>plus", MGROUP_SAFE,
684 { "SHOW_FOCUS_UNIT", N_("Focu_s Unit"),
685 "show_focus_unit", NULL, MGROUP_SAFE,
687 { "SHOW_FOG_OF_WAR", N_("Fog of _War"),
688 "show_fow", NULL, MGROUP_SAFE,
690
691 { "FULL_SCREEN", N_("_Fullscreen"),
692 "full_screen", "<ctrl>F11", MGROUP_SAFE,
694 { "CENTER_VIEW", N_("_Center View"),
695 "center_view", "c", MGROUP_PLAYER,
696 NULL, FALSE },
697
698 /* Select menu */
699 { "SELECT_SINGLE", N_("_Single Unit (Unselect Others)"),
700 "select_single", "z", MGROUP_UNIT,
701 NULL, FALSE },
702 { "SELECT_ALL_ON_TILE", N_("_All On Tile"),
703 "select_all_tile", "v", MGROUP_UNIT,
704 NULL, FALSE },
705 { "SELECT_SAME_TYPE_TILE", N_("Same Type on _Tile"),
706 "select_same_type_tile", "<shift>v", MGROUP_UNIT,
707 NULL, FALSE },
708 { "SELECT_SAME_TYPE_CONT", N_("Same Type on _Continent"),
709 "select_same_type_cont", "<shift>c", MGROUP_UNIT,
710 NULL, FALSE },
711 { "SELECT_SAME_TYPE", N_("Same Type _Everywhere"),
712 "select_same_type", "<shift>x", MGROUP_UNIT,
713 NULL, FALSE },
714 { "SELECT_DLG", N_("Unit Selection Dialog"),
715 "select_dlg", NULL, MGROUP_UNIT,
716 NULL, FALSE },
717
718 /* Unit menu */
719 { "UNIT_GOTO", N_("_Go to"),
720 "goto", "g", MGROUP_UNIT,
721 NULL, FALSE },
722 { "UNIT_GOTO_CITY", N_("Go _to/Airlift to City..."),
723 "goto_city", "t", MGROUP_UNIT,
724 NULL, FALSE },
725 { "UNIT_RETURN", N_("_Return to Nearest City"),
726 "return", "<shift>g", MGROUP_UNIT,
727 NULL, FALSE },
728 { "UNIT_EXPLORE", N_("Auto E_xplore"),
729 "explore", "x", MGROUP_UNIT,
730 NULL, FALSE },
731 { "UNIT_PATROL", N_("_Patrol"),
732 "patrol", "q", MGROUP_UNIT,
733 NULL, FALSE },
734 { "UNIT_SENTRY", N_("_Sentry"),
735 "sentry", "s", MGROUP_UNIT,
736 NULL, FALSE },
737 { "UNSENTRY_ALL", N_("Uns_entry All On Tile"),
738 "unsentry_all", "<shift>s", MGROUP_UNIT,
739 NULL, FALSE },
740 { "UNIT_BOARD", N_("_Load"),
741 "board", "l", MGROUP_UNIT,
742 NULL, FALSE },
743 { "UNIT_DEBOARD", N_("_Unload"),
744 "deboard", "u", MGROUP_UNIT,
745 NULL, FALSE },
746 { "UNIT_UNLOAD_TRANSPORTER", N_("U_nload All From Transporter"),
747 "unload_transporter", "<shift>t", MGROUP_UNIT,
748 NULL, FALSE },
749 { "UNIT_HOMECITY", N_("Set _Home City"),
750 "homecity", "h", MGROUP_UNIT,
751 NULL, FALSE },
752 { "UNIT_UPGRADE", N_("Upgr_ade"),
753 "upgrade", "<shift>u", MGROUP_UNIT,
754 NULL, FALSE },
755 { "UNIT_CONVERT", N_("C_onvert"),
756 "convert", "<shift>o", MGROUP_UNIT,
757 NULL, FALSE },
758 { "UNIT_DISBAND", N_("_Disband"),
759 "disband", "<shift>d", MGROUP_UNIT,
760 NULL, FALSE },
761 { "DO_ACTION", N_("_Do..."),
762 "do_action", "d", MGROUP_UNIT,
763 NULL, FALSE },
764 { "UNIT_WAIT", N_("_Wait"),
765 "wait", "w", MGROUP_UNIT,
766 NULL, FALSE },
767 { "UNIT_DONE", N_("_Done"),
768 "done", "space", MGROUP_UNIT,
769 NULL, FALSE },
770
771 /* Work menu */
772 { "BUILD_CITY", N_("_Build City"),
773 "build_city", "b", MGROUP_UNIT,
774 NULL, FALSE },
775 { "AUTO_SETTLER", N_("_Auto Settler"),
776 "auto_settle", "a", MGROUP_UNIT,
777 NULL, FALSE },
778 { "BUILD_ROAD", N_("Build _Road"),
779 "build_road", "r", MGROUP_UNIT,
780 NULL, FALSE },
781 { "BUILD_IRRIGATION", N_("Build _Irrigation"),
782 "build_irrigation", "i", MGROUP_UNIT,
783 NULL, FALSE },
784 { "BUILD_MINE", N_("Build _Mine"),
785 "build_mine", "m", MGROUP_UNIT,
786 NULL, FALSE },
787 { "CULTIVATE", N_("Cultivate"),
788 "cultivate", "<shift>i", MGROUP_UNIT,
789 NULL, FALSE },
790 { "PLANT", N_("Plant"),
791 "plant", "<shift>m", MGROUP_UNIT,
792 NULL, FALSE },
793 { "TRANSFORM_TERRAIN", N_("Transf_orm Terrain"),
794 "transform_terrain", "o", MGROUP_UNIT,
795 NULL, FALSE },
796 { "CONNECT_ROAD", N_("Connect With Roa_d"),
797 "connect_road", "<ctrl>r", MGROUP_UNIT,
798 NULL, FALSE },
799 { "CONNECT_RAIL", N_("Connect With Rai_l"),
800 "connect_rail", "<ctrl>l", MGROUP_UNIT,
801 NULL, FALSE },
802 { "CONNECT_MAGLEV", N_("Connect With _Maglev"),
803 "connect_maglev", "<ctrl>m", MGROUP_UNIT,
804 NULL, FALSE },
805 { "CONNECT_IRRIGATION", N_("Connect With Irri_gation"),
806 "connect_irrigation", "<ctrl>i", MGROUP_UNIT,
807 NULL, FALSE },
808 { "CLEAN", N_("_Clean"),
809 "clean", "p", MGROUP_UNIT,
810 NULL, FALSE },
811
812 /* Combat menu */
813 { "FORTIFY", N_("Fortify"),
814 "fortify", "f", MGROUP_UNIT,
815 NULL, FALSE },
816 { "BUILD_FORTRESS", N_("Build Fortress"),
817 "build_base_fortress", "<shift>f", MGROUP_UNIT,
818 NULL, FALSE },
819 { "BUILD_AIRBASE", N_("Build Airbase"),
820 "build_base_airbase", "<shift>e", MGROUP_UNIT,
821 NULL, FALSE },
822 { "PARADROP", N_("P_aradrop"),
823 "paradrop", "j", MGROUP_UNIT,
824 NULL, FALSE },
825 { "PILLAGE", N_("_Pillage"),
826 "pillage", "<shift>p", MGROUP_UNIT,
827 NULL, FALSE },
828
829 /* Civilization */
830 { "MAP_VIEW", N_("?noun:_View"),
831 "map_view", "F1", MGROUP_SAFE,
832 NULL, FALSE },
833 { "REPORT_UNITS", N_("_Units"),
834 "report_units", "F2", MGROUP_SAFE,
835 NULL, FALSE },
836 { "REPORT_NATIONS", N_("_Nations"),
837 "report_nations", "F3", MGROUP_SAFE,
838 NULL, FALSE },
839 { "REPORT_CITIES", N_("_Cities"),
840 "report_cities", "F4", MGROUP_SAFE,
841 NULL, FALSE },
842 { "REPORT_ECONOMY", N_("_Economy"),
843 "report_economy", "F5", MGROUP_PLAYER,
844 NULL, FALSE },
845 { "REPORT_RESEARCH", N_("_Research"),
846 "report_research", "F6", MGROUP_PLAYER,
847 NULL, FALSE },
848
849 { "TAX_RATES", N_("_Tax Rates..."),
850 "tax_rates", "<ctrl>t", MGROUP_PLAYING,
851 NULL, FALSE },
852 { "POLICIES", N_("_Policies..."),
853 "policies", "<shift><ctrl>p", MGROUP_PLAYER,
854 NULL, FALSE },
855 { "START_REVOLUTION", N_("_Revolution..."),
856 "revolution", "<shift><ctrl>g", MGROUP_PLAYING,
857 NULL, FALSE },
858
859 { "REPORT_WOW", N_("_Wonders of the World"),
860 "report_wow", "F7", MGROUP_SAFE,
861 NULL, FALSE },
862 { "REPORT_TOP_CITIES", N_("Top _Five Cities"),
863 "report_top_cities", "F8", MGROUP_SAFE,
864 NULL, FALSE },
865 { "REPORT_MESSAGES", N_("_Messages"),
866 "report_messages", "F9", MGROUP_SAFE,
867 NULL, FALSE },
868 { "REPORT_DEMOGRAPHIC", N_("_Demographics"),
869 "report_demographics", "F11", MGROUP_SAFE,
870 NULL, FALSE },
871 { "REPORT_SPACESHIP", N_("_Spaceship"),
872 "report_spaceship", "F12", MGROUP_SAFE,
873 NULL, FALSE },
874 { "REPORT_ACHIEVEMENTS", N_("_Achievements"),
875 "report_achievements", "asterisk", MGROUP_SAFE,
876 NULL, FALSE },
877
878 /* Battle Groups menu */
879 /* Note that user view: 1 - 4, internal: 0 - 3 */
880 { "BG_SELECT_1", N_("Select Battle Group 1"),
881 "bg_select_0", "<shift>F1", MGROUP_PLAYING,
882 NULL, FALSE },
883 { "BG_ASSIGN_1", N_("Assign Battle Group 1"),
884 "bg_assign_0", "<ctrl>F1", MGROUP_PLAYING,
885 NULL, FALSE },
886 { "BG_APPEND_1", N_("Append to Battle Group 1"),
887 "bg_append_0", "<shift><ctrl>F1", MGROUP_PLAYING,
888 NULL, FALSE },
889 { "BG_SELECT_2", N_("Select Battle Group 2"),
890 "bg_select_1", "<shift>F2", MGROUP_PLAYING,
891 NULL, FALSE },
892 { "BG_ASSIGN_2", N_("Assign Battle Group 2"),
893 "bg_assign_1", "<ctrl>F2", MGROUP_PLAYING,
894 NULL, FALSE },
895 { "BG_APPEND_2", N_("Append to Battle Group 2"),
896 "bg_append_1", "<shift><ctrl>F2", MGROUP_PLAYING,
897 NULL, FALSE },
898 { "BG_SELECT_3", N_("Select Battle Group 3"),
899 "bg_select_2", "<shift>F3", MGROUP_PLAYING,
900 NULL, FALSE },
901 { "BG_ASSIGN_3", N_("Assign Battle Group 3"),
902 "bg_assign_2", "<ctrl>F3", MGROUP_PLAYING,
903 NULL, FALSE },
904 { "BG_APPEND_3", N_("Append to Battle Group 3"),
905 "bg_append_2", "<shift><ctrl>F3", MGROUP_PLAYING,
906 NULL, FALSE },
907 { "BG_SELECT_4", N_("Select Battle Group 4"),
908 "bg_select_3", "<shift>F4", MGROUP_PLAYING,
909 NULL, FALSE },
910 { "BG_ASSIGN_4", N_("Assign Battle Group 4"),
911 "bg_assign_3", "<ctrl>F4", MGROUP_PLAYING,
912 NULL, FALSE },
913 { "BG_APPEND_4", N_("Append to Battle Group 4"),
914 "bg_append_3", "<shift><ctrl>F4", MGROUP_PLAYING,
915 NULL, FALSE },
916
917 /* Help menu */
918 { "HELP_OVERVIEW", N_("?help:Overview"),
919 "help_overview", NULL, MGROUP_SAFE,
920 NULL, FALSE },
921 { "HELP_PLAYING", N_("Strategy and Tactics"),
922 "help_playing", NULL, MGROUP_SAFE,
923 NULL, FALSE },
924 { "HELP_POLICIES", N_("Policies"),
925 "help_policies", NULL, MGROUP_SAFE,
926 NULL, FALSE },
927 { "HELP_TERRAIN", N_("Terrain"),
928 "help_terrains", NULL, MGROUP_SAFE,
929 NULL, FALSE },
930 { "HELP_ECONOMY", N_("Economy"),
931 "help_economy", NULL, MGROUP_SAFE,
932 NULL, FALSE },
933 { "HELP_CITIES", N_("Cities"),
934 "help_cities", NULL, MGROUP_SAFE,
935 NULL, FALSE },
936 { "HELP_IMPROVEMENTS", N_("City Improvements"),
937 "help_improvements", NULL, MGROUP_SAFE,
938 NULL, FALSE },
939 { "HELP_WONDERS", N_("Wonders of the World"),
940 "help_wonders", NULL, MGROUP_SAFE,
941 NULL, FALSE },
942 { "HELP_UNITS", N_("Units"),
943 "help_units", NULL, MGROUP_SAFE,
944 NULL, FALSE },
945 { "HELP_COMBAT", N_("Combat"),
946 "help_combat", NULL, MGROUP_SAFE,
947 NULL, FALSE },
948 { "HELP_ZOC", N_("Zones of Control"),
949 "help_zoc", NULL, MGROUP_SAFE,
950 NULL, FALSE },
951 { "HELP_GOVERNMENT", N_("Government"),
952 "help_government", NULL, MGROUP_SAFE,
953 NULL, FALSE },
954 { "HELP_DIPLOMACY", N_("Diplomacy"),
955 "help_diplomacy", NULL, MGROUP_SAFE,
956 NULL, FALSE },
957 { "HELP_TECH", N_("Technology"),
958 "help_tech", NULL, MGROUP_SAFE,
959 NULL, FALSE },
960 { "HELP_SPACE_RACE", N_("Space Race"),
961 "help_space_race", NULL, MGROUP_SAFE,
962 NULL, FALSE },
963 { "HELP_RULESET", N_("About Current Ruleset"),
964 "help_ruleset", NULL, MGROUP_SAFE,
965 NULL, FALSE },
966 { "HELP_TILESET", N_("About Current Tileset"),
967 "help_tileset", NULL, MGROUP_SAFE,
968 NULL, FALSE },
969 { "HELP_NATIONS", N_("About Nations"),
970 "help_nations", NULL, MGROUP_SAFE,
971 NULL, FALSE },
972 { "HELP_CONNECTING", N_("Connecting"),
973 "help_connecting", NULL, MGROUP_SAFE,
974 NULL, FALSE },
975 { "HELP_CONTROLS", N_("Controls"),
976 "help_controls", NULL, MGROUP_SAFE,
977 NULL, FALSE },
978 { "HELP_GOVERNOR", N_("Citizen Governor"),
979 "help_governor", NULL, MGROUP_SAFE,
980 NULL, FALSE },
981 { "HELP_CHATLINE", N_("Chatline"),
982 "help_chatline", NULL, MGROUP_SAFE,
983 NULL, FALSE },
984 { "HELP_WORKLIST_EDITOR", N_("Worklist Editor"),
985 "help_worklist_editor", NULL, MGROUP_SAFE,
986 NULL, FALSE },
987 { "HELP_LANGUAGES", N_("Languages"),
988 "help_languages", NULL, MGROUP_SAFE,
989 NULL, FALSE },
990 { "HELP_COPYING", N_("Copying"),
991 "help_copying", NULL, MGROUP_SAFE,
992 NULL, FALSE },
993 { "HELP_ABOUT", N_("About Freeciv"),
994 "help_about", NULL, MGROUP_SAFE,
995 NULL, FALSE },
996 { NULL }
997};
998
999enum {
1029
1030const GActionEntry acts[] = {
1031 { "clear_chat", clear_chat_logs_callback },
1032 { "save_chat", save_chat_logs_callback },
1033 { "local_options", local_options_callback },
1034 { "message_options", message_options_callback },
1035 { "server_options", server_options_callback },
1036 { "save_options", save_options_callback },
1037
1038#ifdef FREECIV_DEBUG
1039 { "reload_tileset", reload_tileset_callback },
1040#endif /* FREECIV_DEBUG */
1041
1042 { "game_save", save_game_callback },
1043 { "game_save_as", save_game_as_callback },
1044 { "save_mapimg", save_mapimg_callback },
1045 { "save_mapimg_as", save_mapimg_as_callback },
1046 { "leave", leave_callback },
1047 { "quit", quit_callback },
1048
1049 { "find_city", find_city_callback },
1050 { "worklists", worklists_callback },
1051 { "rally_dlg", rally_dialog_callback },
1052 { "infra_dlg", infra_dialog_callback },
1053 { "scenario_props", scenario_properties_callback },
1054 { "scenario_save", save_scenario_callback },
1055 { "lua_script", client_lua_script_callback },
1056
1057 { "center_view", center_view_callback },
1058
1059 { "select_single", select_single_callback },
1060 { "select_all_tile", select_all_on_tile_callback },
1061 { "select_same_type_tile", select_same_type_tile_callback },
1062 { "select_same_type_cont", select_same_type_cont_callback },
1063 { "select_same_type", select_same_type_callback },
1064 { "select_dlg", select_dialog_callback },
1065
1066 { "goto", unit_goto_callback },
1067 { "goto_city", unit_goto_city_callback },
1068 { "return", unit_return_callback },
1069 { "explore", unit_explore_callback },
1070 { "patrol", unit_patrol_callback },
1071 { "sentry", unit_sentry_callback },
1072 { "unsentry_all", unsentry_all_callback },
1073 { "board", unit_board_callback },
1074 { "deboard", unit_deboard_callback },
1075 { "unload_transporter", unit_unload_transporter_callback },
1076 { "homecity", unit_homecity_callback },
1077 { "upgrade", unit_upgrade_callback },
1078 { "convert", unit_convert_callback },
1079 { "disband", unit_disband_callback },
1080 { "do_action", do_action_callback },
1081 { "wait", unit_wait_callback },
1082 { "done", unit_done_callback },
1083
1084 { "build_city", build_city_callback },
1085 { "auto_settle", auto_settle_callback },
1086 { "build_road", build_road_callback },
1087 { "build_irrigation", build_irrigation_callback },
1088 { "build_mine", build_mine_callback },
1089 { "cultivate", cultivate_callback },
1090 { "plant", plant_callback },
1091 { "transform_terrain", transform_terrain_callback },
1092 { "connect_road", connect_road_callback },
1093 { "connect_rail", connect_rail_callback },
1094 { "connect_maglev", connect_maglev_callback },
1095 { "connect_irrigation", connect_irrigation_callback },
1096 { "clean", clean_callback },
1097
1098 { "fortify", fortify_callback },
1099 { "build_base_fortress", build_fortress_callback },
1100 { "build_base_airbase", build_airbase_callback },
1101 { "paradrop", paradrop_callback },
1102 { "pillage", pillage_callback },
1103
1104 { "revolution", revolution_callback },
1105
1106 { "map_view", map_view_callback },
1107 { "report_units", report_units_callback },
1108 { "report_nations", report_nations_callback },
1109 { "report_cities", report_cities_callback },
1110 { "report_economy", report_economy_callback },
1111 { "report_research", report_research_callback },
1112 { "tax_rates", tax_rate_callback },
1113 { "policies", multiplier_callback },
1114 { "report_wow", report_wow_callback },
1115 { "report_top_cities", report_top_cities_callback },
1116 { "report_messages", report_messages_callback },
1117 { "report_demographics", report_demographic_callback },
1118 { "report_spaceship", report_spaceship_callback },
1119 { "report_achievements", report_achievements_callback },
1120
1121 { "help_overview", help_overview_callback },
1122 { "help_playing", help_playing_callback },
1123 { "help_policies", help_policies_callback },
1124 { "help_terrains", help_terrain_callback },
1125 { "help_economy", help_economy_callback },
1126 { "help_cities", help_cities_callback },
1127 { "help_improvements", help_improvements_callback },
1128 { "help_wonders", help_wonders_callback },
1129 { "help_units", help_units_callback },
1130 { "help_combat", help_combat_callback },
1131 { "help_zoc", help_zoc_callback },
1132 { "help_government", help_government_callback },
1133 { "help_diplomacy", help_diplomacy_callback },
1134 { "help_tech", help_tech_callback },
1135 { "help_space_race", help_space_race_callback },
1136 { "help_ruleset", help_ruleset_callback },
1137 { "help_tileset", help_tileset_callback },
1138 { "help_nations", help_nations_callback },
1139 { "help_connecting", help_connecting_callback },
1140 { "help_controls", help_controls_callback },
1141 { "help_governor", help_governor_callback },
1142 { "help_chatline", help_chatline_callback },
1143 { "help_worklist_editor", help_worklist_editor_callback },
1144 { "help_languages", help_language_callback },
1145 { "help_copying", help_copying_callback },
1146 { "help_about", help_about_callback }
1147};
1148
1149static struct menu_entry_info *menu_entry_info_find(const char *key);
1150
1151/************************************************************************/
1154static void clear_chat_logs_callback(GSimpleAction *action,
1155 GVariant *parameter,
1156 gpointer data)
1157{
1159}
1160
1161/************************************************************************/
1164static void save_chat_logs_callback(GSimpleAction *action,
1165 GVariant *parameter,
1166 gpointer data)
1167{
1169}
1170
1171/************************************************************************/
1174static void local_options_callback(GSimpleAction *action,
1175 GVariant *parameter,
1176 gpointer data)
1177{
1178 option_dialog_popup(_("Set local options"), client_optset);
1179}
1180
1181/************************************************************************/
1184static void message_options_callback(GSimpleAction *action,
1185 GVariant *parameter,
1186 gpointer data)
1187{
1189}
1190
1191/************************************************************************/
1194static void server_options_callback(GSimpleAction *action,
1195 GVariant *parameter,
1196 gpointer data)
1197{
1198 option_dialog_popup(_("Game Settings"), server_optset);
1199}
1200
1201/************************************************************************/
1204static void save_options_callback(GSimpleAction *action,
1205 GVariant *parameter,
1206 gpointer data)
1207{
1208 options_save(NULL);
1209}
1210
1211/************************************************************************/
1214static void save_options_on_exit_callback(GSimpleAction *action,
1215 GVariant *parameter,
1216 gpointer data)
1217{
1218 struct menu_entry_info *info = (struct menu_entry_info *)data;
1219
1220 info->state ^= 1;
1222
1223 g_menu_remove(options_menu, 4);
1224
1227}
1228
1229#ifdef FREECIV_DEBUG
1230/************************************************************************/
1233static void reload_tileset_callback(GSimpleAction *action,
1234 GVariant *parameter,
1235 gpointer data)
1236{
1237 tilespec_reread(NULL, TRUE, 1.0);
1238}
1239#endif /* FREECIV_DEBUG */
1240
1241/************************************************************************/
1244static void save_game_callback(GSimpleAction *action, GVariant *parameter,
1245 gpointer data)
1246{
1247 send_save_game(NULL);
1248}
1249
1250/************************************************************************/
1253static void save_game_as_callback(GSimpleAction *action, GVariant *parameter,
1254 gpointer data)
1255{
1257}
1258
1259/************************************************************************/
1262static void save_mapimg_callback(GSimpleAction *action, GVariant *parameter,
1263 gpointer data)
1264{
1265 mapimg_client_save(NULL);
1266}
1267
1268/************************************************************************/
1271static void save_mapimg_as_callback(GSimpleAction *action, GVariant *parameter,
1272 gpointer data)
1273{
1275}
1276
1277/************************************************************************/
1281static void leave_local_game_response(GtkWidget *dialog, gint response)
1282{
1283 gtk_window_destroy(GTK_WINDOW(dialog));
1284 if (response == GTK_RESPONSE_OK) {
1285 /* It might be killed already */
1286 if (client.conn.used) {
1287 /* It will also kill the server */
1289 }
1290 }
1291}
1292
1293/************************************************************************/
1296static void leave_callback(GSimpleAction *action,
1297 GVariant *parameter,
1298 gpointer data)
1299{
1300 if (is_server_running()) {
1301 GtkWidget *dialog
1302 = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_WARNING,
1303 GTK_BUTTONS_OK_CANCEL,
1304 _("Leaving a local game will end it!"));
1305 setup_dialog(dialog, toplevel);
1306 g_signal_connect(dialog, "response",
1307 G_CALLBACK(leave_local_game_response), NULL);
1308 gtk_window_present(GTK_WINDOW(dialog));
1309 } else {
1311 }
1312}
1313
1314/************************************************************************/
1317static void quit_callback(GSimpleAction *action,
1318 GVariant *parameter,
1319 gpointer data)
1320{
1322}
1323
1324/************************************************************************/
1327static void find_city_callback(GSimpleAction *action,
1328 GVariant *parameter,
1329 gpointer data)
1330{
1332}
1333
1334/************************************************************************/
1337static void worklists_callback(GSimpleAction *action,
1338 GVariant *parameter,
1339 gpointer data)
1340{
1342}
1343
1344/************************************************************************/
1347static void map_view_callback(GSimpleAction *action,
1348 GVariant *parameter, gpointer data)
1349{
1351}
1352
1353/************************************************************************/
1356static void report_nations_callback(GSimpleAction *action,
1357 GVariant *parameter,
1358 gpointer data)
1359{
1361}
1362
1363/************************************************************************/
1366static void report_wow_callback(GSimpleAction *action,
1367 GVariant *parameter,
1368 gpointer data)
1369{
1371}
1372
1373/************************************************************************/
1376static void report_top_cities_callback(GSimpleAction *action,
1377 GVariant *parameter,
1378 gpointer data)
1379{
1381}
1382
1383/************************************************************************/
1386static void report_messages_callback(GSimpleAction *action,
1387 GVariant *parameter,
1388 gpointer data)
1389{
1391}
1392
1393/************************************************************************/
1396static void client_lua_script_callback(GSimpleAction *action,
1397 GVariant *parameter,
1398 gpointer data)
1399{
1401}
1402
1403/************************************************************************/
1406static void report_demographic_callback(GSimpleAction *action,
1407 GVariant *parameter,
1408 gpointer data)
1409{
1411}
1412
1413/************************************************************************/
1416static void report_achievements_callback(GSimpleAction *action,
1417 GVariant *parameter,
1418 gpointer data)
1419{
1421}
1422
1423/************************************************************************/
1426static void help_overview_callback(GSimpleAction *action,
1427 GVariant *parameter,
1428 gpointer data)
1429{
1431}
1432
1433/************************************************************************/
1436static void help_playing_callback(GSimpleAction *action,
1437 GVariant *parameter,
1438 gpointer data)
1439{
1441}
1442
1443/************************************************************************/
1446static void help_policies_callback(GSimpleAction *action,
1447 GVariant *parameter,
1448 gpointer data)
1449{
1451}
1452
1453/************************************************************************/
1456static void help_terrain_callback(GSimpleAction *action,
1457 GVariant *parameter,
1458 gpointer data)
1459{
1461}
1462
1463/************************************************************************/
1466static void help_economy_callback(GSimpleAction *action,
1467 GVariant *parameter,
1468 gpointer data)
1469{
1471}
1472
1473/************************************************************************/
1476static void help_cities_callback(GSimpleAction *action,
1477 GVariant *parameter,
1478 gpointer data)
1479{
1481}
1482
1483/************************************************************************/
1486static void help_improvements_callback(GSimpleAction *action,
1487 GVariant *parameter,
1488 gpointer data)
1489{
1491}
1492
1493/************************************************************************/
1496static void help_wonders_callback(GSimpleAction *action,
1497 GVariant *parameter,
1498 gpointer data)
1499{
1501}
1502
1503/************************************************************************/
1506static void help_units_callback(GSimpleAction *action,
1507 GVariant *parameter,
1508 gpointer data)
1509{
1511}
1512
1513/************************************************************************/
1516static void help_combat_callback(GSimpleAction *action,
1517 GVariant *parameter,
1518 gpointer data)
1519{
1521}
1522
1523/************************************************************************/
1526static void help_zoc_callback(GSimpleAction *action,
1527 GVariant *parameter,
1528 gpointer data)
1529{
1531}
1532
1533/************************************************************************/
1536static void help_government_callback(GSimpleAction *action,
1537 GVariant *parameter,
1538 gpointer data)
1539{
1541}
1542
1543/************************************************************************/
1546static void help_diplomacy_callback(GSimpleAction *action,
1547 GVariant *parameter,
1548 gpointer data)
1549{
1551}
1552
1553/************************************************************************/
1556static void help_tech_callback(GSimpleAction *action,
1557 GVariant *parameter,
1558 gpointer data)
1559{
1561}
1562
1563/************************************************************************/
1566static void help_space_race_callback(GSimpleAction *action,
1567 GVariant *parameter,
1568 gpointer data)
1569{
1571}
1572
1573/************************************************************************/
1576static void help_ruleset_callback(GSimpleAction *action,
1577 GVariant *parameter,
1578 gpointer data)
1579{
1581}
1582
1583/************************************************************************/
1586static void help_tileset_callback(GSimpleAction *action,
1587 GVariant *parameter,
1588 gpointer data)
1589{
1591}
1592
1593/************************************************************************/
1596static void help_nations_callback(GSimpleAction *action,
1597 GVariant *parameter,
1598 gpointer data)
1599{
1601}
1602
1603/************************************************************************/
1606static void help_connecting_callback(GSimpleAction *action,
1607 GVariant *parameter,
1608 gpointer data)
1609{
1611}
1612
1613/************************************************************************/
1616static void help_controls_callback(GSimpleAction *action,
1617 GVariant *parameter,
1618 gpointer data)
1619{
1621}
1622
1623/************************************************************************/
1626static void help_governor_callback(GSimpleAction *action,
1627 GVariant *parameter,
1628 gpointer data)
1629{
1631}
1632
1633/************************************************************************/
1636static void help_chatline_callback(GSimpleAction *action,
1637 GVariant *parameter,
1638 gpointer data)
1639{
1641}
1642
1643/************************************************************************/
1646static void help_worklist_editor_callback(GSimpleAction *action,
1647 GVariant *parameter,
1648 gpointer data)
1649{
1651}
1652
1653/************************************************************************/
1656static void help_language_callback(GSimpleAction *action,
1657 GVariant *parameter,
1658 gpointer data)
1659{
1661}
1662
1663/************************************************************************/
1666static void help_copying_callback(GSimpleAction *action,
1667 GVariant *parameter,
1668 gpointer data)
1669{
1671}
1672
1673/************************************************************************/
1676static void help_about_callback(GSimpleAction *action,
1677 GVariant *parameter,
1678 gpointer data)
1679{
1681}
1682
1683/************************************************************************/
1686static void edit_mode_callback(GSimpleAction *action,
1687 GVariant *parameter,
1688 gpointer data)
1689{
1691
1692 /* Unreachable techs in reqtree on/off */
1694}
1695
1697 const char *menu_entry;
1698 bool *option;
1700};
1701
1703 { "SAVE_OPTIONS_ON_EXIT", &gui_options.save_options_on_exit, -1 },
1704 { "FULL_SCREEN", &(GUI_GTK_OPTION(fullscreen)), -1 },
1705 { "EDIT_MODE", &game.info.is_edit_mode, -1 },
1706 { "TOGGLE_FOG", NULL, -1 },
1707 { "SHOW_CITY_OUTLINES", &gui_options.draw_city_outlines, VMENU_CITY_OUTLINES },
1708 { "SHOW_CITY_OUTPUT", &gui_options.draw_city_output, VMENU_CITY_OUTPUT },
1709 { "SHOW_MAP_GRID", &gui_options.draw_map_grid, VMENU_MAP_GRID },
1710 { "SHOW_NAT_BORDERS", &gui_options.draw_borders, VMENU_NAT_BORDERS },
1711 { "SHOW_NATIVE_TILES", &gui_options.draw_native, VMENU_NATIVE_TILES },
1712 { "SHOW_CITY_FULL_BAR", &gui_options.draw_full_citybar, VMENU_CITY_FULL_BAR },
1713 { "SHOW_CITY_NAMES", &gui_options.draw_city_names, VMENU_CITY_NAMES },
1714 { "SHOW_CITY_GROWTH", &gui_options.draw_city_growth, VMENU_CITY_GROWTH },
1715 { "SHOW_CITY_PRODUCTIONS", &gui_options.draw_city_productions,
1717 { "SHOW_CITY_BUY_COST", &gui_options.draw_city_buycost, VMENU_CITY_BUY_COST },
1718 { "SHOW_CITY_TRADE_ROUTES", &gui_options.draw_city_trade_routes,
1720 { "SHOW_TERRAIN", &gui_options.draw_terrain, VMENU_TERRAIN },
1721 { "SHOW_COASTLINE", &gui_options.draw_coastline, VMENU_COASTLINE },
1722 { "SHOW_PATHS", &gui_options.draw_roads_rails, VMENU_PATHS },
1723 { "SHOW_IRRIGATION", &gui_options.draw_irrigation, VMENU_IRRIGATION },
1724 { "SHOW_MINES", &gui_options.draw_mines, VMENU_MINES },
1725 { "SHOW_BASES", &gui_options.draw_fortress_airbase, VMENU_BASES },
1726 { "SHOW_RESOURCES", &gui_options.draw_specials, VMENU_RESOURCES },
1727 { "SHOW_HUTS", &gui_options.draw_huts, VMENU_HUTS },
1728 { "SHOW_POLLUTION", &gui_options.draw_pollution, VMENU_POLLUTION },
1729 { "SHOW_CITIES", &gui_options.draw_cities, VMENU_CITIES },
1730 { "SHOW_UNITS", &gui_options.draw_units, VMENU_UNITS },
1731 { "SHOW_UNIT_SOLID_BG", &gui_options.solid_color_behind_units, VMENU_UNIT_SOLID_BG },
1732 { "SHOW_UNIT_SHIELDS", &gui_options.draw_unit_shields , VMENU_UNIT_SHIELDS },
1733 { "SHOW_STACK_SIZE", &gui_options.draw_unit_stack_size, VMENU_STACK_SIZE },
1734 { "SHOW_FOCUS_UNIT", &gui_options.draw_focus_unit, VMENU_FOCUS_UNIT },
1735 { "SHOW_FOG_OF_WAR", &gui_options.draw_fog_of_war, VMENU_FOW },
1736
1737 { NULL, NULL, -1 }
1738};
1739
1740/************************************************************************/
1743static void view_menu_item_toggle(void (*cb)(void),
1744 bool updt_sensitivity,
1745 gpointer data)
1746{
1747 int i;
1748 struct menu_entry_info *info = (struct menu_entry_info *)data;
1749
1750 info->state ^= 1;
1751
1752 cb();
1753
1754 if (updt_sensitivity) {
1755 view_menu_update_sensitivity(G_ACTION_MAP(gui_app()));
1756 }
1757
1758 /* TODO: Make the information available directly from menu_entry_info,
1759 * se we don't need to do this search for it */
1760 for (i = 0; meoms[i].menu_entry != NULL; i++) {
1761 if (!strcmp(meoms[i].menu_entry, info->key)) {
1762 g_menu_remove(view_menu, meoms[i].menu_pos);
1765 return;
1766 }
1767 }
1768}
1769
1770/************************************************************************/
1773static void show_city_outlines_callback(GSimpleAction *action,
1774 GVariant *parameter,
1775 gpointer data)
1776{
1778}
1779
1780/************************************************************************/
1783static void show_city_output_callback(GSimpleAction *action,
1784 GVariant *parameter,
1785 gpointer data)
1786{
1788}
1789
1790/************************************************************************/
1793static void show_map_grid_callback(GSimpleAction *action, GVariant *parameter,
1794 gpointer data)
1795{
1797}
1798
1799/************************************************************************/
1802static void show_national_borders_callback(GSimpleAction *action,
1803 GVariant *parameter,
1804 gpointer data)
1805{
1807}
1808
1809/************************************************************************/
1812static void show_native_tiles_callback(GSimpleAction *action,
1813 GVariant *parameter,
1814 gpointer data)
1815{
1817}
1818
1819/************************************************************************/
1822static void show_city_full_bar_callback(GSimpleAction *action,
1823 GVariant *parameter,
1824 gpointer data)
1825{
1827}
1828
1829/************************************************************************/
1832static void show_city_names_callback(GSimpleAction *action,
1833 GVariant *parameter,
1834 gpointer data)
1835{
1837}
1838
1839/************************************************************************/
1842static void show_city_growth_callback(GSimpleAction *action,
1843 GVariant *parameter,
1844 gpointer data)
1845{
1847}
1848
1849/************************************************************************/
1852static void show_city_productions_callback(GSimpleAction *action,
1853 GVariant *parameter,
1854 gpointer data)
1855{
1857}
1858
1859/************************************************************************/
1862static void show_city_buy_cost_callback(GSimpleAction *action,
1863 GVariant *parameter,
1864 gpointer data)
1865{
1867}
1868
1869/************************************************************************/
1872static void show_city_trade_routes_callback(GSimpleAction *action,
1873 GVariant *parameter,
1874 gpointer data)
1875{
1877}
1878
1879/************************************************************************/
1882static void show_terrain_callback(GSimpleAction *action,
1883 GVariant *parameter,
1884 gpointer data)
1885{
1887}
1888
1889/************************************************************************/
1892static void show_coastline_callback(GSimpleAction *action,
1893 GVariant *parameter,
1894 gpointer data)
1895{
1897}
1898
1899/************************************************************************/
1902static void show_paths_callback(GSimpleAction *action,
1903 GVariant *parameter,
1904 gpointer data)
1905{
1907}
1908
1909/************************************************************************/
1912static void show_irrigation_callback(GSimpleAction *action,
1913 GVariant *parameter,
1914 gpointer data)
1915{
1917}
1918
1919/************************************************************************/
1922static void show_mines_callback(GSimpleAction *action,
1923 GVariant *parameter,
1924 gpointer data)
1925{
1927}
1928
1929/************************************************************************/
1932static void show_bases_callback(GSimpleAction *action, GVariant *parameter,
1933 gpointer data)
1934{
1936}
1937
1938/************************************************************************/
1941static void show_resources_callback(GSimpleAction *action,
1942 GVariant *parameter,
1943 gpointer data)
1944{
1946}
1947
1948/************************************************************************/
1951static void show_huts_callback(GSimpleAction *action, GVariant *parameter,
1952 gpointer data)
1953{
1955}
1956
1957/************************************************************************/
1960static void show_pollution_callback(GSimpleAction *action, GVariant *parameter,
1961 gpointer data)
1962{
1964}
1965
1966/************************************************************************/
1969static void show_cities_callback(GSimpleAction *action, GVariant *parameter,
1970 gpointer data)
1971{
1973}
1974
1975/************************************************************************/
1978static void show_units_callback(GSimpleAction *action, GVariant *parameter,
1979 gpointer data)
1980{
1982}
1983
1984/************************************************************************/
1987static void show_unit_solid_bg_callback(GSimpleAction *action,
1988 GVariant *parameter,
1989 gpointer data)
1990{
1992}
1993
1994/************************************************************************/
1997static void show_unit_shields_callback(GSimpleAction *action,
1998 GVariant *parameter,
1999 gpointer data)
2000{
2002}
2003
2004/************************************************************************/
2007static void show_stack_size_callback(GSimpleAction *action,
2008 GVariant *parameter,
2009 gpointer data)
2010{
2012}
2013
2014/************************************************************************/
2017static void show_focus_unit_callback(GSimpleAction *action,
2018 GVariant *parameter,
2019 gpointer data)
2020{
2022}
2023
2024/************************************************************************/
2027static void show_fog_of_war_callback(GSimpleAction *action, GVariant *parameter,
2028 gpointer data)
2029{
2031}
2032
2033/************************************************************************/
2036static void full_screen_callback(GSimpleAction *action, GVariant *parameter,
2037 gpointer data)
2038{
2039 struct menu_entry_info *info = (struct menu_entry_info *)data;
2040
2041 info->state ^= 1;
2042 GUI_GTK_OPTION(fullscreen) = info->state;
2043
2045
2046 g_menu_remove(view_menu, VMENU_FULL_SCREEN);
2047
2050}
2051
2052/************************************************************************/
2055static void toggle_fog_callback(GSimpleAction *action,
2056 GVariant *parameter,
2057 gpointer data)
2058{
2059 struct menu_entry_info *info = (struct menu_entry_info *)data;
2060
2061 info->state ^= 1; /* We can only hope that client and server are in sync.
2062 * TODO: Make sure they are. */
2064
2065 g_menu_remove(edit_menu, 5);
2066
2069}
2070
2071/************************************************************************/
2074static void scenario_properties_callback(GSimpleAction *action,
2075 GVariant *parameter,
2076 gpointer data)
2077{
2078 struct property_editor *pe;
2079
2083}
2084
2085/************************************************************************/
2088static void save_scenario_callback(GSimpleAction *action, GVariant *parameter,
2089 gpointer data)
2090{
2092}
2093
2094/************************************************************************/
2097static void select_single_callback(GSimpleAction *action, GVariant *parameter,
2098 gpointer data)
2099{
2100 request_unit_select(get_units_in_focus(), SELTYPE_SINGLE, SELLOC_TILE);
2101}
2102
2103/************************************************************************/
2106static void select_all_on_tile_callback(GSimpleAction *action,
2107 GVariant *parameter,
2108 gpointer data)
2109{
2110 request_unit_select(get_units_in_focus(), SELTYPE_ALL, SELLOC_TILE);
2111}
2112
2113/************************************************************************/
2116static void select_same_type_tile_callback(GSimpleAction *action,
2117 GVariant *parameter,
2118 gpointer data)
2119{
2120 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
2121}
2122
2123/************************************************************************/
2126static void select_same_type_cont_callback(GSimpleAction *action,
2127 GVariant *parameter,
2128 gpointer data)
2129{
2130 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_CONT);
2131}
2132
2133/************************************************************************/
2136static void select_same_type_callback(GSimpleAction *action,
2137 GVariant *parameter,
2138 gpointer data)
2139{
2140 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_WORLD);
2141}
2142
2143/************************************************************************/
2146static void select_dialog_callback(GSimpleAction *action,
2147 GVariant *parameter,
2148 gpointer data)
2149{
2151}
2152
2153/************************************************************************/
2156static void rally_dialog_callback(GSimpleAction *action,
2157 GVariant *parameter,
2158 gpointer data)
2159{
2161}
2162
2163/************************************************************************/
2166static void infra_dialog_callback(GSimpleAction *action,
2167 GVariant *parameter,
2168 gpointer data)
2169{
2171}
2172
2173/************************************************************************/
2176static void unit_wait_callback(GSimpleAction *action,
2177 GVariant *parameter,
2178 gpointer data)
2179{
2180 key_unit_wait();
2181}
2182
2183/************************************************************************/
2186static void unit_done_callback(GSimpleAction *action,
2187 GVariant *parameter,
2188 gpointer data)
2189{
2190 key_unit_done();
2191}
2192
2193/************************************************************************/
2196static void unit_goto_callback(GSimpleAction *action, GVariant *parameter,
2197 gpointer data)
2198{
2199 key_unit_goto();
2200}
2201
2202/************************************************************************/
2205static void unit_goto_and_callback(GSimpleAction *action,
2206 GVariant *parameter,
2207 gpointer data)
2208{
2209 int sub_target = NO_TARGET;
2210 struct action *paction = (struct action *)data;
2211
2212 fc_assert_ret(paction != NULL);
2213
2214 switch (action_get_sub_target_kind(paction)) {
2215 case ASTK_BUILDING:
2216 {
2217 struct impr_type *pbuilding = g_object_get_data(G_OBJECT(action),
2218 "end_building");
2219 fc_assert_ret(pbuilding != NULL);
2220 sub_target = improvement_number(pbuilding);
2221 }
2222 break;
2223 case ASTK_TECH:
2224 {
2225 struct advance *ptech = g_object_get_data(G_OBJECT(action),
2226 "end_tech");
2227 fc_assert_ret(ptech != NULL);
2228 sub_target = advance_number(ptech);
2229 }
2230 break;
2231 case ASTK_EXTRA:
2232 case ASTK_EXTRA_NOT_THERE:
2233 {
2234 struct extra_type *pextra = g_object_get_data(G_OBJECT(action),
2235 "end_extra");
2236 fc_assert_ret(pextra != NULL);
2237 sub_target = extra_number(pextra);
2238 }
2239 break;
2240 case ASTK_NONE:
2241 sub_target = NO_TARGET;
2242 break;
2243 case ASTK_COUNT:
2244 /* Should not exits */
2245 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
2246 break;
2247 }
2248
2249 request_unit_goto(ORDER_PERFORM_ACTION, paction->id, sub_target);
2250}
2251
2252/************************************************************************/
2255static void unit_goto_city_callback(GSimpleAction *action,
2256 GVariant *parameter,
2257 gpointer data)
2258{
2259 if (get_num_units_in_focus() > 0) {
2261 }
2262}
2263
2264/************************************************************************/
2267static void unit_return_callback(GSimpleAction *action,
2268 GVariant *parameter,
2269 gpointer data)
2270{
2274}
2275
2276/************************************************************************/
2279static void unit_explore_callback(GSimpleAction *action,
2280 GVariant *parameter,
2281 gpointer data)
2282{
2284}
2285
2286/************************************************************************/
2289static void unit_patrol_callback(GSimpleAction *action, GVariant *parameter,
2290 gpointer data)
2291{
2293}
2294
2295/************************************************************************/
2298static void unit_sentry_callback(GSimpleAction *action,
2299 GVariant *parameter,
2300 gpointer data)
2301{
2303}
2304
2305/************************************************************************/
2308static void unsentry_all_callback(GSimpleAction *action,
2309 GVariant *parameter,
2310 gpointer data)
2311{
2313}
2314
2315/************************************************************************/
2318static void fortify_callback(GSimpleAction *action,
2319 GVariant *parameter,
2320 gpointer data)
2321{
2325}
2326
2327/************************************************************************/
2330static void unit_board_callback(GSimpleAction *action, GVariant *parameter,
2331 gpointer data)
2332{
2336}
2337
2338/************************************************************************/
2341static void unit_deboard_callback(GSimpleAction *action, GVariant *parameter,
2342 gpointer data)
2343{
2347}
2348
2349/************************************************************************/
2352static void unit_unload_transporter_callback(GSimpleAction *action,
2353 GVariant *parameter,
2354 gpointer data)
2355{
2357}
2358
2359/************************************************************************/
2362static void unit_homecity_callback(GSimpleAction *action,
2363 GVariant *parameter,
2364 gpointer data)
2365{
2367}
2368
2369/************************************************************************/
2372static void unit_upgrade_callback(GSimpleAction *action,
2373 GVariant *parameter,
2374 gpointer data)
2375{
2377}
2378
2379/************************************************************************/
2382static void unit_convert_callback(GSimpleAction *action,
2383 GVariant *parameter,
2384 gpointer data)
2385{
2387}
2388
2389/************************************************************************/
2392static void unit_disband_callback(GSimpleAction *action,
2393 GVariant *parameter,
2394 gpointer data)
2395{
2397}
2398
2399/************************************************************************/
2402static void build_city_callback(GSimpleAction *action,
2403 GVariant *parameter,
2404 gpointer data)
2405{
2407 /* FIXME: this can provide different items for different units...
2408 * not good! */
2409 /* Enable the button for adding to a city in all cases, so we
2410 get an eventual error message from the server if we try. */
2414 ACTION_HELP_WONDER)) {
2415 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
2416 }
2418}
2419
2420/************************************************************************/
2423static void auto_settle_callback(GSimpleAction *action,
2424 GVariant *parameter,
2425 gpointer data)
2426{
2428}
2429
2430/************************************************************************/
2433static void build_road_callback(GSimpleAction *action,
2434 GVariant *parameter,
2435 gpointer data)
2436{
2438 /* FIXME: this can provide different actions for different units...
2439 * not good! */
2441 EC_ROAD,
2443 punit);
2444 bool building_road = FALSE;
2445
2446 if (tgt != NULL
2447 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD, tgt)) {
2448 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, tgt);
2449 building_road = TRUE;
2450 }
2451
2452 if (!building_road && unit_can_est_trade_route_here(punit)) {
2453 request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
2454 }
2456}
2457
2458/************************************************************************/
2461static void build_irrigation_callback(GSimpleAction *action,
2462 GVariant *parameter,
2463 gpointer data)
2464{
2466}
2467
2468/************************************************************************/
2471static void cultivate_callback(GSimpleAction *action,
2472 GVariant *parameter,
2473 gpointer data)
2474{
2476}
2477
2478/************************************************************************/
2481static void plant_callback(GSimpleAction *action,
2482 GVariant *parameter,
2483 gpointer data)
2484{
2486}
2487
2488/************************************************************************/
2491static void build_mine_callback(GSimpleAction *action,
2492 GVariant *parameter,
2493 gpointer data)
2494{
2495 key_unit_mine();
2496}
2497
2498/************************************************************************/
2501static void connect_road_callback(GSimpleAction *action,
2502 GVariant *parameter,
2503 gpointer data)
2504{
2505 struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
2506
2507 if (proad != NULL) {
2508 struct extra_type *tgt;
2509
2510 tgt = road_extra_get(proad);
2511
2512 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2513 }
2514}
2515
2516/************************************************************************/
2519static void connect_rail_callback(GSimpleAction *action,
2520 GVariant *parameter,
2521 gpointer data)
2522{
2523 struct road_type *prail = road_by_gui_type(ROAD_GUI_RAILROAD);
2524
2525 if (prail != NULL) {
2526 struct extra_type *tgt;
2527
2528 tgt = road_extra_get(prail);
2529
2530 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2531 }
2532}
2533
2534/************************************************************************/
2537static void connect_maglev_callback(GSimpleAction *action,
2538 GVariant *parameter,
2539 gpointer data)
2540{
2541 struct road_type *pmaglev = road_by_gui_type(ROAD_GUI_MAGLEV);
2542
2543 if (pmaglev != NULL) {
2544 struct extra_type *tgt;
2545
2546 tgt = road_extra_get(pmaglev);
2547
2548 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2549 }
2550}
2551
2552/************************************************************************/
2555static void connect_irrigation_callback(GSimpleAction *action,
2556 GVariant *parameter,
2557 gpointer data)
2558{
2559 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
2560
2561 if (extra_type_list_size(extras) > 0) {
2562 struct extra_type *pextra;
2563
2564 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
2565
2566 key_unit_connect(ACTIVITY_IRRIGATE, pextra);
2567 }
2568}
2569
2570/************************************************************************/
2573static void transform_terrain_callback(GSimpleAction *action,
2574 GVariant *parameter,
2575 gpointer data)
2576{
2578}
2579
2580/************************************************************************/
2583static void clean_callback(GSimpleAction *action, GVariant *parameter,
2584 gpointer data)
2585{
2587}
2588
2589/************************************************************************/
2592static void build_fortress_callback(GSimpleAction *action, GVariant *parameter,
2593 gpointer data)
2594{
2596}
2597
2598/************************************************************************/
2601static void build_airbase_callback(GSimpleAction *action, GVariant *parameter,
2602 gpointer data)
2603{
2605}
2606
2607/************************************************************************/
2610static void paradrop_callback(GSimpleAction *action,
2611 GVariant *parameter,
2612 gpointer data)
2613{
2615}
2616
2617/************************************************************************/
2620static void pillage_callback(GSimpleAction *action,
2621 GVariant *parameter,
2622 gpointer data)
2623{
2625}
2626
2627/************************************************************************/
2630static void do_action_callback(GSimpleAction *action,
2631 GVariant *parameter,
2632 gpointer data)
2633{
2635}
2636
2637/************************************************************************/
2640static void tax_rate_callback(GSimpleAction *action, GVariant *parameter,
2641 gpointer data)
2642{
2644}
2645
2646/************************************************************************/
2649static void multiplier_callback(GSimpleAction *action, GVariant *parameter,
2650 gpointer data)
2651{
2653}
2654
2655/************************************************************************/
2658static void government_callback(GSimpleAction *action,
2659 GVariant *parameter,
2660 gpointer data)
2661{
2663}
2664
2665/************************************************************************/
2668static void revolution_callback(GSimpleAction *action,
2669 GVariant *parameter,
2670 gpointer data)
2671{
2673}
2674
2675/************************************************************************/
2678static void base_callback(GSimpleAction *action,
2679 GVariant *parameter,
2680 gpointer data)
2681{
2682 struct extra_type *pextra = data;
2683
2685 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
2687}
2688
2689/************************************************************************/
2692static void road_callback(GSimpleAction *action,
2693 GVariant *parameter,
2694 gpointer data)
2695{
2696 struct extra_type *pextra = data;
2697
2699 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD,
2700 pextra);
2702}
2703
2704/************************************************************************/
2707static void irrigation_callback(GSimpleAction *action,
2708 GVariant *parameter,
2709 gpointer data)
2710{
2711 struct extra_type *pextra = data;
2712
2714 request_new_unit_activity_targeted(punit, ACTIVITY_IRRIGATE,
2715 pextra);
2717}
2718
2719/************************************************************************/
2722static void mine_callback(GSimpleAction *action,
2723 GVariant *parameter,
2724 gpointer data)
2725{
2726 struct extra_type *pextra = data;
2727
2730 pextra);
2732}
2733
2734/************************************************************************/
2737static void clean_menu_callback(GSimpleAction *action,
2738 GVariant *parameter,
2739 gpointer data)
2740{
2741 struct extra_type *pextra = data;
2742
2744 if (can_unit_do_activity_targeted_client(punit, ACTIVITY_POLLUTION, pextra)) {
2745 request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION,
2746 pextra);
2747 } else {
2748 request_new_unit_activity_targeted(punit, ACTIVITY_FALLOUT,
2749 pextra);
2750 }
2752}
2753
2754/************************************************************************/
2757static void center_view_callback(GSimpleAction *action,
2758 GVariant *parameter,
2759 gpointer data)
2760{
2762}
2763
2764/************************************************************************/
2767static void report_units_callback(GSimpleAction *action,
2768 GVariant *parameter,
2769 gpointer data)
2770{
2772}
2773
2774/************************************************************************/
2777static void report_cities_callback(GSimpleAction *action,
2778 GVariant *parameter,
2779 gpointer data)
2780
2781{
2783}
2784
2785/************************************************************************/
2788static void report_economy_callback(GSimpleAction *action,
2789 GVariant *parameter,
2790 gpointer data)
2791{
2793}
2794
2795/************************************************************************/
2798static void report_research_callback(GSimpleAction *action,
2799 GVariant *parameter,
2800 gpointer data)
2801{
2803}
2804
2805/************************************************************************/
2808static void report_spaceship_callback(GSimpleAction *action,
2809 GVariant *parameter,
2810 gpointer data)
2811{
2812 if (NULL != client.conn.playing) {
2814 }
2815}
2816
2817/************************************************************************/
2820static void bg_select_callback(GSimpleAction *action,
2821 GVariant *parameter,
2822 gpointer data)
2823{
2824 key_unit_select_battlegroup(GPOINTER_TO_INT(data), FALSE);
2825}
2826
2827/************************************************************************/
2830static void bg_assign_callback(GSimpleAction *action,
2831 GVariant *parameter,
2832 gpointer data)
2833{
2834 key_unit_assign_battlegroup(GPOINTER_TO_INT(data), FALSE);
2835}
2836
2837/************************************************************************/
2840static void bg_append_callback(GSimpleAction *action,
2841 GVariant *parameter,
2842 gpointer data)
2843{
2844 key_unit_assign_battlegroup(GPOINTER_TO_INT(data), TRUE);
2845}
2846
2847/************************************************************************/
2851static GMenuItem *create_toggle_menu_item(struct menu_entry_info *info)
2852{
2853 char actname[150];
2854 GMenuItem *item;
2855
2856 fc_snprintf(actname, sizeof(actname), "app.%s(%s)",
2857 info->action, info->state ? "true" : "false");
2858 item = g_menu_item_new(Q_(info->name), NULL);
2859 g_menu_item_set_detailed_action(item, actname);
2860
2861 if (info->accl != NULL) {
2862 const char *accls[2] = { info->accl, NULL };
2863
2864 gtk_application_set_accels_for_action(gui_app(), actname, accls);
2865 }
2866
2867 return item;
2868}
2869
2870/************************************************************************/
2874static GMenuItem *create_toggle_menu_item_for_key(const char *key)
2875{
2877}
2878
2879/************************************************************************/
2882static void menu_entry_init(GMenu *sub, const char *key)
2883{
2885
2886 if (info != NULL) {
2887 GMenuItem *item;
2888
2889 if (info->toggle != NULL) {
2891 } else {
2892 char actname[150];
2893
2894 fc_snprintf(actname, sizeof(actname), "app.%s", info->action);
2895 item = g_menu_item_new(Q_(info->name), actname);
2896 }
2897
2898 /* Should be menu_item_append_unref()? */
2899 g_menu_append_item(sub, item);
2900 g_object_unref(item);
2901 }
2902}
2903
2904/************************************************************************/
2908{
2909 int i;
2910
2911 for (i = 0; meoms[i].menu_entry != NULL; i++) {
2912 struct menu_entry_info *info = menu_entry_info_find(meoms[i].menu_entry);
2913
2914 if (meoms[i].option != NULL) {
2915 info->state = *meoms[i].option;
2916 } else {
2917 info->state = FALSE; /* Best guess we have */
2918 }
2919 }
2920}
2921
2922/************************************************************************/
2925static void setup_app_actions(GApplication *fc_app)
2926{
2927 int i;
2928 GVariantType *bvart = g_variant_type_new("b");
2929
2930 /* Simple entries */
2931 g_action_map_add_action_entries(G_ACTION_MAP(fc_app), acts,
2932 G_N_ELEMENTS(acts), fc_app);
2933
2934 /* Toggles */
2935 for (i = 0; menu_entries[i].key != NULL; i++) {
2936 if (menu_entries[i].toggle != NULL) {
2937 GSimpleAction *act;
2938 GVariant *var = g_variant_new("b", TRUE);
2939
2940 act = g_simple_action_new_stateful(menu_entries[i].action, bvart, var);
2941 g_action_map_add_action(G_ACTION_MAP(fc_app), G_ACTION(act));
2942 g_signal_connect(act, "change-state",
2943 G_CALLBACK(menu_entries[i].toggle),
2944 (gpointer)&(menu_entries[i]));
2945 }
2946 }
2947
2948 g_variant_type_free(bvart);
2949
2950 for (i = 0; menu_entries[i].key != NULL; i++) {
2951 if (menu_entries[i].accl != NULL && menu_entries[i].toggle == NULL) {
2952 const char *accls[2] = { menu_entries[i].accl, NULL };
2953 char actname[150];
2954
2955 fc_snprintf(actname, sizeof(actname), "app.%s", menu_entries[i].action);
2956
2957 gtk_application_set_accels_for_action(GTK_APPLICATION(fc_app), actname, accls);
2958 }
2959 }
2960}
2961
2962/************************************************************************/
2965static void register_bg_actions(GActionMap *map, int bg)
2966{
2967 GSimpleAction *act;
2968 char actname[256];
2969
2970 fc_snprintf(actname, sizeof(actname), "bg_select_%d", bg);
2971 act = g_simple_action_new(actname, NULL);
2972 g_action_map_add_action(map, G_ACTION(act));
2973 g_signal_connect(act, "activate",
2974 G_CALLBACK(bg_select_callback), GINT_TO_POINTER(bg));
2975
2976 fc_snprintf(actname, sizeof(actname), "bg_assign_%d", bg);
2977 act = g_simple_action_new(actname, NULL);
2978 g_action_map_add_action(map, G_ACTION(act));
2979 g_signal_connect(act, "activate",
2980 G_CALLBACK(bg_assign_callback), GINT_TO_POINTER(bg));
2981
2982 fc_snprintf(actname, sizeof(actname), "bg_append_%d", bg);
2983 act = g_simple_action_new(actname, NULL);
2984 g_action_map_add_action(map, G_ACTION(act));
2985 g_signal_connect(act, "activate",
2986 G_CALLBACK(bg_append_callback), GINT_TO_POINTER(bg));
2987}
2988
2989/************************************************************************/
2992static GMenu *setup_menus(GtkApplication *app)
2993{
2994 GMenu *menubar;
2995 GMenu *topmenu;
2996 GMenu *submenu;
2997 int i;
2998
3000
3001 menubar = g_menu_new();
3002
3003 topmenu = g_menu_new();
3004 menu_entry_init(topmenu, "CLEAR_CHAT_LOGS");
3005 menu_entry_init(topmenu, "SAVE_CHAT_LOGS");
3006
3007 options_menu = g_menu_new();
3008 menu_entry_init(options_menu, "LOCAL_OPTIONS");
3009 menu_entry_init(options_menu, "MESSAGE_OPTIONS");
3010 menu_entry_init(options_menu, "SERVER_OPTIONS");
3011 menu_entry_init(options_menu, "SAVE_OPTIONS");
3012 menu_entry_init(options_menu, "SAVE_OPTIONS_ON_EXIT");
3013
3014 submenu_append_unref(topmenu, _("_Options"), G_MENU_MODEL(options_menu));
3015
3016#ifdef FREECIV_DEBUG
3017 menu_entry_init(topmenu, "RELOAD_TILESET");
3018#endif /* FREECIV_DEBUG */
3019
3020 menu_entry_init(topmenu, "GAME_SAVE");
3021 menu_entry_init(topmenu, "GAME_SAVE_AS");
3022 menu_entry_init(topmenu, "MAPIMG_SAVE");
3023 menu_entry_init(topmenu, "MAPIMG_SAVE_AS");
3024 menu_entry_init(topmenu, "LEAVE");
3025 menu_entry_init(topmenu, "QUIT");
3026
3027 submenu_append_unref(menubar, _("_Game"), G_MENU_MODEL(topmenu));
3028
3029 edit_menu = g_menu_new();
3030
3031 menu_entry_init(edit_menu, "FIND_CITY");
3032 menu_entry_init(edit_menu, "WORKLISTS");
3033 menu_entry_init(edit_menu, "RALLY_DLG");
3034 menu_entry_init(edit_menu, "INFRA_DLG");
3035 menu_entry_init(edit_menu, "EDIT_MODE");
3036 menu_entry_init(edit_menu, "TOGGLE_FOG");
3037 menu_entry_init(edit_menu, "SCENARIO_PROPERTIES");
3038 menu_entry_init(edit_menu, "SCENARIO_SAVE");
3039 menu_entry_init(edit_menu, "CLIENT_LUA_SCRIPT");
3040
3041 submenu_append_unref(menubar, _("_Edit"), G_MENU_MODEL(edit_menu));
3042
3043 view_menu = g_menu_new();
3044
3045 menu_entry_init(view_menu, "SHOW_CITY_OUTLINES");
3046 menu_entry_init(view_menu, "SHOW_CITY_OUTPUT");
3047 menu_entry_init(view_menu, "SHOW_MAP_GRID");
3048 menu_entry_init(view_menu, "SHOW_NAT_BORDERS");
3049 menu_entry_init(view_menu, "SHOW_NATIVE_TILES");
3050 menu_entry_init(view_menu, "SHOW_CITY_FULL_BAR");
3051 menu_entry_init(view_menu, "SHOW_CITY_NAMES");
3052 menu_entry_init(view_menu, "SHOW_CITY_GROWTH");
3053 menu_entry_init(view_menu, "SHOW_CITY_PRODUCTIONS");
3054 menu_entry_init(view_menu, "SHOW_CITY_BUY_COST");
3055 menu_entry_init(view_menu, "SHOW_CITY_TRADE_ROUTES");
3056 menu_entry_init(view_menu, "SHOW_TERRAIN");
3057 menu_entry_init(view_menu, "SHOW_COASTLINE");
3058 menu_entry_init(view_menu, "SHOW_PATHS");
3059 menu_entry_init(view_menu, "SHOW_IRRIGATION");
3060 menu_entry_init(view_menu, "SHOW_MINES");
3061 menu_entry_init(view_menu, "SHOW_BASES");
3062 menu_entry_init(view_menu, "SHOW_RESOURCES");
3063 menu_entry_init(view_menu, "SHOW_HUTS");
3064 menu_entry_init(view_menu, "SHOW_POLLUTION");
3065 menu_entry_init(view_menu, "SHOW_CITIES");
3066 menu_entry_init(view_menu, "SHOW_UNITS");
3067 menu_entry_init(view_menu, "SHOW_UNIT_SOLID_BG");
3068 menu_entry_init(view_menu, "SHOW_UNIT_SHIELDS");
3069 menu_entry_init(view_menu, "SHOW_STACK_SIZE");
3070 menu_entry_init(view_menu, "SHOW_FOCUS_UNIT");
3071
3072 menu_entry_init(view_menu, "SHOW_FOG_OF_WAR");
3073
3074 menu_entry_init(view_menu, "FULL_SCREEN");
3075 menu_entry_init(view_menu, "CENTER_VIEW");
3076
3077 submenu_append_unref(menubar, Q_("?verb:_View"), G_MENU_MODEL(view_menu));
3078
3079 topmenu = g_menu_new();
3080
3081 menu_entry_init(topmenu, "SELECT_SINGLE");
3082 menu_entry_init(topmenu, "SELECT_ALL_ON_TILE");
3083 menu_entry_init(topmenu, "SELECT_SAME_TYPE_TILE");
3084 menu_entry_init(topmenu, "SELECT_SAME_TYPE_CONT");
3085 menu_entry_init(topmenu, "SELECT_SAME_TYPE");
3086 menu_entry_init(topmenu, "SELECT_DLG");
3087
3088 submenu_append_unref(menubar, _("_Select"), G_MENU_MODEL(topmenu));
3089
3090 unit_menu = g_menu_new();
3091
3092 menu_entry_init(unit_menu, "UNIT_GOTO");
3093
3094 /* Placeholder submenu (so that menu update has something to replace) */
3095 submenu = g_menu_new();
3096 submenu_append_unref(unit_menu, N_("Go to a_nd..."), G_MENU_MODEL(submenu));
3097
3098 menu_entry_init(unit_menu, "UNIT_GOTO_CITY");
3099 menu_entry_init(unit_menu, "UNIT_RETURN");
3100 menu_entry_init(unit_menu, "UNIT_EXPLORE");
3101 menu_entry_init(unit_menu, "UNIT_PATROL");
3102 menu_entry_init(unit_menu, "UNIT_SENTRY");
3103 menu_entry_init(unit_menu, "UNSENTRY_ALL");
3104 menu_entry_init(unit_menu, "UNIT_BOARD");
3105 menu_entry_init(unit_menu, "UNIT_DEBOARD");
3106 menu_entry_init(unit_menu, "UNIT_UNLOAD_TRANSPORTER");
3107 menu_entry_init(unit_menu, "UNIT_HOMECITY");
3108 menu_entry_init(unit_menu, "UNIT_UPGRADE");
3109 menu_entry_init(unit_menu, "UNIT_CONVERT");
3110 menu_entry_init(unit_menu, "UNIT_DISBAND");
3111 menu_entry_init(unit_menu, "DO_ACTION");
3112 menu_entry_init(unit_menu, "UNIT_WAIT");
3113 menu_entry_init(unit_menu, "UNIT_DONE");
3114
3115 submenu_append_unref(menubar, _("_Unit"), G_MENU_MODEL(unit_menu));
3116
3117 work_menu = g_menu_new();
3118 menu_entry_init(work_menu, "BUILD_CITY");
3119 menu_entry_init(work_menu, "AUTO_SETTLER");
3120
3121 /* Placeholder submenus (so that menu update has something to replace) */
3122 submenu = g_menu_new();
3123 submenu_append_unref(work_menu, _("Build _Path"), G_MENU_MODEL(submenu));
3124 submenu = g_menu_new();
3125 submenu_append_unref(work_menu, _("Build _Irrigation"), G_MENU_MODEL(submenu));
3126 submenu = g_menu_new();
3127 submenu_append_unref(work_menu, _("Build _Mine"), G_MENU_MODEL(submenu));
3128 submenu = g_menu_new();
3129 submenu_append_unref(work_menu, _("_Clean Nuisance"), G_MENU_MODEL(submenu));
3130
3131 menu_entry_init(work_menu, "BUILD_ROAD");
3132 menu_entry_init(work_menu, "BUILD_IRRIGATION");
3133 menu_entry_init(work_menu, "BUILD_MINE");
3134 menu_entry_init(work_menu, "CULTIVATE");
3135 menu_entry_init(work_menu, "PLANT");
3136 menu_entry_init(work_menu, "TRANSFORM_TERRAIN");
3137 menu_entry_init(work_menu, "CONNECT_ROAD");
3138 menu_entry_init(work_menu, "CONNECT_RAIL");
3139 menu_entry_init(work_menu, "CONNECT_MAGLEV");
3140 menu_entry_init(work_menu, "CONNECT_IRRIGATION");
3141 menu_entry_init(work_menu, "CLEAN");
3142
3143 submenu_append_unref(menubar, _("_Work"), G_MENU_MODEL(work_menu));
3144
3145 combat_menu = g_menu_new();
3146 menu_entry_init(combat_menu, "FORTIFY");
3147 menu_entry_init(combat_menu, "BUILD_FORTRESS");
3148 menu_entry_init(combat_menu, "BUILD_AIRBASE");
3149
3150 /* Placeholder submenu (so that menu update has something to replace) */
3151 submenu = g_menu_new();
3152 submenu_append_unref(combat_menu, _("Build _Base"), G_MENU_MODEL(submenu));
3153
3154 submenu_append_unref(menubar, _("_Combat"), G_MENU_MODEL(combat_menu));
3155
3156 menu_entry_init(combat_menu, "PARADROP");
3157 menu_entry_init(combat_menu, "PILLAGE");
3158
3159 gov_menu = g_menu_new();
3160
3161 menu_entry_init(gov_menu, "MAP_VIEW");
3162 menu_entry_init(gov_menu, "REPORT_UNITS");
3163 menu_entry_init(gov_menu, "REPORT_NATIONS");
3164 menu_entry_init(gov_menu, "REPORT_CITIES");
3165 menu_entry_init(gov_menu, "REPORT_ECONOMY");
3166 menu_entry_init(gov_menu, "REPORT_RESEARCH");
3167 menu_entry_init(gov_menu, "TAX_RATES");
3168 menu_entry_init(gov_menu, "POLICIES");
3169
3170 /* Placeholder submenu (so that menu update has something to replace) */
3171 submenu = g_menu_new();
3172 submenu_append_unref(gov_menu, _("_Government"), G_MENU_MODEL(submenu));
3173
3174 menu_entry_init(gov_menu, "REPORT_WOW");
3175 menu_entry_init(gov_menu, "REPORT_TOP_CITIES");
3176 menu_entry_init(gov_menu, "REPORT_MESSAGES");
3177 menu_entry_init(gov_menu, "REPORT_DEMOGRAPHIC");
3178 menu_entry_init(gov_menu, "REPORT_SPACESHIP");
3179 menu_entry_init(gov_menu, "REPORT_ACHIEVEMENTS");
3180
3181 submenu_append_unref(menubar, _("C_ivilization"), G_MENU_MODEL(gov_menu));
3182
3183 topmenu = g_menu_new();
3184
3185 /* Keys exist for 4 battle groups */
3186 FC_STATIC_ASSERT(MAX_NUM_BATTLEGROUPS == 4, incompatible_bg_count);
3187
3188 for (i = 0; i < MAX_NUM_BATTLEGROUPS; i++) {
3189 char key[128];
3190
3191 /* User side battle group numbers start from 1 */
3192 fc_snprintf(key, sizeof(key), "BG_SELECT_%d", i + 1);
3193 menu_entry_init(topmenu, key);
3194 fc_snprintf(key, sizeof(key), "BG_ASSIGN_%d", i + 1);
3195 menu_entry_init(topmenu, key);
3196 fc_snprintf(key, sizeof(key), "BG_APPEND_%d", i + 1);
3197 menu_entry_init(topmenu, key);
3198
3199 register_bg_actions(G_ACTION_MAP(app), i);
3200 }
3201
3202 submenu_append_unref(menubar, _("_Battle Groups"), G_MENU_MODEL(topmenu));
3203
3204 topmenu = g_menu_new();
3205
3206 menu_entry_init(topmenu, "HELP_OVERVIEW");
3207 menu_entry_init(topmenu, "HELP_PLAYING");
3208 menu_entry_init(topmenu, "HELP_POLICIES");
3209 menu_entry_init(topmenu, "HELP_TERRAIN");
3210 menu_entry_init(topmenu, "HELP_ECONOMY");
3211 menu_entry_init(topmenu, "HELP_CITIES");
3212 menu_entry_init(topmenu, "HELP_IMPROVEMENTS");
3213 menu_entry_init(topmenu, "HELP_WONDERS");
3214 menu_entry_init(topmenu, "HELP_UNITS");
3215 menu_entry_init(topmenu, "HELP_COMBAT");
3216 menu_entry_init(topmenu, "HELP_ZOC");
3217 menu_entry_init(topmenu, "HELP_GOVERNMENT");
3218 menu_entry_init(topmenu, "HELP_DIPLOMACY");
3219 menu_entry_init(topmenu, "HELP_TECH");
3220 menu_entry_init(topmenu, "HELP_SPACE_RACE");
3221 menu_entry_init(topmenu, "HELP_RULESET");
3222 menu_entry_init(topmenu, "HELP_TILESET");
3223 menu_entry_init(topmenu, "HELP_NATIONS");
3224 menu_entry_init(topmenu, "HELP_CONNECTING");
3225 menu_entry_init(topmenu, "HELP_CONTROLS");
3226 menu_entry_init(topmenu, "HELP_GOVERNOR");
3227 menu_entry_init(topmenu, "HELP_CHATLINE");
3228 menu_entry_init(topmenu, "HELP_WORKLIST_EDITOR");
3229 menu_entry_init(topmenu, "HELP_LANGUAGES");
3230 menu_entry_init(topmenu, "HELP_COPYING");
3231 menu_entry_init(topmenu, "HELP_ABOUT");
3232
3233 submenu_append_unref(menubar, _("_Help"), G_MENU_MODEL(topmenu));
3234
3235 menus_built = TRUE;
3236
3238
3239 return menubar;
3240}
3241
3242/************************************************************************/
3245static struct menu_entry_info *menu_entry_info_find(const char *key)
3246{
3247 int i;
3248
3249 for (i = 0; menu_entries[i].key != NULL; i++) {
3250 if (!strcmp(key, menu_entries[i].key)) {
3251 return &(menu_entries[i]);
3252 }
3253 }
3254
3255 return NULL;
3256}
3257
3258/************************************************************************/
3261static void menu_entry_set_sensitive_info(GActionMap *map,
3262 struct menu_entry_info *info,
3263 gboolean is_enabled)
3264{
3265 GAction *act = g_action_map_lookup_action(map, info->action);
3266
3267 if (act != NULL) {
3268 g_simple_action_set_enabled(G_SIMPLE_ACTION(act), is_enabled);
3269 }
3270}
3271
3272/************************************************************************/
3275static void menu_entry_set_sensitive(GActionMap *map,
3276 const char *key,
3277 gboolean is_enabled)
3278{
3280
3281 if (info != NULL) {
3282 menu_entry_set_sensitive_info(map, info, is_enabled);
3283 }
3284}
3285
3286/************************************************************************/
3289static void menu_entry_group_set_sensitive(GActionMap *map,
3290 enum menu_entry_grouping group,
3291 gboolean is_enabled)
3292{
3293 int i;
3294
3295 for (i = 0; menu_entries[i].key != NULL; i++) {
3296 if (menu_entries[i].grouping == group || group == MGROUP_ALL) {
3297 menu_entry_set_sensitive_info(map, &(menu_entries[i]), is_enabled);
3298 }
3299 }
3300}
3301
3302/************************************************************************/
3305static void menus_rename(GMenu *parent, int index, const char *key,
3306 const char *new_name)
3307{
3309
3310 if (info != NULL) {
3311 char actname[150];
3312 GMenuItem *item;
3313
3314 fc_snprintf(actname, sizeof(actname), "app.%s", info->action);
3315 g_menu_remove(parent, index);
3316
3317 item = g_menu_item_new(new_name, actname);
3318 menu_item_insert_unref(parent, index, item);
3319 }
3320}
3321
3322/************************************************************************/
3325static void view_menu_update_sensitivity(GActionMap *map)
3326{
3327 /* The "full" city bar (i.e. the new way of drawing the
3328 * city name), can draw the city growth even without drawing
3329 * the city name. But the old method cannot. */
3331 menu_entry_set_sensitive(map, "SHOW_CITY_GROWTH", TRUE);
3332 menu_entry_set_sensitive(map, "SHOW_CITY_TRADE_ROUTES", TRUE);
3333 } else {
3334 menu_entry_set_sensitive(map, "SHOW_CITY_GROWTH", gui_options.draw_city_names);
3335 menu_entry_set_sensitive(map, "SHOW_CITY_TRADE_ROUTES",
3337 }
3338
3339 menu_entry_set_sensitive(map, "SHOW_CITY_BUY_COST",
3341 menu_entry_set_sensitive(map, "SHOW_COASTLINE", !gui_options.draw_terrain);
3342 menu_entry_set_sensitive(map, "SHOW_UNIT_SOLID_BG",
3344 menu_entry_set_sensitive(map, "SHOW_UNIT_SHIELDS",
3346 menu_entry_set_sensitive(map, "SHOW_FOCUS_UNIT", !gui_options.draw_units);
3347}
3348
3349/************************************************************************/
3355static const char *get_tile_change_menu_text(struct tile *ptile,
3356 enum unit_activity activity)
3357{
3358 struct tile *newtile = tile_virtual_new(ptile);
3359 const char *text;
3360
3361 tile_apply_activity(newtile, activity, NULL);
3362 text = tile_get_info_text(newtile, FALSE, 0);
3363 tile_virtual_destroy(newtile);
3364
3365 return text;
3366}
3367
3368/************************************************************************/
3372{
3373 GtkApplication *fc_app = gui_app();
3374 GActionMap *map = G_ACTION_MAP(fc_app);
3375 GMenu *submenu;
3376 int i, j;
3377 int tgt_kind_group;
3378 struct unit_list *punits;
3379 unsigned num_units;
3380 struct menu_entry_info *info;
3381 struct road_type *proad;
3382 struct extra_type_list *extras;
3383 bool conn_possible;
3384
3386 return;
3387 }
3388
3389 punits = get_units_in_focus();
3390
3391 submenu = g_menu_new();
3392
3393 i = 0;
3394 j = 0;
3395
3396 /* Add the new action entries grouped by target kind. */
3397 for (tgt_kind_group = 0; tgt_kind_group < ATK_COUNT; tgt_kind_group++) {
3398 action_iterate(act_id) {
3399 struct action *paction = action_by_number(act_id);
3400 GSimpleAction *act;
3401 char actname[256];
3402 char name[256];
3403
3404 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
3405 /* This action isn't performed by a unit. */
3406 continue;
3407 }
3408
3409 if (action_id_get_target_kind(act_id) != tgt_kind_group) {
3410 /* Wrong group. */
3411 continue;
3412 }
3413
3414 if (!units_can_do_action(punits, act_id, TRUE)) {
3415 continue;
3416 }
3417
3418 /* Create and add the menu item. */
3419 fc_snprintf(actname, sizeof(actname), "action_%d", i);
3420 act = g_simple_action_new(actname, NULL);
3421 g_action_map_add_action(map, G_ACTION(act));
3422
3423 fc_snprintf(name, sizeof(name), "%s",
3424 action_get_ui_name_mnemonic(act_id, "_"));
3425 fc_snprintf(actname, sizeof(actname), "app.action_%d", i++);
3426
3427 if (action_id_has_complex_target(act_id)) {
3428 GMenu *sub_target_menu = g_menu_new();
3429 char subname[256];
3430
3431#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_) \
3432{ \
3433 fc_snprintf(actname, sizeof(actname), "subtgt_%d", j); \
3434 act = g_simple_action_new(actname, NULL); \
3435 g_action_map_add_action(map, G_ACTION(act)); \
3436 g_object_set_data(G_OBJECT(act), _sub_target_key_, _sub_target_); \
3437 g_signal_connect(act, "activate", G_CALLBACK(unit_goto_and_callback), \
3438 paction); \
3439 fc_snprintf(subname, sizeof(subname), "%s", _sub_target_name_); \
3440 fc_snprintf(actname, sizeof(actname), "app.subtgt_%d", j++); \
3441 menu_item_append_unref(sub_target_menu, \
3442 g_menu_item_new(subname, actname)); \
3443}
3444
3445 switch (action_get_sub_target_kind(paction)) {
3446 case ASTK_BUILDING:
3447 improvement_iterate(pimpr) {
3448 CREATE_SUB_ITEM(pimpr, "end_building",
3451 break;
3452 case ASTK_TECH:
3453 advance_iterate(A_FIRST, ptech) {
3454 CREATE_SUB_ITEM(ptech, "end_tech",
3457 break;
3458 case ASTK_EXTRA:
3459 case ASTK_EXTRA_NOT_THERE:
3460 extra_type_iterate(pextra) {
3461 if (!(action_creates_extra(paction, pextra)
3462 || action_removes_extra(paction, pextra))) {
3463 /* Not relevant */
3464 continue;
3465 }
3466 CREATE_SUB_ITEM(pextra, "end_extra",
3467 extra_name_translation(pextra));
3469 break;
3470 case ASTK_NONE:
3471 /* Should not be here. */
3472 fc_assert(action_get_sub_target_kind(paction) != ASTK_NONE);
3473 break;
3474 case ASTK_COUNT:
3475 /* Should not exits */
3476 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
3477 break;
3478 }
3479
3480#undef CREATE_SUB_ITEM
3481
3482 submenu_append_unref(submenu, name, G_MENU_MODEL(sub_target_menu));
3483 } else {
3484 g_signal_connect(act, "activate",
3485 G_CALLBACK(unit_goto_and_callback), paction);
3486 menu_item_append_unref(submenu, g_menu_item_new(name, actname));
3487 }
3489 }
3490 g_menu_remove(unit_menu, 1);
3491 g_menu_insert_submenu(unit_menu, 1, _("Go to a_nd..."), G_MENU_MODEL(submenu));
3492
3493 submenu = g_menu_new();
3494
3496 menu_entry_init(submenu, "START_REVOLUTION");
3497 }
3498
3499 i = 0;
3502 char name[256];
3503 char actname[256];
3504 GSimpleAction *act;
3505
3506 fc_snprintf(actname, sizeof(actname), "government_%d", i);
3507 act = g_simple_action_new(actname, NULL);
3508 g_simple_action_set_enabled(act, can_change_to_government(client_player(), g));
3509 g_action_map_add_action(map, G_ACTION(act));
3510 g_signal_connect(act, "activate", G_CALLBACK(government_callback), g);
3511
3512 /* TRANS: %s is a government name */
3513 fc_snprintf(name, sizeof(name), _("%s..."),
3515 fc_snprintf(actname, sizeof(actname), "app.government_%d", i++);
3516 menu_item_append_unref(submenu, g_menu_item_new(name, actname));
3517 }
3519 g_menu_remove(gov_menu, 8);
3520 g_menu_insert_submenu(gov_menu, 8, _("_Government"), G_MENU_MODEL(submenu));
3521
3522 submenu = g_menu_new();
3523
3524 extra_type_by_cause_iterate(EC_ROAD, pextra) {
3525 if (pextra->buildable) {
3526 char actname[256];
3527 GSimpleAction *act;
3528
3529 fc_snprintf(actname, sizeof(actname), "path_%d", i);
3530 act = g_simple_action_new(actname, NULL);
3531 g_simple_action_set_enabled(act,
3533 ACTIVITY_GEN_ROAD,
3534 pextra));
3535 g_action_map_add_action(map, G_ACTION(act));
3536 g_signal_connect(act, "activate", G_CALLBACK(road_callback), pextra);
3537
3538 fc_snprintf(actname, sizeof(actname), "app.path_%d", i++);
3539 menu_item_append_unref(submenu,
3540 g_menu_item_new(extra_name_translation(pextra), actname));
3541 }
3543
3544 g_menu_remove(work_menu, 2);
3545 g_menu_insert_submenu(work_menu, 2, _("Build _Path"), G_MENU_MODEL(submenu));
3546
3547 submenu = g_menu_new();
3548
3549 extra_type_by_cause_iterate(EC_IRRIGATION, pextra) {
3550 if (pextra->buildable) {
3551 char actname[256];
3552 GSimpleAction *act;
3553
3554 fc_snprintf(actname, sizeof(actname), "irrig_%d", i);
3555 act = g_simple_action_new(actname, NULL);
3556 g_simple_action_set_enabled(act,
3558 ACTIVITY_IRRIGATE,
3559 pextra));
3560 g_action_map_add_action(map, G_ACTION(act));
3561 g_signal_connect(act, "activate", G_CALLBACK(irrigation_callback), pextra);
3562
3563 fc_snprintf(actname, sizeof(actname), "app.irrig_%d", i++);
3564 menu_item_append_unref(submenu,
3565 g_menu_item_new(extra_name_translation(pextra), actname));
3566 }
3568
3569 g_menu_remove(work_menu, 3);
3570 g_menu_insert_submenu(work_menu, 3, _("Build _Irrigation"), G_MENU_MODEL(submenu));
3571
3572 submenu = g_menu_new();
3573
3574 extra_type_by_cause_iterate(EC_MINE, pextra) {
3575 if (pextra->buildable) {
3576 char actname[256];
3577 GSimpleAction *act;
3578
3579 fc_snprintf(actname, sizeof(actname), "mine_%d", i);
3580 act = g_simple_action_new(actname, NULL);
3581 g_simple_action_set_enabled(act,
3583 ACTIVITY_MINE,
3584 pextra));
3585 g_action_map_add_action(map, G_ACTION(act));
3586 g_signal_connect(act, "activate", G_CALLBACK(mine_callback), pextra);
3587
3588 fc_snprintf(actname, sizeof(actname), "app.mine_%d", i++);
3589 menu_item_append_unref(submenu,
3590 g_menu_item_new(extra_name_translation(pextra), actname));
3591 }
3593
3594 g_menu_remove(work_menu, 4);
3595 g_menu_insert_submenu(work_menu, 4, _("Build _Mine"), G_MENU_MODEL(submenu));
3596
3597 submenu = g_menu_new();
3598
3599 extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) {
3600 char actname[256];
3601 GSimpleAction *act;
3602
3603 fc_snprintf(actname, sizeof(actname), "clean_%d", i);
3604 act = g_simple_action_new(actname, NULL);
3605 g_simple_action_set_enabled(act,
3607 ACTIVITY_POLLUTION,
3608 pextra));
3609 g_action_map_add_action(map, G_ACTION(act));
3610 g_signal_connect(act, "activate", G_CALLBACK(clean_menu_callback), pextra);
3611
3612 fc_snprintf(actname, sizeof(actname), "app.clean_%d", i++);
3613 menu_item_append_unref(submenu,
3614 g_menu_item_new(extra_name_translation(pextra), actname));
3616
3617 extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) {
3618 char actname[256];
3619 GSimpleAction *act;
3620
3621 fc_snprintf(actname, sizeof(actname), "clean_%d", i);
3622 act = g_simple_action_new(actname, NULL);
3623 g_simple_action_set_enabled(act,
3625 ACTIVITY_FALLOUT,
3626 pextra));
3627 g_action_map_add_action(map, G_ACTION(act));
3628 g_signal_connect(act, "activate", G_CALLBACK(clean_menu_callback), pextra);
3629
3630 fc_snprintf(actname, sizeof(actname), "app.clean_%d", i++);
3631 menu_item_append_unref(submenu,
3632 g_menu_item_new(extra_name_translation(pextra), actname));
3634
3635 g_menu_remove(work_menu, 5);
3636 g_menu_insert_submenu(work_menu, 5, _("_Clean Nuisance"),
3637 G_MENU_MODEL(submenu));
3638
3639 submenu = g_menu_new();
3640
3641 extra_type_by_cause_iterate(EC_BASE, pextra) {
3642 if (pextra->buildable) {
3643 char actname[256];
3644 GSimpleAction *act;
3645
3646 fc_snprintf(actname, sizeof(actname), "base_%d", i);
3647 act = g_simple_action_new(actname, NULL);
3648 g_simple_action_set_enabled(act,
3650 ACTIVITY_BASE,
3651 pextra));
3652 g_action_map_add_action(map, G_ACTION(act));
3653 g_signal_connect(act, "activate", G_CALLBACK(base_callback), pextra);
3654
3655 fc_snprintf(actname, sizeof(actname), "app.base_%d", i++);
3656 menu_item_append_unref(submenu,
3657 g_menu_item_new(extra_name_translation(pextra), actname));
3658 }
3660
3661 g_menu_remove(combat_menu, 3);
3662 g_menu_insert_submenu(combat_menu, 3, _("Build _Base"), G_MENU_MODEL(submenu));
3663
3664 bool units_all_same_tile = TRUE, units_all_same_type = TRUE;
3665 char acttext[128], irrtext[128], mintext[128], transtext[128];
3666 char cultext[128], plantext[128];
3667 struct terrain *pterrain;
3668
3669 if (!can_client_change_view()) {
3670 return;
3671 }
3672
3673 num_units = get_num_units_in_focus();
3674
3675 if (num_units > 0) {
3676 const struct tile *ptile = NULL;
3677 const struct unit_type *ptype = NULL;
3678
3679 unit_list_iterate(punits, punit) {
3680 fc_assert((ptile==NULL) == (ptype==NULL));
3681 if (ptile || ptype) {
3682 if (unit_tile(punit) != ptile) {
3683 units_all_same_tile = FALSE;
3684 }
3685 if (unit_type_get(punit) != ptype) {
3686 units_all_same_type = FALSE;
3687 }
3688 } else {
3689 ptile = unit_tile(punit);
3690 ptype = unit_type_get(punit);
3691 }
3693 }
3694
3699 num_units > 0
3701 && !editor_is_active());
3702
3703 menu_entry_set_sensitive(map, "GAME_SAVE_AS",
3705 menu_entry_set_sensitive(map, "GAME_SAVE",
3707
3708 menu_entry_set_sensitive(map, "SERVER_OPTIONS", client.conn.established);
3709
3710 menu_entry_set_sensitive(map, "LEAVE",
3712
3714 menu_entry_set_sensitive(map, "INFRA_DLG", terrain_control.infrapoints);
3715
3716 menu_entry_set_sensitive(map, "POLICIES", multiplier_count() > 0);
3717 menu_entry_set_sensitive(map, "REPORT_SPACESHIP",
3718 client_player() != NULL && client_player()->spaceship.state != SSHIP_NONE);
3719
3720 info = menu_entry_info_find("EDIT_MODE");
3721 if (info->state != game.info.is_edit_mode) {
3722 info->state = game.info.is_edit_mode;
3723 g_menu_remove(edit_menu, 4);
3726
3727 menu_entry_set_sensitive(map, "EDIT_MODE",
3730 }
3731
3732 {
3733 char road_buf[500];
3734
3735 proad = road_by_gui_type(ROAD_GUI_ROAD);
3736 if (proad != NULL) {
3737 /* TRANS: Connect with some road type (Road/Railroad) */
3738 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3740 menus_rename(work_menu, 12, "CONNECT_ROAD", road_buf);
3741 }
3742
3743 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3744 if (proad != NULL) {
3745 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3747 menus_rename(work_menu, 13, "CONNECT_RAIL", road_buf);
3748 }
3749 }
3750
3751 if (!can_client_issue_orders()) {
3752 return;
3753 }
3754
3755 if (!punits) {
3756 return;
3757 }
3758
3759 /* Remaining part of this function: Update Unit, Work, and Combat menus */
3760
3761 /* Enable the button for adding to a city in all cases, so we
3762 * get an eventual error message from the server if we try. */
3763 menu_entry_set_sensitive(map, "BUILD_CITY",
3764 (can_units_do_on_map(&(wld.map), punits,
3766 || can_units_do_on_map(&(wld.map), punits,
3768
3769 menu_entry_set_sensitive(map, "DO_ACTION",
3771
3772 menu_entry_set_sensitive(map, "BUILD_ROAD",
3773 (can_units_do_any_road(&(wld.map), punits)
3774 || can_units_do(punits,
3776 menu_entry_set_sensitive(map, "BUILD_IRRIGATION",
3777 can_units_do_activity_client(punits, ACTIVITY_IRRIGATE));
3778 menu_entry_set_sensitive(map, "BUILD_MINE",
3779 can_units_do_activity_client(punits, ACTIVITY_MINE));
3780 menu_entry_set_sensitive(map, "CULTIVATE",
3781 can_units_do_activity_client(punits, ACTIVITY_CULTIVATE));
3782 menu_entry_set_sensitive(map, "PLANT",
3783 can_units_do_activity_client(punits, ACTIVITY_PLANT));
3784 menu_entry_set_sensitive(map, "TRANSFORM_TERRAIN",
3785 can_units_do_activity_client(punits, ACTIVITY_TRANSFORM));
3786 menu_entry_set_sensitive(map, "FORTIFY",
3788 ACTIVITY_FORTIFYING));
3789 menu_entry_set_sensitive(map, "PARADROP",
3791 menu_entry_set_sensitive(map, "PILLAGE",
3792 can_units_do_activity_client(punits, ACTIVITY_PILLAGE));
3793 menu_entry_set_sensitive(map, "CLEAN",
3794 can_units_do_activity_client(punits, ACTIVITY_POLLUTION)
3795 || can_units_do_activity_client(punits, ACTIVITY_FALLOUT));
3796 menu_entry_set_sensitive(map, "BUILD_FORTRESS",
3797 can_units_do_base_gui(punits, BASE_GUI_FORTRESS));
3798 menu_entry_set_sensitive(map, "BUILD_AIRBASE",
3799 can_units_do_base_gui(punits, BASE_GUI_AIRBASE));
3800 menu_entry_set_sensitive(map, "UNIT_SENTRY",
3801 can_units_do_activity_client(punits, ACTIVITY_SENTRY));
3802 menu_entry_set_sensitive(map, "UNSENTRY_ALL",
3804 ACTIVITY_SENTRY));
3805 menu_entry_set_sensitive(map, "UNIT_HOMECITY",
3807 menu_entry_set_sensitive(map, "UNIT_UPGRADE", units_can_upgrade(&(wld.map), punits));
3808 menu_entry_set_sensitive(map, "UNIT_CONVERT", units_can_convert(&(wld.map), punits));
3809 menu_entry_set_sensitive(map, "UNIT_DISBAND",
3810 units_can_do_action(punits, ACTION_DISBAND_UNIT,
3811 TRUE));
3812
3813 menu_entry_set_sensitive(map, "AUTO_SETTLER",
3815 menu_entry_set_sensitive(map, "UNIT_EXPLORE",
3816 can_units_do_activity_client(punits, ACTIVITY_EXPLORE));
3817 menu_entry_set_sensitive(map, "UNIT_BOARD",
3818 units_can_load(punits));
3819 menu_entry_set_sensitive(map, "UNIT_DEBOARD",
3820 units_can_unload(punits));
3821 menu_entry_set_sensitive(map, "UNIT_UNLOAD_TRANSPORTER",
3822 units_are_occupied(punits));
3823
3824 proad = road_by_gui_type(ROAD_GUI_ROAD);
3825 if (proad != NULL) {
3826 struct extra_type *tgt;
3827
3828 tgt = road_extra_get(proad);
3829
3830 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3831 } else {
3832 conn_possible = FALSE;
3833 }
3834 menu_entry_set_sensitive(map, "CONNECT_ROAD", conn_possible);
3835
3836 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3837 if (proad != NULL) {
3838 struct extra_type *tgt;
3839
3840 tgt = road_extra_get(proad);
3841
3842 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3843 } else {
3844 conn_possible = FALSE;
3845 }
3846 menu_entry_set_sensitive(map, "CONNECT_RAIL", conn_possible);
3847
3848 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
3849 if (proad != NULL) {
3850 struct extra_type *tgt;
3851
3852 tgt = road_extra_get(proad);
3853
3854 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3855 } else {
3856 conn_possible = FALSE;
3857 }
3858 menu_entry_set_sensitive(map, "CONNECT_MAGLEV", conn_possible);
3859
3860 extras = extra_type_list_by_cause(EC_IRRIGATION);
3861
3862 if (extra_type_list_size(extras) > 0) {
3863 struct extra_type *tgt;
3864
3865 tgt = extra_type_list_get(extras, 0);
3866 conn_possible = can_units_do_connect(punits, ACTIVITY_IRRIGATE, tgt);
3867 } else {
3868 conn_possible = FALSE;
3869 }
3870 menu_entry_set_sensitive(map, "CONNECT_IRRIGATION", conn_possible);
3871
3872 menu_entry_set_sensitive(map, "TAX_RATES",
3875
3876 if (units_can_do_action(punits, ACTION_HELP_WONDER, TRUE)) {
3877 menus_rename(work_menu, 0, "BUILD_CITY",
3878 action_get_ui_name_mnemonic(ACTION_HELP_WONDER, "_"));
3879 } else {
3880 bool city_on_tile = FALSE;
3881
3882 /* FIXME: This overloading doesn't work well with multiple focus
3883 * units. */
3884 unit_list_iterate(punits, punit) {
3885 if (tile_city(unit_tile(punit))) {
3886 city_on_tile = TRUE;
3887 break;
3888 }
3890
3891 if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
3892 TRUE)) {
3893 menus_rename(work_menu, 0, "BUILD_CITY",
3894 action_get_ui_name_mnemonic(ACTION_JOIN_CITY, "_"));
3895 } else {
3896 /* Refresh default order */
3897 menus_rename(work_menu, 0, "BUILD_CITY",
3898 action_get_ui_name_mnemonic(ACTION_FOUND_CITY, "_"));
3899 }
3900 }
3901
3902 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
3903 menus_rename(work_menu, 6, "BUILD_ROAD",
3904 action_get_ui_name_mnemonic(ACTION_TRADE_ROUTE, "_"));
3905 } else if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
3906 char road_item[500];
3907 struct extra_type *pextra = NULL;
3908
3909 /* FIXME: This overloading doesn't work well with multiple focus
3910 * units. */
3911 unit_list_iterate(punits, punit) {
3912 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
3914 if (pextra != NULL) {
3915 break;
3916 }
3918
3919 if (pextra != NULL) {
3920 /* TRANS: Build road of specific type (Road/Railroad) */
3921 snprintf(road_item, sizeof(road_item), _("Build %s"),
3922 extra_name_translation(pextra));
3923 menus_rename(work_menu, 6, "BUILD_ROAD", road_item);
3924 }
3925 } else {
3926 menus_rename(work_menu, 6, "BUILD_ROAD", _("Build _Road"));
3927 }
3928
3929 if (units_all_same_type && num_units > 0) {
3930 struct unit *punit = unit_list_get(punits, 0);
3931 const struct unit_type *to_unittype
3933
3934 if (to_unittype) {
3935 /* TRANS: %s is a unit type. */
3936 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
3939 unit_type_get(punit))));
3940 } else {
3941 acttext[0] = '\0';
3942 }
3943 } else {
3944 acttext[0] = '\0';
3945 }
3946 if ('\0' != acttext[0]) {
3947 menus_rename(unit_menu, 13, "UNIT_UPGRADE", acttext);
3948 } else {
3949 menus_rename(unit_menu, 13, "UNIT_UPGRADE", _("Upgr_ade"));
3950 }
3951
3952 if (units_can_convert(&(wld.map), punits)) {
3953 if (units_all_same_type && num_units > 0) {
3954 struct unit *punit = unit_list_get(punits, 0);
3955
3956 /* TRANS: %s is a unit type. */
3957 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
3959 } else {
3960 acttext[0] = '\0';
3961 }
3962 } else {
3963 menu_entry_set_sensitive(map, "UNIT_CONVERT", FALSE);
3964 acttext[0] = '\0';
3965 }
3966 if ('\0' != acttext[0]) {
3967 menus_rename(unit_menu, 14, "UNIT_CONVERT", acttext);
3968 } else {
3969 menus_rename(unit_menu, 14, "UNIT_CONVERT", _("C_onvert"));
3970 }
3971
3972 if (units_all_same_tile && num_units > 0) {
3973 struct unit *first = unit_list_get(punits, 0);
3974
3975 pterrain = tile_terrain(unit_tile(first));
3976
3977 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
3978 struct extra_type *pextra = NULL;
3979
3980 /* FIXME: this overloading doesn't work well with multiple focus
3981 * units. */
3982 unit_list_iterate(punits, punit) {
3983 pextra = next_extra_for_tile(unit_tile(punit), EC_IRRIGATION,
3985 if (pextra != NULL) {
3986 break;
3987 }
3989
3990 if (pextra != NULL) {
3991 /* TRANS: Build irrigation of specific type */
3992 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
3993 extra_name_translation(pextra));
3994 } else {
3995 sz_strlcpy(irrtext, _("Build _Irrigation"));
3996 }
3997 } else {
3998 sz_strlcpy(irrtext, _("Build _Irrigation"));
3999 }
4000
4001 if (pterrain->cultivate_result != T_NONE) {
4002 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
4004 ACTIVITY_CULTIVATE));
4005 } else {
4006 sz_strlcpy(cultext, _("_Cultivate"));
4007 }
4008
4009 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
4010 struct extra_type *pextra = NULL;
4011
4012 /* FIXME: this overloading doesn't work well with multiple focus
4013 * units. */
4014 unit_list_iterate(punits, punit) {
4015 pextra = next_extra_for_tile(unit_tile(punit), EC_MINE,
4017 if (pextra != NULL) {
4018 break;
4019 }
4021
4022 if (pextra != NULL) {
4023 /* TRANS: Build mine of specific type */
4024 snprintf(mintext, sizeof(mintext), _("Build %s"),
4025 extra_name_translation(pextra));
4026 } else {
4027 sz_strlcpy(mintext, _("Build _Mine"));
4028 }
4029 } else {
4030 sz_strlcpy(mintext, _("Build _Mine"));
4031 }
4032
4033 if (pterrain->plant_result != T_NONE) {
4034 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
4035 get_tile_change_menu_text(unit_tile(first), ACTIVITY_PLANT));
4036 } else {
4037 sz_strlcpy(plantext, _("_Plant"));
4038 }
4039
4040 if (pterrain->transform_result != T_NONE
4041 && pterrain->transform_result != pterrain) {
4042 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
4044 ACTIVITY_TRANSFORM));
4045 } else {
4046 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4047 }
4048 } else {
4049 sz_strlcpy(irrtext, _("Build _Irrigation"));
4050 sz_strlcpy(cultext, _("_Cultivate"));
4051 sz_strlcpy(mintext, _("Build _Mine"));
4052 sz_strlcpy(plantext, _("_Plant"));
4053 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4054 }
4055
4056 menus_rename(work_menu, 7, "BUILD_IRRIGATION", irrtext);
4057 menus_rename(work_menu, 9, "CULTIVATE", cultext);
4058 menus_rename(work_menu, 8, "BUILD_MINE", mintext);
4059 menus_rename(work_menu, 10, "PLANT", plantext);
4060 menus_rename(work_menu, 11, "TRANSFORM_TERRAIN", transtext);
4061
4062 menus_rename(unit_menu, 12, "UNIT_HOMECITY",
4063 action_get_ui_name_mnemonic(ACTION_HOME_CITY, "_"));
4064
4065 menus_rename(combat_menu, 1, "BUILD_FORTRESS",
4066 Q_(terrain_control.gui_type_base0));
4067 menus_rename(combat_menu, 2, "BUILD_AIRBASE",
4068 Q_(terrain_control.gui_type_base1));
4069}
4070
4071/************************************************************************/
4076{
4077 if (!menus_built) {
4078 return;
4079 }
4080
4081#ifdef MENUS_GTK3
4082
4083 if (!can_client_change_view()) {
4085
4086 return;
4087 }
4088
4091
4092 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
4094
4096#endif /* MENUS_GTK3 */
4097}
4098
4099/**********************************************************************/
4103{
4104 GtkApplication *fc_app = gui_app();
4105
4106 if (enable) {
4107 if (main_menubar == NULL) {
4108 setup_app_actions(G_APPLICATION(fc_app));
4110 /* Ensure the menus are really created before performing any operations
4111 * on them. */
4112 while (g_main_context_pending(NULL)) {
4113 g_main_context_iteration(NULL, FALSE);
4114 }
4115 }
4116
4117 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), TRUE);
4118 gtk_application_set_menubar(fc_app, G_MENU_MODEL(main_menubar));
4119
4120 } else {
4121 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), FALSE);
4122 gtk_application_set_menubar(fc_app, NULL);
4123 }
4124
4125 /* Workaround for gtk bug that (re)setting the menubar after the window has
4126 * been already created is not noticed. */
4127 g_object_notify(G_OBJECT(gtk_settings_get_default()), "gtk-shell-shows-menubar");
4128}
4129
4130/**********************************************************************/
bool action_removes_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2312
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1751
bool action_creates_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2224
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1918
static struct action * action_by_number(action_id act_id)
Definition actions.h:638
#define action_iterate_end
Definition actions.h:472
#define action_id_get_actor_kind(act_id)
Definition actions.h:651
#define action_iterate(_act_)
Definition actions.h:467
#define ACTION_ANY
Definition actions.h:290
#define action_id_get_target_kind(act_id)
Definition actions.h:655
#define action_id_has_complex_target(act_id)
Definition actions.h:673
struct civclient client
enum client_states client_state(void)
void send_report_request(enum report_type type)
bool can_client_issue_orders(void)
bool client_has_player(void)
bool can_client_change_view(void)
#define client_player()
@ C_S_DISCONNECTED
Definition client_main.h:45
@ C_S_RUNNING
Definition client_main.h:47
bool can_units_do_connect(struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
Definition climisc.c:1235
void disconnect_from_server(void)
Definition clinet.c:305
void send_save_game(const char *filename)
bool is_server_running(void)
bool can_client_access_hack(void)
bool can_conn_enable_editing(const struct connection *pconn)
Definition connection.c:520
void key_coastline_toggle(void)
Definition control.c:3830
void key_irrigation_toggle(void)
Definition control.c:3846
void key_unit_sentry(void)
Definition control.c:3634
void key_city_output_toggle(void)
Definition control.c:3731
void request_unit_return(struct unit *punit)
Definition control.c:1547
void request_unit_fortify(struct unit *punit)
Definition control.c:2240
void key_roads_rails_toggle(void)
Definition control.c:3838
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2148
void key_focus_unit_toggle(void)
Definition control.c:3926
void key_unit_auto_explore(void)
Definition control.c:3410
void key_unit_auto_settle(void)
Definition control.c:3423
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3216
void key_city_full_bar_toggle(void)
Definition control.c:3763
void key_bases_toggle(void)
Definition control.c:3862
void key_map_native_toggle(void)
Definition control.c:3755
void key_resources_toggle(void)
Definition control.c:3870
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1129
void key_unit_paradrop(void)
Definition control.c:3320
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void key_unit_shields_toggle(void)
Definition control.c:3918
void key_city_productions_toggle(void)
Definition control.c:3797
void key_unit_plant(void)
Definition control.c:3556
void key_unit_fortress(void)
Definition control.c:3465
void key_unit_mine(void)
Definition control.c:3548
void key_unit_pillage(void)
Definition control.c:3568
void request_unit_unload(struct unit *pcargo)
Definition control.c:2119
void key_editor_toggle_fogofwar(void)
Definition control.c:3959
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1863
void key_unit_irrigate(void)
Definition control.c:3528
void request_unit_build_city(struct unit *punit)
Definition control.c:1740
void key_unit_unload_all(void)
Definition control.c:3350
void key_cities_toggle(void)
Definition control.c:3894
void key_city_outlines_toggle(void)
Definition control.c:3723
void key_unit_homecity(void)
Definition control.c:3482
void key_unit_patrol(void)
Definition control.c:3328
void key_unit_solid_bg_toggle(void)
Definition control.c:3910
void key_terrain_toggle(void)
Definition control.c:3822
void key_unit_wakeup_others(void)
Definition control.c:3383
void key_unit_stack_size_toggle(void)
Definition control.c:3814
void key_huts_toggle(void)
Definition control.c:3878
void key_fog_of_war_toggle(void)
Definition control.c:3934
void key_unit_wait(void)
Definition control.c:3375
void key_units_toggle(void)
Definition control.c:3902
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3697
void key_map_grid_toggle(void)
Definition control.c:3739
void key_pollution_toggle(void)
Definition control.c:3886
void key_city_growth_toggle(void)
Definition control.c:3780
void key_unit_action_select_tgt(void)
Definition control.c:3247
void key_city_buycost_toggle(void)
Definition control.c:3789
int get_num_units_in_focus(void)
Definition control.c:185
void key_unit_transform(void)
Definition control.c:3646
void key_unit_done(void)
Definition control.c:3304
void key_city_trade_routes_toggle(void)
Definition control.c:3806
void key_city_names_toggle(void)
Definition control.c:3771
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1616
void key_unit_airbase(void)
Definition control.c:3393
void key_unit_goto(void)
Definition control.c:3312
void key_unit_convert(void)
Definition control.c:3435
void key_unit_clean(void)
Definition control.c:3580
void key_editor_toggle(void)
Definition control.c:3942
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3658
void key_unit_cultivate(void)
Definition control.c:3536
void key_mines_toggle(void)
Definition control.c:3854
void key_map_borders_toggle(void)
Definition control.c:3747
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:42
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:46
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:44
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
bool editor_is_active(void)
Definition editor.c:346
@ OBJTYPE_GAME
Definition editor.h:31
struct extra_type * next_extra_for_tile(const struct tile *ptile, enum extra_cause cause, const struct player *pplayer, const struct unit *punit)
Definition extras.c:740
int extra_number(const struct extra_type *pextra)
Definition extras.c:153
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:241
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:186
#define extra_type_iterate(_p)
Definition extras.h:291
#define extra_type_iterate_end
Definition extras.h:297
#define extra_type_by_rmcause_iterate_end
Definition extras.h:334
#define extra_type_by_rmcause_iterate(_rmcause, _extra)
Definition extras.h:329
#define extra_type_by_cause_iterate_end
Definition extras.h:315
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:309
#define NO_TARGET
Definition fc_types.h:324
@ BORDERS_DISABLED
Definition fc_types.h:891
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
struct civ_game game
Definition game.c:57
struct world wld
Definition game.c:58
const char * government_name_translation(const struct government *pgovern)
Definition government.c:142
bool untargeted_revolution_allowed(void)
Definition government.c:565
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:165
#define governments_iterate(NAME_pgov)
Definition government.h:121
#define governments_iterate_end
Definition government.h:124
void log_output_window(void)
Definition chatline.c:928
void clear_output_window(void)
Definition chatline.c:943
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
void unit_select_dialog_popup(struct tile *ptile)
Definition dialogs.c:382
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1444
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1482
void editgui_refresh(void)
Definition editgui.c:1795
void property_editor_popup(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6254
struct property_editor * editprop_get_property_editor(void)
Definition editprop.c:6207
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6344
void popup_find_dialog(void)
Definition finddlg.c:58
void popup_multiplier_dialog(void)
Definition gamedlgs.c:383
void popup_rates_dialog(void)
Definition gamedlgs.c:533
void popup_goto_dialog(void)
Definition gotodlg.c:257
void fullscreen_opt_refresh(struct option *poption)
Definition gui_main.c:2238
gboolean map_canvas_focus(void)
Definition gui_main.c:366
GtkWidget * toplevel
Definition gui_main.c:124
void popup_quit_dialog(void)
Definition gui_main.c:2154
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
void popup_help_dialog_string(const char *item)
Definition helpdlg.c:211
void luaconsole_dialog_popup(bool raise)
Definition luaconsole.c:126
void center_on_unit(void)
Definition mapctrl.c:490
static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:687
static void show_national_borders_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1185
static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1421
GtkWidget * setup_menus(GtkWidget *window)
Definition menu.c:2115
static void auto_settle_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1743
static void help_connecting_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:843
static void menus_rename(const char *key, const gchar *new_label)
Definition menu.c:2249
static void help_combat_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1043
static void menu_entry_group_set_sensitive(enum menu_entry_grouping group, gboolean is_sensitive)
Definition menu.c:2217
static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:995
static void select_single_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1491
static void unit_unload_transporter_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1683
static void help_government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1083
static void report_achievements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:819
static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1432
static void help_zoc_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1051
static void show_city_productions_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1242
static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:803
static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1219
static void help_space_race_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1099
static void help_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1003
static void help_playing_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:987
static void plant_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1801
static struct menu_entry_info menu_entries[]
Definition menu.c:264
static void base_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1980
static void help_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1011
static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1647
static void center_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2005
static void unit_explore_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1631
static void build_mine_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1793
static void quit_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:739
static void unit_return_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1621
static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1265
static void transform_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1873
static void help_wonders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1075
static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1276
static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1231
static void show_stack_size_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1410
static void multiplier_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1964
static void help_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1067
static void save_game_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:671
static void show_unit_solid_bg_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1388
static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1287
static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1463
static void show_city_full_bar_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1207
static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1140
static void help_chatline_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:859
static void connect_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1809
static void help_overview_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:979
static void save_game_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:679
static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1091
static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1377
static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1307
static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1174
static void help_improvements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1027
static void find_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:747
static void report_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:771
static void report_demographic_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:811
static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:867
static void help_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1019
static void leave_local_game_response(GtkWidget *dialog, gint response)
Definition menu.c:704
static void help_language_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:827
static void server_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:647
static void leave_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:719
static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1515
static void unit_convert_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1708
static void select_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1531
static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1347
static void report_wow_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:779
static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1700
static void help_tech_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1059
static void unit_goto_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1555
static void build_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1724
static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1639
void real_menus_init(void)
Definition menu.c:2841
menu_entry_grouping
Definition menu.c:90
@ MGROUP_ALL
Definition menu.c:91
@ MGROUP_PLAYING
Definition menu.c:90
@ MGROUP_PLAYER
Definition menu.c:91
@ MGROUP_SAFE
Definition menu.c:90
@ MGROUP_EDIT
Definition menu.c:90
@ MGROUP_UNIT
Definition menu.c:91
static void help_about_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1123
static void build_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1751
static void local_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:631
static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1367
static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1692
static void menu_entry_set_sensitive(const char *key, gboolean is_sensitive)
Definition menu.c:2204
static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1357
static void save_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:655
static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:695
static void worklists_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:755
static void connect_maglev_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1841
static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1443
static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:787
static void help_controls_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:851
static void select_same_type_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1523
static void connect_rail_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1825
static void unit_wait_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1539
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2302
static void build_airbase_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1924
static void report_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2021
static void message_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:639
static void tax_rate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1956
static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1611
static struct menu_entry_info * menu_entry_info_find(const char *key)
Definition menu.c:2175
static void government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1972
static void report_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2029
static void report_messages_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:795
static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1327
static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1507
static void save_options_on_exit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1131
static void show_native_tiles_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1196
static void menu_entry_init(GtkBuildable *item)
Definition menu.c:2055
static void show_unit_shields_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1399
static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:663
static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1471
static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:615
static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1673
static void help_policies_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:835
static void unit_done_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1547
static void help_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1107
static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1563
static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1163
static void show_city_outlines_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1152
static void save_scenario_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1483
static void help_copying_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1115
static void cultivate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1785
static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:623
void real_menus_update(void)
Definition menu.c:2317
static void report_spaceship_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2045
static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1499
static void show_city_buy_cost_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1254
static void build_fortress_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1906
#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_)
static void view_menu_update_sensitivity(void)
Definition menu.c:2270
static void unit_board_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1663
static void fortify_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1914
static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1337
static void connect_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1857
static void build_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1777
static void report_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2013
static void road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1992
static void unit_disband_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1716
static void help_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1035
static void report_research_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2037
static void map_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:763
void popup_messageopt_dialog(void)
Definition messagedlg.c:51
void meswin_dialog_popup(bool raise)
Definition messagewin.c:416
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:979
void save_mapimg_dialog_popup(void)
Definition pages.c:3551
void mapimg_client_save(const char *filename)
Definition pages.c:3570
void save_game_dialog_popup(void)
Definition pages.c:3487
void save_scenario_dialog_popup(void)
Definition pages.c:3522
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
void science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
void economy_report_dialog_popup(bool raise)
Definition repodlgs.c:1242
void units_report_dialog_popup(bool raise)
Definition repodlgs.c:1765
void science_report_dialog_popdown(void)
Definition repodlgs.c:740
void popup_spaceship_dialog(struct player *pplayer)
bool request_transport(struct unit *cargo, struct tile *ptile)
void popup_worklists_report(void)
Definition wldlg.c:286
void infra_dialog_popup(void)
Definition infradlg.c:85
static void rally_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1548
static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1556
void rally_dialog_popup(void)
static GtkApplication * fc_app
Definition gui_main.c:179
GtkApplication * gui_app(void)
Definition gui_main.c:2617
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
static void help_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1626
static void irrigation_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2707
static void bg_append_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2840
static void unsentry_all_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2308
static GMenu * combat_menu
Definition menu.c:89
static GMenuItem * create_toggle_menu_item_for_key(const char *key)
Definition menu.c:2874
static void pillage_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2620
void enable_menus(bool enable)
Definition menu.c:4102
static void setup_app_actions(GApplication *fc_app)
Definition menu.c:2925
static GMenu * options_menu
Definition menu.c:83
static void clean_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2583
static void register_bg_actions(GActionMap *map, int bg)
Definition menu.c:2965
const GActionEntry acts[]
Definition menu.c:1030
@ VMENU_HUTS
Definition menu.c:1018
@ VMENU_MINES
Definition menu.c:1015
@ VMENU_COASTLINE
Definition menu.c:1012
@ VMENU_UNIT_SOLID_BG
Definition menu.c:1022
@ VMENU_CITY_NAMES
Definition menu.c:1006
@ VMENU_UNITS
Definition menu.c:1021
@ VMENU_CITY_FULL_BAR
Definition menu.c:1005
@ VMENU_CITY_OUTLINES
Definition menu.c:1000
@ VMENU_POLLUTION
Definition menu.c:1019
@ VMENU_FOCUS_UNIT
Definition menu.c:1025
@ VMENU_BASES
Definition menu.c:1016
@ VMENU_MAP_GRID
Definition menu.c:1002
@ VMENU_CITY_BUY_COST
Definition menu.c:1009
@ VMENU_TERRAIN
Definition menu.c:1011
@ VMENU_CITY_GROWTH
Definition menu.c:1007
@ VMENU_PATHS
Definition menu.c:1013
@ VMENU_CITIES
Definition menu.c:1020
@ VMENU_STACK_SIZE
Definition menu.c:1024
@ VMENU_UNIT_SHIELDS
Definition menu.c:1023
@ VMENU_IRRIGATION
Definition menu.c:1014
@ VMENU_NATIVE_TILES
Definition menu.c:1004
@ VMENU_CITY_OUTPUT
Definition menu.c:1001
@ VMENU_RESOURCES
Definition menu.c:1017
@ VMENU_CITY_PRODUCTIONS
Definition menu.c:1008
@ VMENU_CITY_TRADE_ROUTES
Definition menu.c:1010
@ VMENU_FULL_SCREEN
Definition menu.c:1027
@ VMENU_NAT_BORDERS
Definition menu.c:1003
@ VMENU_FOW
Definition menu.c:1026
static void revolution_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2668
static GMenu * view_menu
Definition menu.c:85
static GMenu * work_menu
Definition menu.c:88
menu_entry_grouping
Definition menu.c:80
static void bg_assign_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2830
static void menu_entry_set_sensitive_info(GActionMap *map, struct menu_entry_info *info, gboolean is_enabled)
Definition menu.c:3261
static bool menus_built
Definition menu.c:74
static void show_mines_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1922
static GMenu * edit_menu
Definition menu.c:84
void menus_disable_unit_commands(void)
Definition menu.c:4133
static void show_paths_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1902
static void paradrop_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2610
const struct menu_entry_option_map meoms[]
Definition menu.c:1702
static GMenu * unit_menu
Definition menu.c:87
static void do_action_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2630
static void bg_select_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2820
static void mine_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2722
static GMenu * main_menubar
Definition menu.c:73
static GMenuItem * create_toggle_menu_item(struct menu_entry_info *info)
Definition menu.c:2851
void menus_set_initial_toggle_values(void)
Definition menu.c:2907
static void clean_menu_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2737
static void view_menu_item_toggle(void(*cb)(void), bool updt_sensitivity, gpointer data)
Definition menu.c:1743
void popup_revolution_dialog(void)
Definition dialogs.c:109
#define HELP_CITIES_ITEM
#define HELP_TERRAIN_ITEM
#define HELP_LANGUAGES_ITEM
#define HELP_CONNECTING_ITEM
#define HELP_TILESET_ITEM
#define HELP_CHATLINE_ITEM
#define HELP_RULESET_ITEM
#define HELP_GOVERNMENT_ITEM
#define HELP_ABOUT_ITEM
#define HELP_MULTIPLIER_ITEM
#define HELP_PLAYING_ITEM
#define HELP_IMPROVEMENTS_ITEM
#define HELP_UNITS_ITEM
#define HELP_ZOC_ITEM
#define HELP_WORKLIST_EDITOR_ITEM
#define HELP_WONDERS_ITEM
#define HELP_COMBAT_ITEM
#define HELP_SPACE_RACE_ITEM
#define HELP_COPYING_ITEM
#define HELP_OVERVIEW_ITEM
#define HELP_NATIONS_ITEM
#define HELP_TECHS_ITEM
#define HELP_DIPLOMACY_ITEM
#define HELP_ECONOMY_ITEM
#define HELP_CMA_ITEM
#define HELP_CONTROLS_ITEM
Impr_type_id improvement_number(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
const char * name
Definition inputfile.c:127
#define fc_assert_ret(condition)
Definition log.h:191
#define fc_assert(condition)
Definition log.h:176
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
struct terrain_misc terrain_control
Definition map.c:69
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
const struct option_set * server_optset
Definition options.c:4009
const struct option_set * client_optset
Definition options.c:1255
void options_save(option_save_log_callback log_cb)
Definition options.c:6053
struct client_options gui_options
Definition options.c:71
@ REPORT_WONDERS_OF_THE_WORLD
Definition packets.h:74
@ REPORT_DEMOGRAPHIC
Definition packets.h:76
@ REPORT_TOP_5_CITIES
Definition packets.h:75
@ REPORT_ACHIEVEMENTS
Definition packets.h:77
struct extra_type * road_extra_get(const struct road_type *proad)
Definition road.c:42
struct road_type * road_by_gui_type(enum road_gui_type gui_type)
Definition road.c:180
static char * grouping
Definition shared.c:98
@ SSHIP_NONE
Definition spaceship.h:84
action_id id
Definition actions.h:380
struct packet_game_info info
Definition game.h:89
struct government * government_during_revolution
Definition game.h:94
struct connection conn
Definition client_main.h:96
bool draw_native
Definition options.h:207
bool draw_specials
Definition options.h:199
bool draw_city_output
Definition options.h:186
bool draw_city_names
Definition options.h:188
bool draw_city_productions
Definition options.h:190
bool draw_mines
Definition options.h:197
bool draw_borders
Definition options.h:206
bool draw_fortress_airbase
Definition options.h:198
bool draw_city_buycost
Definition options.h:191
bool draw_unit_stack_size
Definition options.h:210
bool draw_irrigation
Definition options.h:196
bool draw_terrain
Definition options.h:193
bool draw_units
Definition options.h:203
bool draw_fog_of_war
Definition options.h:205
bool draw_city_trade_routes
Definition options.h:192
bool draw_unit_shields
Definition options.h:209
bool draw_cities
Definition options.h:202
bool save_options_on_exit
Definition options.h:121
bool draw_map_grid
Definition options.h:187
bool draw_city_growth
Definition options.h:189
bool draw_focus_unit
Definition options.h:204
bool draw_city_outlines
Definition options.h:185
bool draw_coastline
Definition options.h:194
bool draw_full_citybar
Definition options.h:208
bool draw_roads_rails
Definition options.h:195
bool draw_pollution
Definition options.h:201
bool solid_color_behind_units
Definition options.h:142
bool established
Definition connection.h:145
struct player * playing
Definition connection.h:156
struct extra_type::@24 data
Definition climisc.h:82
Definition menu.c:96
const char * key
Definition menu.c:97
bool state
Definition menu.c:98
const char * accl
Definition menu.c:95
enum menu_entry_grouping grouping
Definition menu.c:102
GCallback cb
Definition menu.c:101
const char * name
Definition menu.c:98
const char * action
Definition menu.c:94
void(* toggle)(GSimpleAction *act, GVariant *value, gpointer data)
Definition menu.c:97
Definition menu.c:1696
const char * menu_entry
Definition menu.c:1697
bool * option
Definition menu.c:1698
int menu_pos
Definition menu.c:1699
enum borders_mode borders
struct terrain * cultivate_result
Definition terrain.h:203
struct terrain * plant_result
Definition terrain.h:206
struct terrain * transform_result
Definition terrain.h:217
Definition tile.h:49
Definition unit.h:138
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
#define sz_strlcpy(dest, src)
Definition support.h:167
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_start, _p)
Definition tech.h:264
#define A_FIRST
Definition tech.h:44
#define advance_iterate_end
Definition tech.h:270
#define T_NONE
Definition terrain.h:56
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1018
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:658
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:966
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:756
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_terrain(_tile)
Definition tile.h:109
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1299
bool unit_can_est_trade_route_here(const struct unit *punit)
Definition unit.c:286
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:427
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:460
bool can_unit_do_autosettlers(const struct unit *punit)
Definition unit.c:583
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:826
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:260
#define unit_tile(_pu)
Definition unit.h:395
@ ORDER_PERFORM_ACTION
Definition unit.h:47
#define unit_owner(_pu)
Definition unit.h:394
#define MAX_NUM_BATTLEGROUPS
Definition unit.h:189
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:353
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:277
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:184
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:165
bool units_can_upgrade(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:338
bool units_can_unload(const struct unit_list *punits)
Definition unitlist.c:305
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:322
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:206
bool can_units_do(const struct unit_list *punits, bool(can_fn)(const struct unit *punit))
Definition unitlist.c:95
bool units_can_do_action(const struct unit_list *punits, action_id act_id, bool can_do)
Definition unitlist.c:243
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:291
bool can_units_do_on_map(const struct civ_map *nmap, const struct unit_list *punits, bool(can_fn)(const struct civ_map *nmap, const struct unit *punit))
Definition unitlist.c:111
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1755
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:443
#define enable(id)
Definition widget.h:223