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

Freeciv-3.2

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