Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-4.0/menu.c Source File

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
73 static GMenu *main_menubar = NULL;
74 static bool menus_built = FALSE;
75
76static GMenu *setup_menus(GtkApplication *app);
77
78static void view_menu_update_sensitivity(GActionMap *map);
79
80 enum menu_entry_grouping { MGROUP_SAFE, MGROUP_EDIT, MGROUP_PLAYING,
81 MGROUP_UNIT, MGROUP_PLAYER, MGROUP_ALL };
82
83 static GMenu *options_menu = NULL;
84 static GMenu *edit_menu = NULL;
85 static GMenu *view_menu = NULL;
86 static GMenu *gov_menu = NULL;
87 static GMenu *unit_menu = NULL;
88 static GMenu *work_menu = NULL;
89 static 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;
96 enum menu_entry_grouping grouping;
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
528 static struct menu_entry_info menu_entries[] =
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,
552 save_options_on_exit_callback, FALSE },
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,
594 edit_mode_callback, FALSE },
595 { "TOGGLE_FOG", N_("Toggle Fog of _War"),
596 "toggle_fog", "<ctrl><shift>w", MGROUP_EDIT,
597 toggle_fog_callback, FALSE },
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,
611 show_city_outlines_callback, FALSE },
612 { "SHOW_CITY_OUTPUT", N_("City Output"),
613 "show_city_output", "<ctrl>v", MGROUP_SAFE,
614 show_city_output_callback, FALSE },
615 { "SHOW_MAP_GRID", N_("Map _Grid"),
616 "show_map_grid", "<ctrl>g", MGROUP_SAFE,
617 show_map_grid_callback, FALSE },
618 { "SHOW_NAT_BORDERS", N_("National _Borders"),
619 "show_nat_borders", "<ctrl>b", MGROUP_SAFE,
620 show_national_borders_callback, FALSE },
621 { "SHOW_NATIVE_TILES", N_("Native Tiles"),
622 "show_native_tiles", "<ctrl><shift>n", MGROUP_SAFE,
623 show_native_tiles_callback, FALSE },
624 { "SHOW_CITY_FULL_BAR", N_("City Full Bar"),
625 "show_city_full_bar", NULL, MGROUP_SAFE,
626 show_city_full_bar_callback, FALSE },
627 { "SHOW_CITY_NAMES", N_("City _Names"),
628 "show_city_names", "<ctrl>n", MGROUP_SAFE,
629 show_city_names_callback, FALSE },
630 { "SHOW_CITY_GROWTH", N_("City G_rowth"),
631 "show_city_growth", "<ctrl>o", MGROUP_SAFE,
632 show_city_growth_callback, FALSE },
633 { "SHOW_CITY_PRODUCTIONS", N_("City _Production"),
634 "show_city_productions", "<ctrl>p", MGROUP_SAFE,
635 show_city_productions_callback, FALSE },
636 { "SHOW_CITY_BUY_COST", N_("City Buy Cost"),
637 "show_city_buy_cost", NULL, MGROUP_SAFE,
638 show_city_buy_cost_callback, FALSE },
639 { "SHOW_CITY_TRADE_ROUTES", N_("City Tra_deroutes"),
640 "show_trade_routes", "<ctrl>d", MGROUP_SAFE,
641 show_city_trade_routes_callback, FALSE },
642 { "SHOW_TERRAIN", N_("_Terrain"),
643 "show_terrain", NULL, MGROUP_SAFE,
644 show_terrain_callback, FALSE },
645 { "SHOW_COASTLINE", N_("C_oastline"),
646 "show_coastline", NULL, MGROUP_SAFE,
647 show_coastline_callback, FALSE },
648 { "SHOW_PATHS", N_("_Paths"),
649 "show_paths", NULL, MGROUP_SAFE,
650 show_paths_callback, FALSE },
651 { "SHOW_IRRIGATION", N_("_Irrigation"),
652 "show_irrigation", NULL, MGROUP_SAFE,
653 show_irrigation_callback, FALSE },
654 { "SHOW_MINES", N_("_Mines"),
655 "show_mines", NULL, MGROUP_SAFE,
656 show_mines_callback, FALSE },
657 { "SHOW_BASES", N_("_Bases"),
658 "show_bases", NULL, MGROUP_SAFE,
659 show_bases_callback, FALSE },
660 { "SHOW_RESOURCES", N_("_Resources"),
661 "show_resources", NULL, MGROUP_SAFE,
662 show_resources_callback, FALSE },
663 { "SHOW_HUTS", N_("_Huts"),
664 "show_huts", NULL, MGROUP_SAFE,
665 show_huts_callback, FALSE },
666 { "SHOW_POLLUTION", N_("Po_llution & Fallout"),
667 "show_pollution", NULL, MGROUP_SAFE,
668 show_pollution_callback, FALSE },
669 { "SHOW_CITIES", N_("Citi_es"),
670 "show_cities", NULL, MGROUP_SAFE,
671 show_cities_callback, FALSE },
672 { "SHOW_UNITS", N_("_Units"),
673 "show_units", NULL, MGROUP_SAFE,
674 show_units_callback, FALSE },
675 { "SHOW_UNIT_SOLID_BG", N_("Unit Solid Background"),
676 "show_unit_solid_bg", NULL, MGROUP_SAFE,
677 show_unit_solid_bg_callback, FALSE },
678 { "SHOW_UNIT_SHIELDS", N_("Unit shields"),
679 "show_unit_shields", NULL, MGROUP_SAFE,
680 show_unit_shields_callback, FALSE },
681 { "SHOW_STACK_SIZE", N_("Unit Stack Size"),
682 "show_stack_size", "<ctrl>plus", MGROUP_SAFE,
683 show_stack_size_callback, FALSE },
684 { "SHOW_FOCUS_UNIT", N_("Focu_s Unit"),
685 "show_focus_unit", NULL, MGROUP_SAFE,
686 show_focus_unit_callback, FALSE },
687 { "SHOW_FOG_OF_WAR", N_("Fog of _War"),
688 "show_fow", NULL, MGROUP_SAFE,
689 show_fog_of_war_callback, FALSE },
690
691 { "FULL_SCREEN", N_("_Fullscreen"),
692 "full_screen", "<ctrl>F11", MGROUP_SAFE,
693 full_screen_callback, FALSE },
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 {
1000 VMENU_CITY_OUTLINES = 0,
1001 VMENU_CITY_OUTPUT,
1002 VMENU_MAP_GRID,
1003 VMENU_NAT_BORDERS,
1004 VMENU_NATIVE_TILES,
1005 VMENU_CITY_FULL_BAR,
1006 VMENU_CITY_NAMES,
1007 VMENU_CITY_GROWTH,
1008 VMENU_CITY_PRODUCTIONS,
1009 VMENU_CITY_BUY_COST,
1010 VMENU_CITY_TRADE_ROUTES,
1011 VMENU_TERRAIN,
1012 VMENU_COASTLINE,
1013 VMENU_PATHS,
1014 VMENU_IRRIGATION,
1015 VMENU_MINES,
1016 VMENU_BASES,
1017 VMENU_RESOURCES,
1018 VMENU_HUTS,
1019 VMENU_POLLUTION,
1020 VMENU_CITIES,
1021 VMENU_UNITS,
1022 VMENU_UNIT_SOLID_BG,
1023 VMENU_UNIT_SHIELDS,
1024 VMENU_STACK_SIZE,
1025 VMENU_FOCUS_UNIT,
1026 VMENU_FOW,
1027 VMENU_FULL_SCREEN
1028};
1029
1030 const 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/************************************************************************/
1154 static void clear_chat_logs_callback(GSimpleAction *action,
1155 GVariant *parameter,
1156 gpointer data)
1157{
1158 clear_output_window();
1159}
1160
1161/************************************************************************/
1164 static void save_chat_logs_callback(GSimpleAction *action,
1165 GVariant *parameter,
1166 gpointer data)
1167{
1168 log_output_window();
1169}
1170
1171/************************************************************************/
1174 static 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/************************************************************************/
1184 static void message_options_callback(GSimpleAction *action,
1185 GVariant *parameter,
1186 gpointer data)
1187{
1188 popup_messageopt_dialog();
1189}
1190
1191/************************************************************************/
1194 static void server_options_callback(GSimpleAction *action,
1195 GVariant *parameter,
1196 gpointer data)
1197{
1198 option_dialog_popup(_("Game Settings"), server_optset);
1199}
1200
1201/************************************************************************/
1204 static void save_options_callback(GSimpleAction *action,
1205 GVariant *parameter,
1206 gpointer data)
1207{
1208 options_save(NULL);
1209}
1210
1211/************************************************************************/
1214 static 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;
1221 gui_options.save_options_on_exit = info->state;
1222
1223 g_menu_remove(options_menu, 4);
1224
1225 menu_item_insert_unref(options_menu, 4,
1226 create_toggle_menu_item(info));
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/************************************************************************/
1244 static void save_game_callback(GSimpleAction *action, GVariant *parameter,
1245 gpointer data)
1246{
1247 send_save_game(NULL);
1248}
1249
1250/************************************************************************/
1253 static void save_game_as_callback(GSimpleAction *action, GVariant *parameter,
1254 gpointer data)
1255{
1256 save_game_dialog_popup();
1257}
1258
1259/************************************************************************/
1262 static void save_mapimg_callback(GSimpleAction *action, GVariant *parameter,
1263 gpointer data)
1264{
1265 mapimg_client_save(NULL);
1266}
1267
1268/************************************************************************/
1271 static void save_mapimg_as_callback(GSimpleAction *action, GVariant *parameter,
1272 gpointer data)
1273{
1274 save_mapimg_dialog_popup();
1275}
1276
1277/************************************************************************/
1281 static 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 */
1288 disconnect_from_server();
1289 }
1290 }
1291}
1292
1293/************************************************************************/
1296 static 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 {
1310 disconnect_from_server();
1311 }
1312}
1313
1314/************************************************************************/
1317 static void quit_callback(GSimpleAction *action,
1318 GVariant *parameter,
1319 gpointer data)
1320{
1321 popup_quit_dialog();
1322}
1323
1324/************************************************************************/
1327 static void find_city_callback(GSimpleAction *action,
1328 GVariant *parameter,
1329 gpointer data)
1330{
1331 popup_find_dialog();
1332}
1333
1334/************************************************************************/
1337 static void worklists_callback(GSimpleAction *action,
1338 GVariant *parameter,
1339 gpointer data)
1340{
1341 popup_worklists_report();
1342}
1343
1344/************************************************************************/
1347 static void map_view_callback(GSimpleAction *action,
1348 GVariant *parameter, gpointer data)
1349{
1350 map_canvas_focus();
1351}
1352
1353/************************************************************************/
1356 static void report_nations_callback(GSimpleAction *action,
1357 GVariant *parameter,
1358 gpointer data)
1359{
1360 popup_players_dialog(TRUE);
1361}
1362
1363/************************************************************************/
1366 static void report_wow_callback(GSimpleAction *action,
1367 GVariant *parameter,
1368 gpointer data)
1369{
1370 send_report_request(REPORT_WONDERS_OF_THE_WORLD);
1371}
1372
1373/************************************************************************/
1376 static void report_top_cities_callback(GSimpleAction *action,
1377 GVariant *parameter,
1378 gpointer data)
1379{
1380 send_report_request(REPORT_TOP_5_CITIES);
1381}
1382
1383/************************************************************************/
1386 static void report_messages_callback(GSimpleAction *action,
1387 GVariant *parameter,
1388 gpointer data)
1389{
1390 meswin_dialog_popup(TRUE);
1391}
1392
1393/************************************************************************/
1396 static void client_lua_script_callback(GSimpleAction *action,
1397 GVariant *parameter,
1398 gpointer data)
1399{
1400 luaconsole_dialog_popup(TRUE);
1401}
1402
1403/************************************************************************/
1406 static void report_demographic_callback(GSimpleAction *action,
1407 GVariant *parameter,
1408 gpointer data)
1409{
1410 send_report_request(REPORT_DEMOGRAPHIC);
1411}
1412
1413/************************************************************************/
1416 static void report_achievements_callback(GSimpleAction *action,
1417 GVariant *parameter,
1418 gpointer data)
1419{
1420 send_report_request(REPORT_ACHIEVEMENTS);
1421}
1422
1423/************************************************************************/
1426 static void help_overview_callback(GSimpleAction *action,
1427 GVariant *parameter,
1428 gpointer data)
1429{
1430 popup_help_dialog_string(HELP_OVERVIEW_ITEM);
1431}
1432
1433/************************************************************************/
1436 static void help_playing_callback(GSimpleAction *action,
1437 GVariant *parameter,
1438 gpointer data)
1439{
1440 popup_help_dialog_string(HELP_PLAYING_ITEM);
1441}
1442
1443/************************************************************************/
1446 static void help_policies_callback(GSimpleAction *action,
1447 GVariant *parameter,
1448 gpointer data)
1449{
1450 popup_help_dialog_string(HELP_MULTIPLIER_ITEM);
1451}
1452
1453/************************************************************************/
1456 static void help_terrain_callback(GSimpleAction *action,
1457 GVariant *parameter,
1458 gpointer data)
1459{
1460 popup_help_dialog_string(HELP_TERRAIN_ITEM);
1461}
1462
1463/************************************************************************/
1466 static void help_economy_callback(GSimpleAction *action,
1467 GVariant *parameter,
1468 gpointer data)
1469{
1470 popup_help_dialog_string(HELP_ECONOMY_ITEM);
1471}
1472
1473/************************************************************************/
1476 static void help_cities_callback(GSimpleAction *action,
1477 GVariant *parameter,
1478 gpointer data)
1479{
1480 popup_help_dialog_string(HELP_CITIES_ITEM);
1481}
1482
1483/************************************************************************/
1486 static void help_improvements_callback(GSimpleAction *action,
1487 GVariant *parameter,
1488 gpointer data)
1489{
1490 popup_help_dialog_string(HELP_IMPROVEMENTS_ITEM);
1491}
1492
1493/************************************************************************/
1496 static void help_wonders_callback(GSimpleAction *action,
1497 GVariant *parameter,
1498 gpointer data)
1499{
1500 popup_help_dialog_string(HELP_WONDERS_ITEM);
1501}
1502
1503/************************************************************************/
1506 static void help_units_callback(GSimpleAction *action,
1507 GVariant *parameter,
1508 gpointer data)
1509{
1510 popup_help_dialog_string(HELP_UNITS_ITEM);
1511}
1512
1513/************************************************************************/
1516 static void help_combat_callback(GSimpleAction *action,
1517 GVariant *parameter,
1518 gpointer data)
1519{
1520 popup_help_dialog_string(HELP_COMBAT_ITEM);
1521}
1522
1523/************************************************************************/
1526 static void help_zoc_callback(GSimpleAction *action,
1527 GVariant *parameter,
1528 gpointer data)
1529{
1530 popup_help_dialog_string(HELP_ZOC_ITEM);
1531}
1532
1533/************************************************************************/
1536 static void help_government_callback(GSimpleAction *action,
1537 GVariant *parameter,
1538 gpointer data)
1539{
1540 popup_help_dialog_string(HELP_GOVERNMENT_ITEM);
1541}
1542
1543/************************************************************************/
1546 static void help_diplomacy_callback(GSimpleAction *action,
1547 GVariant *parameter,
1548 gpointer data)
1549{
1550 popup_help_dialog_string(HELP_DIPLOMACY_ITEM);
1551}
1552
1553/************************************************************************/
1556 static void help_tech_callback(GSimpleAction *action,
1557 GVariant *parameter,
1558 gpointer data)
1559{
1560 popup_help_dialog_string(HELP_TECHS_ITEM);
1561}
1562
1563/************************************************************************/
1566 static void help_space_race_callback(GSimpleAction *action,
1567 GVariant *parameter,
1568 gpointer data)
1569{
1570 popup_help_dialog_string(HELP_SPACE_RACE_ITEM);
1571}
1572
1573/************************************************************************/
1576 static void help_ruleset_callback(GSimpleAction *action,
1577 GVariant *parameter,
1578 gpointer data)
1579{
1580 popup_help_dialog_string(HELP_RULESET_ITEM);
1581}
1582
1583/************************************************************************/
1586 static void help_tileset_callback(GSimpleAction *action,
1587 GVariant *parameter,
1588 gpointer data)
1589{
1590 popup_help_dialog_string(HELP_TILESET_ITEM);
1591}
1592
1593/************************************************************************/
1596 static void help_nations_callback(GSimpleAction *action,
1597 GVariant *parameter,
1598 gpointer data)
1599{
1600 popup_help_dialog_string(HELP_NATIONS_ITEM);
1601}
1602
1603/************************************************************************/
1606 static void help_connecting_callback(GSimpleAction *action,
1607 GVariant *parameter,
1608 gpointer data)
1609{
1610 popup_help_dialog_string(HELP_CONNECTING_ITEM);
1611}
1612
1613/************************************************************************/
1616 static void help_controls_callback(GSimpleAction *action,
1617 GVariant *parameter,
1618 gpointer data)
1619{
1620 popup_help_dialog_string(HELP_CONTROLS_ITEM);
1621}
1622
1623/************************************************************************/
1626 static void help_governor_callback(GSimpleAction *action,
1627 GVariant *parameter,
1628 gpointer data)
1629{
1630 popup_help_dialog_string(HELP_CMA_ITEM);
1631}
1632
1633/************************************************************************/
1636 static void help_chatline_callback(GSimpleAction *action,
1637 GVariant *parameter,
1638 gpointer data)
1639{
1640 popup_help_dialog_string(HELP_CHATLINE_ITEM);
1641}
1642
1643/************************************************************************/
1646 static void help_worklist_editor_callback(GSimpleAction *action,
1647 GVariant *parameter,
1648 gpointer data)
1649{
1650 popup_help_dialog_string(HELP_WORKLIST_EDITOR_ITEM);
1651}
1652
1653/************************************************************************/
1656 static void help_language_callback(GSimpleAction *action,
1657 GVariant *parameter,
1658 gpointer data)
1659{
1660 popup_help_dialog_string(HELP_LANGUAGES_ITEM);
1661}
1662
1663/************************************************************************/
1666 static void help_copying_callback(GSimpleAction *action,
1667 GVariant *parameter,
1668 gpointer data)
1669{
1670 popup_help_dialog_string(HELP_COPYING_ITEM);
1671}
1672
1673/************************************************************************/
1676 static void help_about_callback(GSimpleAction *action,
1677 GVariant *parameter,
1678 gpointer data)
1679{
1680 popup_help_dialog_string(HELP_ABOUT_ITEM);
1681}
1682
1683/************************************************************************/
1686 static void edit_mode_callback(GSimpleAction *action,
1687 GVariant *parameter,
1688 gpointer data)
1689{
1690 key_editor_toggle();
1691
1692 /* Unreachable techs in reqtree on/off */
1693 science_report_dialog_popdown();
1694}
1695
1696 struct menu_entry_option_map {
1697 const char *menu_entry;
1698 bool *option;
1699 int menu_pos;
1700};
1701
1702 const struct menu_entry_option_map meoms[] = {
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,
1716 VMENU_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,
1719 VMENU_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/************************************************************************/
1743 static 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);
1763 menu_item_insert_unref(view_menu, meoms[i].menu_pos,
1764 create_toggle_menu_item_for_key(info->key));
1765 return;
1766 }
1767 }
1768}
1769
1770/************************************************************************/
1773 static void show_city_outlines_callback(GSimpleAction *action,
1774 GVariant *parameter,
1775 gpointer data)
1776{
1777 view_menu_item_toggle(key_city_outlines_toggle, FALSE, data);
1778}
1779
1780/************************************************************************/
1783 static void show_city_output_callback(GSimpleAction *action,
1784 GVariant *parameter,
1785 gpointer data)
1786{
1787 view_menu_item_toggle(key_city_output_toggle, FALSE, data);
1788}
1789
1790/************************************************************************/
1793 static void show_map_grid_callback(GSimpleAction *action, GVariant *parameter,
1794 gpointer data)
1795{
1796 view_menu_item_toggle(key_map_grid_toggle, FALSE, data);
1797}
1798
1799/************************************************************************/
1802 static void show_national_borders_callback(GSimpleAction *action,
1803 GVariant *parameter,
1804 gpointer data)
1805{
1806 view_menu_item_toggle(key_map_borders_toggle, FALSE, data);
1807}
1808
1809/************************************************************************/
1812 static void show_native_tiles_callback(GSimpleAction *action,
1813 GVariant *parameter,
1814 gpointer data)
1815{
1816 view_menu_item_toggle(key_map_native_toggle, FALSE, data);
1817}
1818
1819/************************************************************************/
1822 static void show_city_full_bar_callback(GSimpleAction *action,
1823 GVariant *parameter,
1824 gpointer data)
1825{
1826 view_menu_item_toggle(key_city_full_bar_toggle, TRUE, data);
1827}
1828
1829/************************************************************************/
1832 static void show_city_names_callback(GSimpleAction *action,
1833 GVariant *parameter,
1834 gpointer data)
1835{
1836 view_menu_item_toggle(key_city_names_toggle, TRUE, data);
1837}
1838
1839/************************************************************************/
1842 static void show_city_growth_callback(GSimpleAction *action,
1843 GVariant *parameter,
1844 gpointer data)
1845{
1846 view_menu_item_toggle(key_city_growth_toggle, FALSE, data);
1847}
1848
1849/************************************************************************/
1852 static void show_city_productions_callback(GSimpleAction *action,
1853 GVariant *parameter,
1854 gpointer data)
1855{
1856 view_menu_item_toggle(key_city_productions_toggle, TRUE, data);
1857}
1858
1859/************************************************************************/
1862 static void show_city_buy_cost_callback(GSimpleAction *action,
1863 GVariant *parameter,
1864 gpointer data)
1865{
1866 view_menu_item_toggle(key_city_buycost_toggle, FALSE, data);
1867}
1868
1869/************************************************************************/
1872 static void show_city_trade_routes_callback(GSimpleAction *action,
1873 GVariant *parameter,
1874 gpointer data)
1875{
1876 view_menu_item_toggle(key_city_trade_routes_toggle, FALSE, data);
1877}
1878
1879/************************************************************************/
1882 static void show_terrain_callback(GSimpleAction *action,
1883 GVariant *parameter,
1884 gpointer data)
1885{
1886 view_menu_item_toggle(key_terrain_toggle, TRUE, data);
1887}
1888
1889/************************************************************************/
1892 static void show_coastline_callback(GSimpleAction *action,
1893 GVariant *parameter,
1894 gpointer data)
1895{
1896 view_menu_item_toggle(key_coastline_toggle, FALSE, data);
1897}
1898
1899/************************************************************************/
1902 static void show_paths_callback(GSimpleAction *action,
1903 GVariant *parameter,
1904 gpointer data)
1905{
1906 view_menu_item_toggle(key_roads_rails_toggle, FALSE, data);
1907}
1908
1909/************************************************************************/
1912 static void show_irrigation_callback(GSimpleAction *action,
1913 GVariant *parameter,
1914 gpointer data)
1915{
1916 view_menu_item_toggle(key_irrigation_toggle, FALSE, data);
1917}
1918
1919/************************************************************************/
1922 static void show_mines_callback(GSimpleAction *action,
1923 GVariant *parameter,
1924 gpointer data)
1925{
1926 view_menu_item_toggle(key_mines_toggle, FALSE, data);
1927}
1928
1929/************************************************************************/
1932 static void show_bases_callback(GSimpleAction *action, GVariant *parameter,
1933 gpointer data)
1934{
1935 view_menu_item_toggle(key_bases_toggle, FALSE, data);
1936}
1937
1938/************************************************************************/
1941 static void show_resources_callback(GSimpleAction *action,
1942 GVariant *parameter,
1943 gpointer data)
1944{
1945 view_menu_item_toggle(key_resources_toggle, FALSE, data);
1946}
1947
1948/************************************************************************/
1951 static void show_huts_callback(GSimpleAction *action, GVariant *parameter,
1952 gpointer data)
1953{
1954 view_menu_item_toggle(key_huts_toggle, FALSE, data);
1955}
1956
1957/************************************************************************/
1960 static void show_pollution_callback(GSimpleAction *action, GVariant *parameter,
1961 gpointer data)
1962{
1963 view_menu_item_toggle(key_pollution_toggle, FALSE, data);
1964}
1965
1966/************************************************************************/
1969 static void show_cities_callback(GSimpleAction *action, GVariant *parameter,
1970 gpointer data)
1971{
1972 view_menu_item_toggle(key_cities_toggle, FALSE, data);
1973}
1974
1975/************************************************************************/
1978 static void show_units_callback(GSimpleAction *action, GVariant *parameter,
1979 gpointer data)
1980{
1981 view_menu_item_toggle(key_units_toggle, TRUE, data);
1982}
1983
1984/************************************************************************/
1987 static void show_unit_solid_bg_callback(GSimpleAction *action,
1988 GVariant *parameter,
1989 gpointer data)
1990{
1991 view_menu_item_toggle(key_unit_solid_bg_toggle, FALSE, data);
1992}
1993
1994/************************************************************************/
1997 static void show_unit_shields_callback(GSimpleAction *action,
1998 GVariant *parameter,
1999 gpointer data)
2000{
2001 view_menu_item_toggle(key_unit_shields_toggle, FALSE, data);
2002}
2003
2004/************************************************************************/
2007 static void show_stack_size_callback(GSimpleAction *action,
2008 GVariant *parameter,
2009 gpointer data)
2010{
2011 view_menu_item_toggle(key_unit_stack_size_toggle, FALSE, data);
2012}
2013
2014/************************************************************************/
2017 static void show_focus_unit_callback(GSimpleAction *action,
2018 GVariant *parameter,
2019 gpointer data)
2020{
2021 view_menu_item_toggle(key_focus_unit_toggle, TRUE, data);
2022}
2023
2024/************************************************************************/
2027 static void show_fog_of_war_callback(GSimpleAction *action, GVariant *parameter,
2028 gpointer data)
2029{
2030 view_menu_item_toggle(key_fog_of_war_toggle, TRUE, data);
2031}
2032
2033/************************************************************************/
2036 static 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
2044 fullscreen_opt_refresh(NULL);
2045
2046 g_menu_remove(view_menu, VMENU_FULL_SCREEN);
2047
2048 menu_item_insert_unref(view_menu, VMENU_FULL_SCREEN,
2049 create_toggle_menu_item(info));
2050}
2051
2052/************************************************************************/
2055 static 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. */
2063 key_editor_toggle_fogofwar();
2064
2065 g_menu_remove(edit_menu, 5);
2066
2067 menu_item_insert_unref(edit_menu, 5,
2068 create_toggle_menu_item(info));
2069}
2070
2071/************************************************************************/
2074 static void scenario_properties_callback(GSimpleAction *action,
2075 GVariant *parameter,
2076 gpointer data)
2077{
2078 struct property_editor *pe;
2079
2080 pe = editprop_get_property_editor();
2081 property_editor_reload(pe, OBJTYPE_GAME);
2082 property_editor_popup(pe, OBJTYPE_GAME);
2083}
2084
2085/************************************************************************/
2088 static void save_scenario_callback(GSimpleAction *action, GVariant *parameter,
2089 gpointer data)
2090{
2091 save_scenario_dialog_popup();
2092}
2093
2094/************************************************************************/
2097 static 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/************************************************************************/
2106 static 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/************************************************************************/
2116 static 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/************************************************************************/
2126 static 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/************************************************************************/
2136 static 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/************************************************************************/
2146 static void select_dialog_callback(GSimpleAction *action,
2147 GVariant *parameter,
2148 gpointer data)
2149{
2150 unit_select_dialog_popup(NULL);
2151}
2152
2153/************************************************************************/
2156 static void rally_dialog_callback(GSimpleAction *action,
2157 GVariant *parameter,
2158 gpointer data)
2159{
2160 rally_dialog_popup();
2161}
2162
2163/************************************************************************/
2166 static void infra_dialog_callback(GSimpleAction *action,
2167 GVariant *parameter,
2168 gpointer data)
2169{
2170 infra_dialog_popup();
2171}
2172
2173/************************************************************************/
2176 static void unit_wait_callback(GSimpleAction *action,
2177 GVariant *parameter,
2178 gpointer data)
2179{
2180 key_unit_wait();
2181}
2182
2183/************************************************************************/
2186 static void unit_done_callback(GSimpleAction *action,
2187 GVariant *parameter,
2188 gpointer data)
2189{
2190 key_unit_done();
2191}
2192
2193/************************************************************************/
2196 static void unit_goto_callback(GSimpleAction *action, GVariant *parameter,
2197 gpointer data)
2198{
2199 key_unit_goto();
2200}
2201
2202/************************************************************************/
2205 static 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/************************************************************************/
2255 static void unit_goto_city_callback(GSimpleAction *action,
2256 GVariant *parameter,
2257 gpointer data)
2258{
2259 if (get_num_units_in_focus() > 0) {
2260 popup_goto_dialog();
2261 }
2262}
2263
2264/************************************************************************/
2267 static void unit_return_callback(GSimpleAction *action,
2268 GVariant *parameter,
2269 gpointer data)
2270{
2271 unit_list_iterate(get_units_in_focus(), punit) {
2272 request_unit_return(punit);
2273 } unit_list_iterate_end;
2274}
2275
2276/************************************************************************/
2279 static void unit_explore_callback(GSimpleAction *action,
2280 GVariant *parameter,
2281 gpointer data)
2282{
2283 key_unit_auto_explore();
2284}
2285
2286/************************************************************************/
2289 static void unit_patrol_callback(GSimpleAction *action, GVariant *parameter,
2290 gpointer data)
2291{
2292 key_unit_patrol();
2293}
2294
2295/************************************************************************/
2298 static void unit_sentry_callback(GSimpleAction *action,
2299 GVariant *parameter,
2300 gpointer data)
2301{
2302 key_unit_sentry();
2303}
2304
2305/************************************************************************/
2308 static void unsentry_all_callback(GSimpleAction *action,
2309 GVariant *parameter,
2310 gpointer data)
2311{
2312 key_unit_wakeup_others();
2313}
2314
2315/************************************************************************/
2318 static void fortify_callback(GSimpleAction *action,
2319 GVariant *parameter,
2320 gpointer data)
2321{
2322 unit_list_iterate(get_units_in_focus(), punit) {
2323 request_unit_fortify(punit);
2324 } unit_list_iterate_end;
2325}
2326
2327/************************************************************************/
2330 static void unit_board_callback(GSimpleAction *action, GVariant *parameter,
2331 gpointer data)
2332{
2333 unit_list_iterate(get_units_in_focus(), punit) {
2334 request_transport(punit, unit_tile(punit));
2335 } unit_list_iterate_end;
2336}
2337
2338/************************************************************************/
2341 static void unit_deboard_callback(GSimpleAction *action, GVariant *parameter,
2342 gpointer data)
2343{
2344 unit_list_iterate(get_units_in_focus(), punit) {
2345 request_unit_unload(punit);
2346 } unit_list_iterate_end;
2347}
2348
2349/************************************************************************/
2352 static void unit_unload_transporter_callback(GSimpleAction *action,
2353 GVariant *parameter,
2354 gpointer data)
2355{
2356 key_unit_unload_all();
2357}
2358
2359/************************************************************************/
2362 static void unit_homecity_callback(GSimpleAction *action,
2363 GVariant *parameter,
2364 gpointer data)
2365{
2366 key_unit_homecity();
2367}
2368
2369/************************************************************************/
2372 static void unit_upgrade_callback(GSimpleAction *action,
2373 GVariant *parameter,
2374 gpointer data)
2375{
2376 popup_upgrade_dialog(get_units_in_focus());
2377}
2378
2379/************************************************************************/
2382 static void unit_convert_callback(GSimpleAction *action,
2383 GVariant *parameter,
2384 gpointer data)
2385{
2386 key_unit_convert();
2387}
2388
2389/************************************************************************/
2392 static void unit_disband_callback(GSimpleAction *action,
2393 GVariant *parameter,
2394 gpointer data)
2395{
2396 popup_disband_dialog(get_units_in_focus());
2397}
2398
2399/************************************************************************/
2402 static void build_city_callback(GSimpleAction *action,
2403 GVariant *parameter,
2404 gpointer data)
2405{
2406 unit_list_iterate(get_units_in_focus(), punit) {
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. */
2411 if (unit_can_add_or_build_city(punit)) {
2412 request_unit_build_city(punit);
2413 } else if (utype_can_do_action(unit_type_get(punit),
2414 ACTION_HELP_WONDER)) {
2415 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
2416 }
2417 } unit_list_iterate_end;
2418}
2419
2420/************************************************************************/
2423 static void auto_settle_callback(GSimpleAction *action,
2424 GVariant *parameter,
2425 gpointer data)
2426{
2427 key_unit_auto_settle();
2428}
2429
2430/************************************************************************/
2433 static void build_road_callback(GSimpleAction *action,
2434 GVariant *parameter,
2435 gpointer data)
2436{
2437 unit_list_iterate(get_units_in_focus(), punit) {
2438 /* FIXME: this can provide different actions for different units...
2439 * not good! */
2440 struct extra_type *tgt = next_extra_for_tile(unit_tile(punit),
2441 EC_ROAD,
2442 unit_owner(punit),
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 }
2455 } unit_list_iterate_end;
2456}
2457
2458/************************************************************************/
2461 static void build_irrigation_callback(GSimpleAction *action,
2462 GVariant *parameter,
2463 gpointer data)
2464{
2465 key_unit_irrigate();
2466}
2467
2468/************************************************************************/
2471 static void cultivate_callback(GSimpleAction *action,
2472 GVariant *parameter,
2473 gpointer data)
2474{
2475 key_unit_cultivate();
2476}
2477
2478/************************************************************************/
2481 static void plant_callback(GSimpleAction *action,
2482 GVariant *parameter,
2483 gpointer data)
2484{
2485 key_unit_plant();
2486}
2487
2488/************************************************************************/
2491 static void build_mine_callback(GSimpleAction *action,
2492 GVariant *parameter,
2493 gpointer data)
2494{
2495 key_unit_mine();
2496}
2497
2498/************************************************************************/
2501 static 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/************************************************************************/
2519 static 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/************************************************************************/
2537 static 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/************************************************************************/
2555 static 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/************************************************************************/
2573 static void transform_terrain_callback(GSimpleAction *action,
2574 GVariant *parameter,
2575 gpointer data)
2576{
2577 key_unit_transform();
2578}
2579
2580/************************************************************************/
2583 static void clean_callback(GSimpleAction *action, GVariant *parameter,
2584 gpointer data)
2585{
2586 key_unit_clean();
2587}
2588
2589/************************************************************************/
2592 static void build_fortress_callback(GSimpleAction *action, GVariant *parameter,
2593 gpointer data)
2594{
2595 key_unit_fortress();
2596}
2597
2598/************************************************************************/
2601 static void build_airbase_callback(GSimpleAction *action, GVariant *parameter,
2602 gpointer data)
2603{
2604 key_unit_airbase();
2605}
2606
2607/************************************************************************/
2610 static void paradrop_callback(GSimpleAction *action,
2611 GVariant *parameter,
2612 gpointer data)
2613{
2614 key_unit_paradrop();
2615}
2616
2617/************************************************************************/
2620 static void pillage_callback(GSimpleAction *action,
2621 GVariant *parameter,
2622 gpointer data)
2623{
2624 key_unit_pillage();
2625}
2626
2627/************************************************************************/
2630 static void do_action_callback(GSimpleAction *action,
2631 GVariant *parameter,
2632 gpointer data)
2633{
2634 key_unit_action_select_tgt();
2635}
2636
2637/************************************************************************/
2640 static void tax_rate_callback(GSimpleAction *action, GVariant *parameter,
2641 gpointer data)
2642{
2643 popup_rates_dialog();
2644}
2645
2646/************************************************************************/
2649 static void multiplier_callback(GSimpleAction *action, GVariant *parameter,
2650 gpointer data)
2651{
2652 popup_multiplier_dialog();
2653}
2654
2655/************************************************************************/
2658 static void government_callback(GSimpleAction *action,
2659 GVariant *parameter,
2660 gpointer data)
2661{
2662 popup_revolution_dialog((struct government *) data);
2663}
2664
2665/************************************************************************/
2668 static void revolution_callback(GSimpleAction *action,
2669 GVariant *parameter,
2670 gpointer data)
2671{
2672 popup_revolution_dialog(NULL);
2673}
2674
2675/************************************************************************/
2678 static void base_callback(GSimpleAction *action,
2679 GVariant *parameter,
2680 gpointer data)
2681{
2682 struct extra_type *pextra = data;
2683
2684 unit_list_iterate(get_units_in_focus(), punit) {
2685 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
2686 } unit_list_iterate_end;
2687}
2688
2689/************************************************************************/
2692 static void road_callback(GSimpleAction *action,
2693 GVariant *parameter,
2694 gpointer data)
2695{
2696 struct extra_type *pextra = data;
2697
2698 unit_list_iterate(get_units_in_focus(), punit) {
2699 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD,
2700 pextra);
2701 } unit_list_iterate_end;
2702}
2703
2704/************************************************************************/
2707 static void irrigation_callback(GSimpleAction *action,
2708 GVariant *parameter,
2709 gpointer data)
2710{
2711 struct extra_type *pextra = data;
2712
2713 unit_list_iterate(get_units_in_focus(), punit) {
2714 request_new_unit_activity_targeted(punit, ACTIVITY_IRRIGATE,
2715 pextra);
2716 } unit_list_iterate_end;
2717}
2718
2719/************************************************************************/
2722 static void mine_callback(GSimpleAction *action,
2723 GVariant *parameter,
2724 gpointer data)
2725{
2726 struct extra_type *pextra = data;
2727
2728 unit_list_iterate(get_units_in_focus(), punit) {
2729 request_new_unit_activity_targeted(punit, ACTIVITY_MINE,
2730 pextra);
2731 } unit_list_iterate_end;
2732}
2733
2734/************************************************************************/
2737 static void clean_menu_callback(GSimpleAction *action,
2738 GVariant *parameter,
2739 gpointer data)
2740{
2741 struct extra_type *pextra = data;
2742
2743 unit_list_iterate(get_units_in_focus(), punit) {
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 }
2751 } unit_list_iterate_end;
2752}
2753
2754/************************************************************************/
2757 static void center_view_callback(GSimpleAction *action,
2758 GVariant *parameter,
2759 gpointer data)
2760{
2761 center_on_unit();
2762}
2763
2764/************************************************************************/
2767 static void report_units_callback(GSimpleAction *action,
2768 GVariant *parameter,
2769 gpointer data)
2770{
2771 units_report_dialog_popup(TRUE);
2772}
2773
2774/************************************************************************/
2777 static void report_cities_callback(GSimpleAction *action,
2778 GVariant *parameter,
2779 gpointer data)
2780
2781{
2782 city_report_dialog_popup(TRUE);
2783}
2784
2785/************************************************************************/
2788 static void report_economy_callback(GSimpleAction *action,
2789 GVariant *parameter,
2790 gpointer data)
2791{
2792 economy_report_dialog_popup(TRUE);
2793}
2794
2795/************************************************************************/
2798 static void report_research_callback(GSimpleAction *action,
2799 GVariant *parameter,
2800 gpointer data)
2801{
2802 science_report_dialog_popup(TRUE);
2803}
2804
2805/************************************************************************/
2808 static void report_spaceship_callback(GSimpleAction *action,
2809 GVariant *parameter,
2810 gpointer data)
2811{
2812 if (NULL != client.conn.playing) {
2813 popup_spaceship_dialog(client.conn.playing);
2814 }
2815}
2816
2817/************************************************************************/
2820 static 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/************************************************************************/
2830 static 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/************************************************************************/
2840 static 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/************************************************************************/
2851 static 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/************************************************************************/
2874 static GMenuItem *create_toggle_menu_item_for_key(const char *key)
2875{
2876 return create_toggle_menu_item(menu_entry_info_find(key));
2877}
2878
2879/************************************************************************/
2882 static void menu_entry_init(GMenu *sub, const char *key)
2883{
2884 struct menu_entry_info *info = menu_entry_info_find(key);
2885
2886 if (info != NULL) {
2887 GMenuItem *item;
2888
2889 if (info->toggle != NULL) {
2890 item = create_toggle_menu_item(info);
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/************************************************************************/
2907 void menus_set_initial_toggle_values(void)
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/************************************************************************/
2925 static 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/************************************************************************/
2965 static 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/************************************************************************/
2992 static GMenu *setup_menus(GtkApplication *app)
2993{
2994 GMenu *menubar;
2995 GMenu *topmenu;
2996 GMenu *submenu;
2997 int i;
2998
2999 fc_assert(!menus_built);
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
3237 real_menus_update();
3238
3239 return menubar;
3240}
3241
3242/************************************************************************/
3245 static 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/************************************************************************/
3261 static 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/************************************************************************/
3275 static void menu_entry_set_sensitive(GActionMap *map,
3276 const char *key,
3277 gboolean is_enabled)
3278{
3279 struct menu_entry_info *info = menu_entry_info_find(key);
3280
3281 if (info != NULL) {
3282 menu_entry_set_sensitive_info(map, info, is_enabled);
3283 }
3284}
3285
3286/************************************************************************/
3289 static 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/************************************************************************/
3305 static void menus_rename(GMenu *parent, int index, const char *key,
3306 const char *new_name)
3307{
3308 struct menu_entry_info *info = menu_entry_info_find(key);
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/************************************************************************/
3325 static 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. */
3330 if (gui_options.draw_full_citybar) {
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",
3336 gui_options.draw_city_names);
3337 }
3338
3339 menu_entry_set_sensitive(map, "SHOW_CITY_BUY_COST",
3340 gui_options.draw_city_productions);
3341 menu_entry_set_sensitive(map, "SHOW_COASTLINE", !gui_options.draw_terrain);
3342 menu_entry_set_sensitive(map, "SHOW_UNIT_SOLID_BG",
3343 gui_options.draw_units || gui_options.draw_focus_unit);
3344 menu_entry_set_sensitive(map, "SHOW_UNIT_SHIELDS",
3345 gui_options.draw_units || gui_options.draw_focus_unit);
3346 menu_entry_set_sensitive(map, "SHOW_FOCUS_UNIT", !gui_options.draw_units);
3347}
3348
3349/************************************************************************/
3355 static 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/************************************************************************/
3371 void real_menus_update(void)
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
3385 if (!menus_built || client_state() == C_S_DISCONNECTED) {
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",
3449 improvement_name_translation(pimpr));
3450 } improvement_iterate_end;
3451 break;
3452 case ASTK_TECH:
3453 advance_iterate(A_FIRST, ptech) {
3454 CREATE_SUB_ITEM(ptech, "end_tech",
3455 advance_name_translation(ptech));
3456 } advance_iterate_end;
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));
3468 } extra_type_iterate_end;
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 }
3488 } action_iterate_end;
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
3495 if (untargeted_revolution_allowed()) {
3496 menu_entry_init(submenu, "START_REVOLUTION");
3497 }
3498
3499 i = 0;
3500 governments_iterate(g) {
3501 if (g != game.government_during_revolution) {
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..."),
3514 government_name_translation(g));
3515 fc_snprintf(actname, sizeof(actname), "app.government_%d", i++);
3516 menu_item_append_unref(submenu, g_menu_item_new(name, actname));
3517 }
3518 } governments_iterate_end;
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,
3532 can_units_do_activity_targeted_client(punits,
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 }
3542 } extra_type_by_cause_iterate_end;
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,
3557 can_units_do_activity_targeted_client(punits,
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 }
3567 } extra_type_by_cause_iterate_end;
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,
3582 can_units_do_activity_targeted_client(punits,
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 }
3592 } extra_type_by_cause_iterate_end;
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,
3606 can_units_do_activity_targeted_client(punits,
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));
3615 } extra_type_by_rmcause_iterate_end;
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,
3624 can_units_do_activity_targeted_client(punits,
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));
3633 } extra_type_by_rmcause_iterate_end;
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,
3649 can_units_do_activity_targeted_client(punits,
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 }
3659 } extra_type_by_cause_iterate_end;
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 }
3692 } unit_list_iterate_end;
3693 }
3694
3695 menu_entry_group_set_sensitive(map, MGROUP_EDIT, editor_is_active());
3696 menu_entry_group_set_sensitive(map, MGROUP_PLAYING,
3697 can_client_issue_orders() && !editor_is_active());
3698 menu_entry_group_set_sensitive(map, MGROUP_UNIT,
3699 num_units > 0
3700 && can_client_issue_orders()
3701 && !editor_is_active());
3702
3703 menu_entry_set_sensitive(map, "GAME_SAVE_AS",
3704 can_client_access_hack() && C_S_RUNNING <= client_state());
3705 menu_entry_set_sensitive(map, "GAME_SAVE",
3706 can_client_access_hack() && C_S_RUNNING <= client_state());
3707
3708 menu_entry_set_sensitive(map, "SERVER_OPTIONS", client.conn.established);
3709
3710 menu_entry_set_sensitive(map, "LEAVE",
3711 client.conn.established);
3712
3713 menu_entry_set_sensitive(map, "RALLY_DLG", can_client_issue_orders());
3714 menu_entry_set_sensitive(map, "INFRA_DLG", terrain_control.infrapoints);
3715
3716 menu_entry_set_sensitive(map, "POLICIES", multiplier_count() > 0);
3717
3718 info = menu_entry_info_find("EDIT_MODE");
3719 if (info->state != game.info.is_edit_mode) {
3720 info->state = game.info.is_edit_mode;
3721 g_menu_remove(edit_menu, 4);
3722 menu_item_insert_unref(edit_menu, 4,
3723 create_toggle_menu_item(info));
3724
3725 menu_entry_set_sensitive(map, "EDIT_MODE",
3726 can_conn_enable_editing(&client.conn));
3727 editgui_refresh();
3728 }
3729
3730 {
3731 char road_buf[500];
3732
3733 proad = road_by_gui_type(ROAD_GUI_ROAD);
3734 if (proad != NULL) {
3735 /* TRANS: Connect with some road type (Road/Railroad) */
3736 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3737 extra_name_translation(road_extra_get(proad)));
3738 menus_rename(work_menu, 12, "CONNECT_ROAD", road_buf);
3739 }
3740
3741 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3742 if (proad != NULL) {
3743 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3744 extra_name_translation(road_extra_get(proad)));
3745 menus_rename(work_menu, 13, "CONNECT_RAIL", road_buf);
3746 }
3747 }
3748
3749 if (!can_client_issue_orders()) {
3750 return;
3751 }
3752
3753 if (!punits) {
3754 return;
3755 }
3756
3757 /* Remaining part of this function: Update Unit, Work, and Combat menus */
3758
3759 /* Enable the button for adding to a city in all cases, so we
3760 * get an eventual error message from the server if we try. */
3761 menu_entry_set_sensitive(map, "BUILD_CITY",
3762 (can_units_do(punits, unit_can_add_or_build_city)
3763 || can_units_do(punits, unit_can_help_build_wonder_here)));
3764
3765 menu_entry_set_sensitive(map, "DO_ACTION",
3766 units_can_do_action(punits, ACTION_ANY, TRUE));
3767
3768 menu_entry_set_sensitive(map, "BUILD_ROAD",
3769 (can_units_do_any_road(&(wld.map), punits)
3770 || can_units_do(punits,
3771 unit_can_est_trade_route_here)));
3772 menu_entry_set_sensitive(map, "BUILD_IRRIGATION",
3773 can_units_do_activity_client(punits, ACTIVITY_IRRIGATE));
3774 menu_entry_set_sensitive(map, "BUILD_MINE",
3775 can_units_do_activity_client(punits, ACTIVITY_MINE));
3776 menu_entry_set_sensitive(map, "CULTIVATE",
3777 can_units_do_activity_client(punits, ACTIVITY_CULTIVATE));
3778 menu_entry_set_sensitive(map, "PLANT",
3779 can_units_do_activity_client(punits, ACTIVITY_PLANT));
3780 menu_entry_set_sensitive(map, "TRANSFORM_TERRAIN",
3781 can_units_do_activity_client(punits, ACTIVITY_TRANSFORM));
3782 menu_entry_set_sensitive(map, "FORTIFY",
3783 can_units_do_activity_client(punits,
3784 ACTIVITY_FORTIFYING));
3785 menu_entry_set_sensitive(map, "PARADROP",
3786 can_units_do_on_map(&(wld.map), punits, can_unit_paradrop));
3787 menu_entry_set_sensitive(map, "PILLAGE",
3788 can_units_do_activity_client(punits, ACTIVITY_PILLAGE));
3789 menu_entry_set_sensitive(map, "CLEAN",
3790 can_units_do_activity_client(punits, ACTIVITY_POLLUTION)
3791 || can_units_do_activity_client(punits, ACTIVITY_FALLOUT));
3792 menu_entry_set_sensitive(map, "BUILD_FORTRESS",
3793 can_units_do_base_gui(punits, BASE_GUI_FORTRESS));
3794 menu_entry_set_sensitive(map, "BUILD_AIRBASE",
3795 can_units_do_base_gui(punits, BASE_GUI_AIRBASE));
3796 menu_entry_set_sensitive(map, "UNIT_SENTRY",
3797 can_units_do_activity_client(punits, ACTIVITY_SENTRY));
3798 menu_entry_set_sensitive(map, "UNSENTRY_ALL",
3799 units_have_activity_on_tile(punits,
3800 ACTIVITY_SENTRY));
3801 menu_entry_set_sensitive(map, "UNIT_HOMECITY",
3802 can_units_do(punits, can_unit_change_homecity));
3803 menu_entry_set_sensitive(map, "UNIT_UPGRADE", units_can_upgrade(&(wld.map), punits));
3804 menu_entry_set_sensitive(map, "UNIT_CONVERT", units_can_convert(&(wld.map), punits));
3805 menu_entry_set_sensitive(map, "UNIT_DISBAND",
3806 units_can_do_action(punits, ACTION_DISBAND_UNIT,
3807 TRUE));
3808
3809 menu_entry_set_sensitive(map, "AUTO_SETTLER",
3810 can_units_do(punits, can_unit_do_autosettlers));
3811 menu_entry_set_sensitive(map, "UNIT_EXPLORE",
3812 can_units_do_activity_client(punits, ACTIVITY_EXPLORE));
3813 menu_entry_set_sensitive(map, "UNIT_BOARD",
3814 units_can_load(punits));
3815 menu_entry_set_sensitive(map, "UNIT_DEBOARD",
3816 units_can_unload(punits));
3817 menu_entry_set_sensitive(map, "UNIT_UNLOAD_TRANSPORTER",
3818 units_are_occupied(punits));
3819
3820 proad = road_by_gui_type(ROAD_GUI_ROAD);
3821 if (proad != NULL) {
3822 struct extra_type *tgt;
3823
3824 tgt = road_extra_get(proad);
3825
3826 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3827 } else {
3828 conn_possible = FALSE;
3829 }
3830 menu_entry_set_sensitive(map, "CONNECT_ROAD", conn_possible);
3831
3832 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3833 if (proad != NULL) {
3834 struct extra_type *tgt;
3835
3836 tgt = road_extra_get(proad);
3837
3838 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3839 } else {
3840 conn_possible = FALSE;
3841 }
3842 menu_entry_set_sensitive(map, "CONNECT_RAIL", conn_possible);
3843
3844 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
3845 if (proad != NULL) {
3846 struct extra_type *tgt;
3847
3848 tgt = road_extra_get(proad);
3849
3850 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3851 } else {
3852 conn_possible = FALSE;
3853 }
3854 menu_entry_set_sensitive(map, "CONNECT_MAGLEV", conn_possible);
3855
3856 extras = extra_type_list_by_cause(EC_IRRIGATION);
3857
3858 if (extra_type_list_size(extras) > 0) {
3859 struct extra_type *tgt;
3860
3861 tgt = extra_type_list_get(extras, 0);
3862 conn_possible = can_units_do_connect(punits, ACTIVITY_IRRIGATE, tgt);
3863 } else {
3864 conn_possible = FALSE;
3865 }
3866 menu_entry_set_sensitive(map, "CONNECT_IRRIGATION", conn_possible);
3867
3868 menu_entry_set_sensitive(map, "TAX_RATES",
3869 game.info.changable_tax
3870 && can_client_issue_orders());
3871
3872 if (units_can_do_action(punits, ACTION_HELP_WONDER, TRUE)) {
3873 menus_rename(work_menu, 0, "BUILD_CITY",
3874 action_get_ui_name_mnemonic(ACTION_HELP_WONDER, "_"));
3875 } else {
3876 bool city_on_tile = FALSE;
3877
3878 /* FIXME: This overloading doesn't work well with multiple focus
3879 * units. */
3880 unit_list_iterate(punits, punit) {
3881 if (tile_city(unit_tile(punit))) {
3882 city_on_tile = TRUE;
3883 break;
3884 }
3885 } unit_list_iterate_end;
3886
3887 if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
3888 TRUE)) {
3889 menus_rename(work_menu, 0, "BUILD_CITY",
3890 action_get_ui_name_mnemonic(ACTION_JOIN_CITY, "_"));
3891 } else {
3892 /* Refresh default order */
3893 menus_rename(work_menu, 0, "BUILD_CITY",
3894 action_get_ui_name_mnemonic(ACTION_FOUND_CITY, "_"));
3895 }
3896 }
3897
3898 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
3899 menus_rename(work_menu, 6, "BUILD_ROAD",
3900 action_get_ui_name_mnemonic(ACTION_TRADE_ROUTE, "_"));
3901 } else if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
3902 char road_item[500];
3903 struct extra_type *pextra = NULL;
3904
3905 /* FIXME: This overloading doesn't work well with multiple focus
3906 * units. */
3907 unit_list_iterate(punits, punit) {
3908 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
3909 unit_owner(punit), punit);
3910 if (pextra != NULL) {
3911 break;
3912 }
3913 } unit_list_iterate_end;
3914
3915 if (pextra != NULL) {
3916 /* TRANS: Build road of specific type (Road/Railroad) */
3917 snprintf(road_item, sizeof(road_item), _("Build %s"),
3918 extra_name_translation(pextra));
3919 menus_rename(work_menu, 6, "BUILD_ROAD", road_item);
3920 }
3921 } else {
3922 menus_rename(work_menu, 6, "BUILD_ROAD", _("Build _Road"));
3923 }
3924
3925 if (units_all_same_type && num_units > 0) {
3926 struct unit *punit = unit_list_get(punits, 0);
3927 const struct unit_type *to_unittype
3928 = can_upgrade_unittype(client_player(), unit_type_get(punit));
3929
3930 if (to_unittype) {
3931 /* TRANS: %s is a unit type. */
3932 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
3933 utype_name_translation(
3934 can_upgrade_unittype(client_player(),
3935 unit_type_get(punit))));
3936 } else {
3937 acttext[0] = '\0';
3938 }
3939 } else {
3940 acttext[0] = '\0';
3941 }
3942 if ('\0' != acttext[0]) {
3943 menus_rename(unit_menu, 13, "UNIT_UPGRADE", acttext);
3944 } else {
3945 menus_rename(unit_menu, 13, "UNIT_UPGRADE", _("Upgr_ade"));
3946 }
3947
3948 if (units_can_convert(&(wld.map), punits)) {
3949 if (units_all_same_type && num_units > 0) {
3950 struct unit *punit = unit_list_get(punits, 0);
3951
3952 /* TRANS: %s is a unit type. */
3953 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
3954 utype_name_translation(unit_type_get(punit)->converted_to));
3955 } else {
3956 acttext[0] = '\0';
3957 }
3958 } else {
3959 menu_entry_set_sensitive(map, "UNIT_CONVERT", FALSE);
3960 acttext[0] = '\0';
3961 }
3962 if ('\0' != acttext[0]) {
3963 menus_rename(unit_menu, 14, "UNIT_CONVERT", acttext);
3964 } else {
3965 menus_rename(unit_menu, 14, "UNIT_CONVERT", _("C_onvert"));
3966 }
3967
3968 if (units_all_same_tile && num_units > 0) {
3969 struct unit *first = unit_list_get(punits, 0);
3970
3971 pterrain = tile_terrain(unit_tile(first));
3972
3973 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
3974 struct extra_type *pextra = NULL;
3975
3976 /* FIXME: this overloading doesn't work well with multiple focus
3977 * units. */
3978 unit_list_iterate(punits, punit) {
3979 pextra = next_extra_for_tile(unit_tile(punit), EC_IRRIGATION,
3980 unit_owner(punit), punit);
3981 if (pextra != NULL) {
3982 break;
3983 }
3984 } unit_list_iterate_end;
3985
3986 if (pextra != NULL) {
3987 /* TRANS: Build irrigation of specific type */
3988 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
3989 extra_name_translation(pextra));
3990 } else {
3991 sz_strlcpy(irrtext, _("Build _Irrigation"));
3992 }
3993 } else {
3994 sz_strlcpy(irrtext, _("Build _Irrigation"));
3995 }
3996
3997 if (pterrain->cultivate_result != T_NONE) {
3998 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
3999 get_tile_change_menu_text(unit_tile(first),
4000 ACTIVITY_CULTIVATE));
4001 } else {
4002 sz_strlcpy(cultext, _("_Cultivate"));
4003 }
4004
4005 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
4006 struct extra_type *pextra = NULL;
4007
4008 /* FIXME: this overloading doesn't work well with multiple focus
4009 * units. */
4010 unit_list_iterate(punits, punit) {
4011 pextra = next_extra_for_tile(unit_tile(punit), EC_MINE,
4012 unit_owner(punit), punit);
4013 if (pextra != NULL) {
4014 break;
4015 }
4016 } unit_list_iterate_end;
4017
4018 if (pextra != NULL) {
4019 /* TRANS: Build mine of specific type */
4020 snprintf(mintext, sizeof(mintext), _("Build %s"),
4021 extra_name_translation(pextra));
4022 } else {
4023 sz_strlcpy(mintext, _("Build _Mine"));
4024 }
4025 } else {
4026 sz_strlcpy(mintext, _("Build _Mine"));
4027 }
4028
4029 if (pterrain->plant_result != T_NONE) {
4030 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
4031 get_tile_change_menu_text(unit_tile(first), ACTIVITY_PLANT));
4032 } else {
4033 sz_strlcpy(plantext, _("_Plant"));
4034 }
4035
4036 if (pterrain->transform_result != T_NONE
4037 && pterrain->transform_result != pterrain) {
4038 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
4039 get_tile_change_menu_text(unit_tile(first),
4040 ACTIVITY_TRANSFORM));
4041 } else {
4042 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4043 }
4044 } else {
4045 sz_strlcpy(irrtext, _("Build _Irrigation"));
4046 sz_strlcpy(cultext, _("_Cultivate"));
4047 sz_strlcpy(mintext, _("Build _Mine"));
4048 sz_strlcpy(plantext, _("_Plant"));
4049 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4050 }
4051
4052 menus_rename(work_menu, 7, "BUILD_IRRIGATION", irrtext);
4053 menus_rename(work_menu, 9, "CULTIVATE", cultext);
4054 menus_rename(work_menu, 8, "BUILD_MINE", mintext);
4055 menus_rename(work_menu, 10, "PLANT", plantext);
4056 menus_rename(work_menu, 11, "TRANSFORM_TERRAIN", transtext);
4057
4058 menus_rename(unit_menu, 12, "UNIT_HOMECITY",
4059 action_get_ui_name_mnemonic(ACTION_HOME_CITY, "_"));
4060
4061 menus_rename(combat_menu, 1, "BUILD_FORTRESS",
4062 Q_(terrain_control.gui_type_base0));
4063 menus_rename(combat_menu, 2, "BUILD_AIRBASE",
4064 Q_(terrain_control.gui_type_base1));
4065}
4066
4067/************************************************************************/
4071 void real_menus_init(void)
4072{
4073 if (!menus_built) {
4074 return;
4075 }
4076
4077#ifdef MENUS_GTK3
4078
4079 if (!can_client_change_view()) {
4080 menu_entry_group_set_sensitive(MGROUP_ALL, FALSE);
4081
4082 return;
4083 }
4084
4085 menu_entry_group_set_sensitive(MGROUP_SAFE, TRUE);
4086 menu_entry_group_set_sensitive(MGROUP_PLAYER, client_has_player());
4087
4088 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
4089 BORDERS_DISABLED != game.info.borders);
4090
4091 view_menu_update_sensitivity();
4092#endif /* MENUS_GTK3 */
4093}
4094
4095/**********************************************************************/
4098 void enable_menus(bool enable)
4099{
4100 GtkApplication *fc_app = gui_app();
4101
4102 if (enable) {
4103 if (main_menubar == NULL) {
4104 setup_app_actions(G_APPLICATION(fc_app));
4105 main_menubar = setup_menus(fc_app);
4106 /* Ensure the menus are really created before performing any operations
4107 * on them. */
4108 while (g_main_context_pending(NULL)) {
4109 g_main_context_iteration(NULL, FALSE);
4110 }
4111 }
4112
4113 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), TRUE);
4114 gtk_application_set_menubar(fc_app, G_MENU_MODEL(main_menubar));
4115
4116 } else {
4117 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), FALSE);
4118 gtk_application_set_menubar(fc_app, NULL);
4119 }
4120
4121 /* Workaround for gtk bug that (re)setting the menubar after the window has
4122 * been already created is not noticed. */
4123 g_object_notify(G_OBJECT(gtk_settings_get_default()), "gtk-shell-shows-menubar");
4124}
4125
4126/**********************************************************************/
4129 void menus_disable_unit_commands(void)
4130{
4131 menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), MGROUP_UNIT, FALSE);
4132}
action_removes_extra
bool action_removes_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2312
action_get_sub_target_kind
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1751
action_creates_extra
bool action_creates_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2224
action_get_ui_name_mnemonic
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1918
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:638
action_iterate_end
#define action_iterate_end
Definition actions.h:472
action_id_get_actor_kind
#define action_id_get_actor_kind(act_id)
Definition actions.h:651
action_iterate
#define action_iterate(_act_)
Definition actions.h:467
ACTION_ANY
#define ACTION_ANY
Definition actions.h:290
action_id_get_target_kind
#define action_id_get_target_kind(act_id)
Definition actions.h:655
action_id_has_complex_target
#define action_id_has_complex_target(act_id)
Definition actions.h:673
client
struct civclient client
Definition client_main.c:149
client_state
enum client_states client_state(void)
Definition client_main.c:1029
send_report_request
void send_report_request(enum report_type type)
Definition client_main.c:839
can_client_issue_orders
bool can_client_issue_orders(void)
Definition client_main.c:1265
client_has_player
bool client_has_player(void)
Definition client_main.c:1365
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1313
client_main.h
client_player
#define client_player()
Definition client_main.h:106
C_S_DISCONNECTED
@ C_S_DISCONNECTED
Definition client_main.h:45
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
can_units_do_connect
bool can_units_do_connect(struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
Definition climisc.c:1224
disconnect_from_server
void disconnect_from_server(void)
Definition clinet.c:305
clinet.h
send_save_game
void send_save_game(const char *filename)
Definition connectdlg_common.c:733
is_server_running
bool is_server_running(void)
Definition connectdlg_common.c:124
can_client_access_hack
bool can_client_access_hack(void)
Definition connectdlg_common.c:141
connectdlg_common.h
can_conn_enable_editing
bool can_conn_enable_editing(const struct connection *pconn)
Definition connection.c:520
key_coastline_toggle
void key_coastline_toggle(void)
Definition control.c:3801
key_irrigation_toggle
void key_irrigation_toggle(void)
Definition control.c:3817
key_unit_sentry
void key_unit_sentry(void)
Definition control.c:3605
key_city_output_toggle
void key_city_output_toggle(void)
Definition control.c:3702
request_unit_return
void request_unit_return(struct unit *punit)
Definition control.c:1521
request_unit_fortify
void request_unit_fortify(struct unit *punit)
Definition control.c:2211
key_roads_rails_toggle
void key_roads_rails_toggle(void)
Definition control.c:3809
request_unit_caravan_action
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2119
key_focus_unit_toggle
void key_focus_unit_toggle(void)
Definition control.c:3897
key_unit_auto_explore
void key_unit_auto_explore(void)
Definition control.c:3381
key_unit_auto_settle
void key_unit_auto_settle(void)
Definition control.c:3394
key_unit_connect
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3187
key_city_full_bar_toggle
void key_city_full_bar_toggle(void)
Definition control.c:3734
key_bases_toggle
void key_bases_toggle(void)
Definition control.c:3833
key_map_native_toggle
void key_map_native_toggle(void)
Definition control.c:3726
key_resources_toggle
void key_resources_toggle(void)
Definition control.c:3841
request_unit_goto
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1103
key_unit_paradrop
void key_unit_paradrop(void)
Definition control.c:3291
get_units_in_focus
struct unit_list * get_units_in_focus(void)
Definition control.c:177
key_unit_shields_toggle
void key_unit_shields_toggle(void)
Definition control.c:3889
key_city_productions_toggle
void key_city_productions_toggle(void)
Definition control.c:3768
key_unit_plant
void key_unit_plant(void)
Definition control.c:3527
key_unit_fortress
void key_unit_fortress(void)
Definition control.c:3436
key_unit_mine
void key_unit_mine(void)
Definition control.c:3519
key_unit_pillage
void key_unit_pillage(void)
Definition control.c:3539
request_unit_unload
void request_unit_unload(struct unit *pcargo)
Definition control.c:2090
key_editor_toggle_fogofwar
void key_editor_toggle_fogofwar(void)
Definition control.c:3930
request_new_unit_activity_targeted
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1837
key_unit_irrigate
void key_unit_irrigate(void)
Definition control.c:3499
request_unit_build_city
void request_unit_build_city(struct unit *punit)
Definition control.c:1714
key_unit_unload_all
void key_unit_unload_all(void)
Definition control.c:3321
key_cities_toggle
void key_cities_toggle(void)
Definition control.c:3865
key_city_outlines_toggle
void key_city_outlines_toggle(void)
Definition control.c:3694
key_unit_homecity
void key_unit_homecity(void)
Definition control.c:3453
key_unit_patrol
void key_unit_patrol(void)
Definition control.c:3299
key_unit_solid_bg_toggle
void key_unit_solid_bg_toggle(void)
Definition control.c:3881
key_terrain_toggle
void key_terrain_toggle(void)
Definition control.c:3793
key_unit_wakeup_others
void key_unit_wakeup_others(void)
Definition control.c:3354
key_unit_stack_size_toggle
void key_unit_stack_size_toggle(void)
Definition control.c:3785
key_huts_toggle
void key_huts_toggle(void)
Definition control.c:3849
key_fog_of_war_toggle
void key_fog_of_war_toggle(void)
Definition control.c:3905
key_unit_wait
void key_unit_wait(void)
Definition control.c:3346
key_units_toggle
void key_units_toggle(void)
Definition control.c:3873
key_unit_select_battlegroup
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3668
key_map_grid_toggle
void key_map_grid_toggle(void)
Definition control.c:3710
key_pollution_toggle
void key_pollution_toggle(void)
Definition control.c:3857
key_city_growth_toggle
void key_city_growth_toggle(void)
Definition control.c:3751
key_unit_action_select_tgt
void key_unit_action_select_tgt(void)
Definition control.c:3218
key_city_buycost_toggle
void key_city_buycost_toggle(void)
Definition control.c:3760
get_num_units_in_focus
int get_num_units_in_focus(void)
Definition control.c:185
key_unit_transform
void key_unit_transform(void)
Definition control.c:3617
key_unit_done
void key_unit_done(void)
Definition control.c:3275
key_city_trade_routes_toggle
void key_city_trade_routes_toggle(void)
Definition control.c:3777
key_city_names_toggle
void key_city_names_toggle(void)
Definition control.c:3742
request_unit_select
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1590
key_unit_airbase
void key_unit_airbase(void)
Definition control.c:3364
key_unit_goto
void key_unit_goto(void)
Definition control.c:3283
key_unit_convert
void key_unit_convert(void)
Definition control.c:3406
key_unit_clean
void key_unit_clean(void)
Definition control.c:3551
key_editor_toggle
void key_editor_toggle(void)
Definition control.c:3913
key_unit_assign_battlegroup
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3629
key_unit_cultivate
void key_unit_cultivate(void)
Definition control.c:3507
key_mines_toggle
void key_mines_toggle(void)
Definition control.c:3825
key_map_borders_toggle
void key_map_borders_toggle(void)
Definition control.c:3718
control.h
can_unit_do_activity_targeted_client
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:42
can_units_do_activity_targeted_client
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:46
can_units_do_activity_client
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:44
punit
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
editor_is_active
bool editor_is_active(void)
Definition editor.c:346
OBJTYPE_GAME
@ OBJTYPE_GAME
Definition editor.h:31
next_extra_for_tile
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
extra_number
int extra_number(const struct extra_type *pextra)
Definition extras.c:153
extra_type_list_by_cause
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:241
extras
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
extra_name_translation
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:186
extra_type_iterate
#define extra_type_iterate(_p)
Definition extras.h:291
extra_type_iterate_end
#define extra_type_iterate_end
Definition extras.h:297
extra_type_by_rmcause_iterate_end
#define extra_type_by_rmcause_iterate_end
Definition extras.h:334
extra_type_by_rmcause_iterate
#define extra_type_by_rmcause_iterate(_rmcause, _extra)
Definition extras.h:329
extra_type_by_cause_iterate_end
#define extra_type_by_cause_iterate_end
Definition extras.h:315
extra_type_by_cause_iterate
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:309
NO_TARGET
#define NO_TARGET
Definition fc_types.h:324
BORDERS_DISABLED
@ BORDERS_DISABLED
Definition fc_types.h:891
fcintl.h
Q_
#define Q_(String)
Definition fcintl.h:70
_
#define _(String)
Definition fcintl.h:67
N_
#define N_(String)
Definition fcintl.h:69
game
struct civ_game game
Definition game.c:57
wld
struct world wld
Definition game.c:58
game.h
government_name_translation
const char * government_name_translation(const struct government *pgovern)
Definition government.c:142
untargeted_revolution_allowed
bool untargeted_revolution_allowed(void)
Definition government.c:564
can_change_to_government
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:165
government.h
governments_iterate
#define governments_iterate(NAME_pgov)
Definition government.h:120
governments_iterate_end
#define governments_iterate_end
Definition government.h:123
log_output_window
void log_output_window(void)
Definition chatline.c:928
clear_output_window
void clear_output_window(void)
Definition chatline.c:943
city_report_dialog_popup
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
unit_select_dialog_popup
void unit_select_dialog_popup(struct tile *ptile)
Definition dialogs.c:382
popup_upgrade_dialog
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1444
popup_disband_dialog
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1482
editgui_refresh
void editgui_refresh(void)
Definition editgui.c:1795
property_editor_popup
void property_editor_popup(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6231
editprop_get_property_editor
struct property_editor * editprop_get_property_editor(void)
Definition editprop.c:6184
property_editor_reload
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6321
popup_find_dialog
void popup_find_dialog(void)
Definition finddlg.c:58
popup_multiplier_dialog
void popup_multiplier_dialog(void)
Definition gamedlgs.c:383
popup_rates_dialog
void popup_rates_dialog(void)
Definition gamedlgs.c:533
popup_goto_dialog
void popup_goto_dialog(void)
Definition gotodlg.c:257
fullscreen_opt_refresh
void fullscreen_opt_refresh(struct option *poption)
Definition gui_main.c:2237
map_canvas_focus
gboolean map_canvas_focus(void)
Definition gui_main.c:366
toplevel
GtkWidget * toplevel
Definition gui_main.c:124
popup_quit_dialog
void popup_quit_dialog(void)
Definition gui_main.c:2153
GUI_GTK_OPTION
#define GUI_GTK_OPTION(optname)
Definition gui_main.h:25
setup_dialog
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
popup_help_dialog_string
void popup_help_dialog_string(const char *item)
Definition helpdlg.c:211
luaconsole_dialog_popup
void luaconsole_dialog_popup(bool raise)
Definition luaconsole.c:126
center_on_unit
void center_on_unit(void)
Definition mapctrl.c:490
save_mapimg_callback
static void save_mapimg_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:687
show_national_borders_callback
static void show_national_borders_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1185
show_focus_unit_callback
static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1421
setup_menus
GtkWidget * setup_menus(GtkWidget *window)
Definition menu.c:2115
auto_settle_callback
static void auto_settle_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1743
help_connecting_callback
static void help_connecting_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:843
menus_rename
static void menus_rename(const char *key, const gchar *new_label)
Definition menu.c:2249
help_combat_callback
static void help_combat_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1043
menu_entry_group_set_sensitive
static void menu_entry_group_set_sensitive(enum menu_entry_grouping group, gboolean is_sensitive)
Definition menu.c:2217
help_ruleset_callback
static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:995
select_single_callback
static void select_single_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1491
unit_unload_transporter_callback
static void unit_unload_transporter_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1683
help_government_callback
static void help_government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1083
report_achievements_callback
static void report_achievements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:819
show_fog_of_war_callback
static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1432
help_zoc_callback
static void help_zoc_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1051
show_city_productions_callback
static void show_city_productions_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1242
client_lua_script_callback
static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:803
show_city_names_callback
static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1219
help_space_race_callback
static void help_space_race_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1099
help_tileset_callback
static void help_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1003
help_playing_callback
static void help_playing_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:987
plant_callback
static void plant_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1801
menu_entries
static struct menu_entry_info menu_entries[]
Definition menu.c:264
base_callback
static void base_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1980
help_economy_callback
static void help_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1011
unit_sentry_callback
static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1647
center_view_callback
static void center_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2005
unit_explore_callback
static void unit_explore_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1631
build_mine_callback
static void build_mine_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1793
quit_callback
static void quit_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:739
unit_return_callback
static void unit_return_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1621
show_city_trade_routes_callback
static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1265
transform_terrain_callback
static void transform_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1873
help_wonders_callback
static void help_wonders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1075
show_terrain_callback
static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1276
show_city_growth_callback
static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1231
show_stack_size_callback
static void show_stack_size_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1410
multiplier_callback
static void multiplier_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1964
help_terrain_callback
static void help_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1067
save_game_callback
static void save_game_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:671
show_unit_solid_bg_callback
static void show_unit_solid_bg_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1388
show_coastline_callback
static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1287
toggle_fog_callback
static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1463
show_city_full_bar_callback
static void show_city_full_bar_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1207
edit_mode_callback
static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1140
help_chatline_callback
static void help_chatline_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:859
connect_road_callback
static void connect_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1809
help_overview_callback
static void help_overview_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:979
save_game_as_callback
static void save_game_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:679
help_diplomacy_callback
static void help_diplomacy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1091
show_units_callback
static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1377
show_irrigation_callback
static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1307
show_map_grid_callback
static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1174
help_improvements_callback
static void help_improvements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1027
find_city_callback
static void find_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:747
report_nations_callback
static void report_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:771
report_demographic_callback
static void report_demographic_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:811
help_worklist_editor_callback
static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:867
help_cities_callback
static void help_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1019
leave_local_game_response
static void leave_local_game_response(GtkWidget *dialog, gint response)
Definition menu.c:704
help_language_callback
static void help_language_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:827
server_options_callback
static void server_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:647
leave_callback
static void leave_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:719
select_same_type_cont_callback
static void select_same_type_cont_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1515
unit_convert_callback
static void unit_convert_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1708
select_dialog_callback
static void select_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1531
show_huts_callback
static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1347
report_wow_callback
static void report_wow_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:779
unit_upgrade_callback
static void unit_upgrade_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1700
help_tech_callback
static void help_tech_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1059
unit_goto_callback
static void unit_goto_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1555
build_city_callback
static void build_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1724
unit_patrol_callback
static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1639
real_menus_init
void real_menus_init(void)
Definition menu.c:2836
menu_entry_grouping
menu_entry_grouping
Definition menu.c:90
MGROUP_ALL
@ MGROUP_ALL
Definition menu.c:91
MGROUP_PLAYING
@ MGROUP_PLAYING
Definition menu.c:90
MGROUP_PLAYER
@ MGROUP_PLAYER
Definition menu.c:91
MGROUP_SAFE
@ MGROUP_SAFE
Definition menu.c:90
MGROUP_EDIT
@ MGROUP_EDIT
Definition menu.c:90
MGROUP_UNIT
@ MGROUP_UNIT
Definition menu.c:91
help_about_callback
static void help_about_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1123
build_road_callback
static void build_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1751
local_options_callback
static void local_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:631
show_cities_callback
static void show_cities_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1367
unit_homecity_callback
static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1692
menu_entry_set_sensitive
static void menu_entry_set_sensitive(const char *key, gboolean is_sensitive)
Definition menu.c:2204
show_pollution_callback
static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1357
save_options_callback
static void save_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:655
save_mapimg_as_callback
static void save_mapimg_as_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:695
worklists_callback
static void worklists_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:755
connect_maglev_callback
static void connect_maglev_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1841
full_screen_callback
static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1443
report_top_cities_callback
static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:787
help_controls_callback
static void help_controls_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:851
select_same_type_callback
static void select_same_type_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1523
connect_rail_callback
static void connect_rail_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1825
unit_wait_callback
static void unit_wait_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1539
get_tile_change_menu_text
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2302
build_airbase_callback
static void build_airbase_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1924
report_cities_callback
static void report_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2021
message_options_callback
static void message_options_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:639
tax_rate_callback
static void tax_rate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1956
unit_goto_city_callback
static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1611
menu_entry_info_find
static struct menu_entry_info * menu_entry_info_find(const char *key)
Definition menu.c:2175
government_callback
static void government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1972
report_economy_callback
static void report_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2029
report_messages_callback
static void report_messages_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:795
show_bases_callback
static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1327
select_same_type_tile_callback
static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1507
save_options_on_exit_callback
static void save_options_on_exit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1131
show_native_tiles_callback
static void show_native_tiles_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1196
menu_entry_init
static void menu_entry_init(GtkBuildable *item)
Definition menu.c:2055
show_unit_shields_callback
static void show_unit_shields_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1399
reload_tileset_callback
static void reload_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:663
scenario_properties_callback
static void scenario_properties_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1471
clear_chat_logs_callback
static void clear_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:615
unit_deboard_callback
static void unit_deboard_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1673
help_policies_callback
static void help_policies_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:835
unit_done_callback
static void unit_done_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1547
help_nations_callback
static void help_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1107
unit_goto_and_callback
static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1563
show_city_output_callback
static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1163
show_city_outlines_callback
static void show_city_outlines_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1152
save_scenario_callback
static void save_scenario_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1483
help_copying_callback
static void help_copying_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1115
cultivate_callback
static void cultivate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1785
save_chat_logs_callback
static void save_chat_logs_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:623
real_menus_update
void real_menus_update(void)
Definition menu.c:2317
report_spaceship_callback
static void report_spaceship_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2045
select_all_on_tile_callback
static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1499
show_city_buy_cost_callback
static void show_city_buy_cost_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1254
build_fortress_callback
static void build_fortress_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1906
CREATE_SUB_ITEM
#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_)
view_menu_update_sensitivity
static void view_menu_update_sensitivity(void)
Definition menu.c:2270
unit_board_callback
static void unit_board_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1663
fortify_callback
static void fortify_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1914
show_resources_callback
static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1337
connect_irrigation_callback
static void connect_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1857
build_irrigation_callback
static void build_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1777
report_units_callback
static void report_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2013
road_callback
static void road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1992
unit_disband_callback
static void unit_disband_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1716
help_units_callback
static void help_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1035
report_research_callback
static void report_research_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2037
map_view_callback
static void map_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:763
popup_messageopt_dialog
void popup_messageopt_dialog(void)
Definition messagedlg.c:51
meswin_dialog_popup
void meswin_dialog_popup(bool raise)
Definition messagewin.c:416
option_dialog_popup
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:979
save_mapimg_dialog_popup
void save_mapimg_dialog_popup(void)
Definition pages.c:3535
mapimg_client_save
void mapimg_client_save(const char *filename)
Definition pages.c:3554
save_game_dialog_popup
void save_game_dialog_popup(void)
Definition pages.c:3471
save_scenario_dialog_popup
void save_scenario_dialog_popup(void)
Definition pages.c:3506
popup_players_dialog
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
science_report_dialog_popup
void science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
economy_report_dialog_popup
void economy_report_dialog_popup(bool raise)
Definition repodlgs.c:1242
units_report_dialog_popup
void units_report_dialog_popup(bool raise)
Definition repodlgs.c:1765
science_report_dialog_popdown
void science_report_dialog_popdown(void)
Definition repodlgs.c:740
popup_spaceship_dialog
void popup_spaceship_dialog(struct player *pplayer)
Definition spaceshipdlg.c:146
request_transport
bool request_transport(struct unit *cargo, struct tile *ptile)
Definition transportdlg.c:82
popup_worklists_report
void popup_worklists_report(void)
Definition wldlg.c:286
infra_dialog_popup
void infra_dialog_popup(void)
Definition infradlg.c:85
rally_dialog_callback
static void rally_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1548
infra_dialog_callback
static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1556
rally_dialog_popup
void rally_dialog_popup(void)
Definition rallypointdlg.c:66
editgui.h
editprop.h
gamedlgs.h
fc_app
static GtkApplication * fc_app
Definition gui_main.c:179
gui_app
GtkApplication * gui_app(void)
Definition gui_main.c:2616
gui_stuff.h
submenu_append_unref
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
menu_item_insert_unref
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
menu_item_append_unref
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
infradlg.h
help_governor_callback
static void help_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1626
irrigation_callback
static void irrigation_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2707
bg_append_callback
static void bg_append_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2840
unsentry_all_callback
static void unsentry_all_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2308
combat_menu
static GMenu * combat_menu
Definition menu.c:89
create_toggle_menu_item_for_key
static GMenuItem * create_toggle_menu_item_for_key(const char *key)
Definition menu.c:2874
pillage_callback
static void pillage_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2620
enable_menus
void enable_menus(bool enable)
Definition menu.c:4098
setup_app_actions
static void setup_app_actions(GApplication *fc_app)
Definition menu.c:2925
options_menu
static GMenu * options_menu
Definition menu.c:83
clean_callback
static void clean_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2583
register_bg_actions
static void register_bg_actions(GActionMap *map, int bg)
Definition menu.c:2965
acts
const GActionEntry acts[]
Definition menu.c:1030
VMENU_HUTS
@ VMENU_HUTS
Definition menu.c:1018
VMENU_MINES
@ VMENU_MINES
Definition menu.c:1015
VMENU_COASTLINE
@ VMENU_COASTLINE
Definition menu.c:1012
VMENU_UNIT_SOLID_BG
@ VMENU_UNIT_SOLID_BG
Definition menu.c:1022
VMENU_CITY_NAMES
@ VMENU_CITY_NAMES
Definition menu.c:1006
VMENU_UNITS
@ VMENU_UNITS
Definition menu.c:1021
VMENU_CITY_FULL_BAR
@ VMENU_CITY_FULL_BAR
Definition menu.c:1005
VMENU_CITY_OUTLINES
@ VMENU_CITY_OUTLINES
Definition menu.c:1000
VMENU_POLLUTION
@ VMENU_POLLUTION
Definition menu.c:1019
VMENU_FOCUS_UNIT
@ VMENU_FOCUS_UNIT
Definition menu.c:1025
VMENU_BASES
@ VMENU_BASES
Definition menu.c:1016
VMENU_MAP_GRID
@ VMENU_MAP_GRID
Definition menu.c:1002
VMENU_CITY_BUY_COST
@ VMENU_CITY_BUY_COST
Definition menu.c:1009
VMENU_TERRAIN
@ VMENU_TERRAIN
Definition menu.c:1011
VMENU_CITY_GROWTH
@ VMENU_CITY_GROWTH
Definition menu.c:1007
VMENU_PATHS
@ VMENU_PATHS
Definition menu.c:1013
VMENU_CITIES
@ VMENU_CITIES
Definition menu.c:1020
VMENU_STACK_SIZE
@ VMENU_STACK_SIZE
Definition menu.c:1024
VMENU_UNIT_SHIELDS
@ VMENU_UNIT_SHIELDS
Definition menu.c:1023
VMENU_IRRIGATION
@ VMENU_IRRIGATION
Definition menu.c:1014
VMENU_NATIVE_TILES
@ VMENU_NATIVE_TILES
Definition menu.c:1004
VMENU_CITY_OUTPUT
@ VMENU_CITY_OUTPUT
Definition menu.c:1001
VMENU_RESOURCES
@ VMENU_RESOURCES
Definition menu.c:1017
VMENU_CITY_PRODUCTIONS
@ VMENU_CITY_PRODUCTIONS
Definition menu.c:1008
VMENU_CITY_TRADE_ROUTES
@ VMENU_CITY_TRADE_ROUTES
Definition menu.c:1010
VMENU_FULL_SCREEN
@ VMENU_FULL_SCREEN
Definition menu.c:1027
VMENU_NAT_BORDERS
@ VMENU_NAT_BORDERS
Definition menu.c:1003
VMENU_FOW
@ VMENU_FOW
Definition menu.c:1026
revolution_callback
static void revolution_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2668
view_menu
static GMenu * view_menu
Definition menu.c:85
work_menu
static GMenu * work_menu
Definition menu.c:88
menu_entry_grouping
menu_entry_grouping
Definition menu.c:80
bg_assign_callback
static void bg_assign_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2830
menu_entry_set_sensitive_info
static void menu_entry_set_sensitive_info(GActionMap *map, struct menu_entry_info *info, gboolean is_enabled)
Definition menu.c:3261
menus_built
static bool menus_built
Definition menu.c:74
show_mines_callback
static void show_mines_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1922
edit_menu
static GMenu * edit_menu
Definition menu.c:84
menus_disable_unit_commands
void menus_disable_unit_commands(void)
Definition menu.c:4129
show_paths_callback
static void show_paths_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1902
paradrop_callback
static void paradrop_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2610
meoms
const struct menu_entry_option_map meoms[]
Definition menu.c:1702
unit_menu
static GMenu * unit_menu
Definition menu.c:87
do_action_callback
static void do_action_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2630
bg_select_callback
static void bg_select_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2820
mine_callback
static void mine_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2722
main_menubar
static GMenu * main_menubar
Definition menu.c:73
create_toggle_menu_item
static GMenuItem * create_toggle_menu_item(struct menu_entry_info *info)
Definition menu.c:2851
menus_set_initial_toggle_values
void menus_set_initial_toggle_values(void)
Definition menu.c:2907
clean_menu_callback
static void clean_menu_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2737
view_menu_item_toggle
static void view_menu_item_toggle(void(*cb)(void), bool updt_sensitivity, gpointer data)
Definition menu.c:1743
rallypointdlg.h
unitselect.h
chatline.h
cityrep.h
popup_revolution_dialog
void popup_revolution_dialog(void)
Definition dialogs.c:109
dialogs.h
finddlg.h
gotodlg.h
gui_main.h
helpdlg.h
luaconsole.h
mapctrl.h
menu.h
messagedlg.h
messagewin.h
optiondlg.h
pages.h
plrdlg.h
ratesdlg.h
repodlgs.h
spaceshipdlg.h
sprite.h
wldlg.h
HELP_CITIES_ITEM
#define HELP_CITIES_ITEM
HELP_TERRAIN_ITEM
#define HELP_TERRAIN_ITEM
HELP_LANGUAGES_ITEM
#define HELP_LANGUAGES_ITEM
HELP_CONNECTING_ITEM
#define HELP_CONNECTING_ITEM
HELP_TILESET_ITEM
#define HELP_TILESET_ITEM
HELP_CHATLINE_ITEM
#define HELP_CHATLINE_ITEM
HELP_RULESET_ITEM
#define HELP_RULESET_ITEM
HELP_GOVERNMENT_ITEM
#define HELP_GOVERNMENT_ITEM
HELP_ABOUT_ITEM
#define HELP_ABOUT_ITEM
HELP_MULTIPLIER_ITEM
#define HELP_MULTIPLIER_ITEM
HELP_PLAYING_ITEM
#define HELP_PLAYING_ITEM
HELP_IMPROVEMENTS_ITEM
#define HELP_IMPROVEMENTS_ITEM
HELP_UNITS_ITEM
#define HELP_UNITS_ITEM
HELP_ZOC_ITEM
#define HELP_ZOC_ITEM
HELP_WORKLIST_EDITOR_ITEM
#define HELP_WORKLIST_EDITOR_ITEM
HELP_WONDERS_ITEM
#define HELP_WONDERS_ITEM
HELP_COMBAT_ITEM
#define HELP_COMBAT_ITEM
HELP_SPACE_RACE_ITEM
#define HELP_SPACE_RACE_ITEM
HELP_COPYING_ITEM
#define HELP_COPYING_ITEM
HELP_OVERVIEW_ITEM
#define HELP_OVERVIEW_ITEM
HELP_NATIONS_ITEM
#define HELP_NATIONS_ITEM
HELP_TECHS_ITEM
#define HELP_TECHS_ITEM
HELP_DIPLOMACY_ITEM
#define HELP_DIPLOMACY_ITEM
HELP_ECONOMY_ITEM
#define HELP_ECONOMY_ITEM
HELP_CMA_ITEM
#define HELP_CMA_ITEM
HELP_CONTROLS_ITEM
#define HELP_CONTROLS_ITEM
improvement_number
Impr_type_id improvement_number(const struct impr_type *pimprove)
Definition improvement.c:182
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:241
improvement_iterate_end
#define improvement_iterate_end
Definition improvement.h:211
improvement_iterate
#define improvement_iterate(_p)
Definition improvement.h:205
name
const char * name
Definition inputfile.c:127
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
fc_assert
#define fc_assert(condition)
Definition log.h:176
FC_STATIC_ASSERT
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
terrain_control
struct terrain_misc terrain_control
Definition map.c:69
mapview_common.h
multiplier_count
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
server_optset
const struct option_set * server_optset
Definition options.c:4009
client_optset
const struct option_set * client_optset
Definition options.c:1255
options_save
void options_save(option_save_log_callback log_cb)
Definition options.c:6053
gui_options
struct client_options gui_options
Definition options.c:71
options.h
REPORT_WONDERS_OF_THE_WORLD
@ REPORT_WONDERS_OF_THE_WORLD
Definition packets.h:74
REPORT_DEMOGRAPHIC
@ REPORT_DEMOGRAPHIC
Definition packets.h:76
REPORT_TOP_5_CITIES
@ REPORT_TOP_5_CITIES
Definition packets.h:75
REPORT_ACHIEVEMENTS
@ REPORT_ACHIEVEMENTS
Definition packets.h:77
road_extra_get
struct extra_type * road_extra_get(const struct road_type *proad)
Definition road.c:42
road_by_gui_type
struct road_type * road_by_gui_type(enum road_gui_type gui_type)
Definition road.c:180
road.h
grouping
static char * grouping
Definition shared.c:98
shared.h
action
Definition actions.h:379
action::id
action_id id
Definition actions.h:380
advance
Definition tech.h:124
civ_game::info
struct packet_game_info info
Definition game.h:89
civ_game::government_during_revolution
struct government * government_during_revolution
Definition game.h:94
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::draw_native
bool draw_native
Definition options.h:207
client_options::draw_specials
bool draw_specials
Definition options.h:199
client_options::draw_city_output
bool draw_city_output
Definition options.h:186
client_options::draw_city_names
bool draw_city_names
Definition options.h:188
client_options::draw_city_productions
bool draw_city_productions
Definition options.h:190
client_options::draw_mines
bool draw_mines
Definition options.h:197
client_options::draw_borders
bool draw_borders
Definition options.h:206
client_options::draw_fortress_airbase
bool draw_fortress_airbase
Definition options.h:198
client_options::draw_city_buycost
bool draw_city_buycost
Definition options.h:191
client_options::draw_unit_stack_size
bool draw_unit_stack_size
Definition options.h:210
client_options::draw_irrigation
bool draw_irrigation
Definition options.h:196
client_options::draw_terrain
bool draw_terrain
Definition options.h:193
client_options::draw_units
bool draw_units
Definition options.h:203
client_options::draw_fog_of_war
bool draw_fog_of_war
Definition options.h:205
client_options::draw_city_trade_routes
bool draw_city_trade_routes
Definition options.h:192
client_options::draw_unit_shields
bool draw_unit_shields
Definition options.h:209
client_options::draw_cities
bool draw_cities
Definition options.h:202
client_options::save_options_on_exit
bool save_options_on_exit
Definition options.h:121
client_options::draw_map_grid
bool draw_map_grid
Definition options.h:187
client_options::draw_city_growth
bool draw_city_growth
Definition options.h:189
client_options::draw_huts
bool draw_huts
Definition options.h:200
client_options::draw_focus_unit
bool draw_focus_unit
Definition options.h:204
client_options::draw_city_outlines
bool draw_city_outlines
Definition options.h:185
client_options::draw_coastline
bool draw_coastline
Definition options.h:194
client_options::draw_full_citybar
bool draw_full_citybar
Definition options.h:208
client_options::draw_roads_rails
bool draw_roads_rails
Definition options.h:195
client_options::draw_pollution
bool draw_pollution
Definition options.h:201
client_options::solid_color_behind_units
bool solid_color_behind_units
Definition options.h:142
connection::established
bool established
Definition connection.h:145
connection::playing
struct player * playing
Definition connection.h:156
connection::used
bool used
Definition connection.h:144
extra_type
Definition extras.h:85
extra_type::data
struct extra_type::@24 data
government
Definition government.h:52
impr_type
Definition improvement.h:68
item
Definition climisc.h:80
menu_entry_info
Definition menu.c:96
menu_entry_info::key
const char * key
Definition menu.c:97
menu_entry_info::state
bool state
Definition menu.c:98
menu_entry_info::accl
const char * accl
Definition menu.c:95
menu_entry_info::grouping
enum menu_entry_grouping grouping
Definition menu.c:102
menu_entry_info::cb
GCallback cb
Definition menu.c:101
menu_entry_info::name
const char * name
Definition menu.c:98
menu_entry_info::action
const char * action
Definition menu.c:94
menu_entry_info::toggle
void(* toggle)(GSimpleAction *act, GVariant *value, gpointer data)
Definition menu.c:97
menu_entry_option_map
Definition menu.c:1696
menu_entry_option_map::menu_entry
const char * menu_entry
Definition menu.c:1697
menu_entry_option_map::option
bool * option
Definition menu.c:1698
menu_entry_option_map::menu_pos
int menu_pos
Definition menu.c:1699
option
Definition options.c:454
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:133
packet_game_info::changable_tax
bool changable_tax
Definition packets_gen.h:141
packet_game_info::is_edit_mode
bool is_edit_mode
Definition packets_gen.h:185
property_editor
Definition editprop.c:644
road_type
Definition road.h:75
terrain
Definition terrain.h:176
terrain::cultivate_result
struct terrain * cultivate_result
Definition terrain.h:203
terrain::plant_result
struct terrain * plant_result
Definition terrain.h:206
terrain::transform_result
struct terrain * transform_result
Definition terrain.h:217
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
world::map
struct civ_map map
Definition world_object.h:38
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
support.h
sz_strlcpy
#define sz_strlcpy(dest, src)
Definition support.h:161
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
advance_name_translation
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
advance_number
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
advance_iterate
#define advance_iterate(_start, _p)
Definition tech.h:264
A_FIRST
#define A_FIRST
Definition tech.h:44
advance_iterate_end
#define advance_iterate_end
Definition tech.h:270
T_NONE
#define T_NONE
Definition terrain.h:56
tile_virtual_destroy
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1018
tile_apply_activity
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:658
tile_virtual_new
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:966
tile_get_info_text
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:756
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile_terrain
#define tile_terrain(_tile)
Definition tile.h:109
tilespec_reread
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1299
tilespec.h
can_unit_change_homecity
bool can_unit_change_homecity(const struct unit *punit)
Definition unit.c:460
unit_can_est_trade_route_here
bool unit_can_est_trade_route_here(const struct unit *punit)
Definition unit.c:288
unit_can_add_or_build_city
bool unit_can_add_or_build_city(const struct unit *punit)
Definition unit.c:429
can_unit_do_autosettlers
bool can_unit_do_autosettlers(const struct unit *punit)
Definition unit.c:579
unit_can_help_build_wonder_here
bool unit_can_help_build_wonder_here(const struct unit *punit)
Definition unit.c:263
can_unit_paradrop
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:823
unit.h
unit_tile
#define unit_tile(_pu)
Definition unit.h:388
ORDER_PERFORM_ACTION
@ ORDER_PERFORM_ACTION
Definition unit.h:47
unit_owner
#define unit_owner(_pu)
Definition unit.h:387
MAX_NUM_BATTLEGROUPS
#define MAX_NUM_BATTLEGROUPS
Definition unit.h:189
units_can_convert
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:353
units_are_occupied
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:277
can_units_do_base_gui
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:184
can_units_do_any_road
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:165
units_can_upgrade
bool units_can_upgrade(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:338
units_can_unload
bool units_can_unload(const struct unit_list *punits)
Definition unitlist.c:305
units_have_activity_on_tile
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:322
units_have_type_flag
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:206
can_units_do
bool can_units_do(const struct unit_list *punits, bool(can_fn)(const struct unit *punit))
Definition unitlist.c:95
units_can_do_action
bool units_can_do_action(const struct unit_list *punits, action_id act_id, bool can_do)
Definition unitlist.c:243
units_can_load
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:291
can_units_do_on_map
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
unit_list_iterate
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
unit_list_iterate_end
#define unit_list_iterate_end
Definition unitlist.h:33
unit_type_get
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
can_upgrade_unittype
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1755
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
utype_can_do_action
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:443
enable
#define enable(id)
Definition widget.h:223