Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-gtk-5.0/menu.c Source File

Freeciv-3.3

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-5.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_work_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_WORKER", N_("_Auto Worker"),
785 "auto_work", "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_work", auto_work_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(GObject *dialog, GAsyncResult *result,
1296 gpointer data)
1297{
1298 int button = gtk_alert_dialog_choose_finish(GTK_ALERT_DIALOG(dialog),
1299 result, NULL);
1300
1301 if (button == 0) {
1302 /* It might be killed already */
1303 if (client.conn.used) {
1304 /* It will also kill the server */
1305 disconnect_from_server(TRUE);
1306 }
1307 }
1308}
1309
1310/************************************************************************/
1313 static void leave_callback(GSimpleAction *action,
1314 GVariant *parameter,
1315 gpointer data)
1316{
1317 if (is_server_running()) {
1318 const char *buttons[] = { _("Leave"), _("Cancel"), NULL };
1319 GtkAlertDialog *dialog
1320 = gtk_alert_dialog_new(_("Leaving a local game will end it!"));
1321
1322 gtk_alert_dialog_set_buttons(GTK_ALERT_DIALOG(dialog), buttons);
1323 setup_dialog(GTK_WIDGET(dialog), toplevel);
1324 gtk_alert_dialog_choose(GTK_ALERT_DIALOG(dialog),
1325 GTK_WINDOW(toplevel), NULL,
1326 leave_local_game_response, NULL);
1327 } else {
1328 disconnect_from_server(TRUE);
1329 }
1330}
1331
1332/************************************************************************/
1335 static void quit_callback(GSimpleAction *action,
1336 GVariant *parameter,
1337 gpointer data)
1338{
1339 popup_quit_dialog();
1340}
1341
1342/************************************************************************/
1345 static void find_city_callback(GSimpleAction *action,
1346 GVariant *parameter,
1347 gpointer data)
1348{
1349 popup_find_dialog();
1350}
1351
1352/************************************************************************/
1355 static void worklists_callback(GSimpleAction *action,
1356 GVariant *parameter,
1357 gpointer data)
1358{
1359 popup_worklists_report();
1360}
1361
1362/************************************************************************/
1365 static void map_view_callback(GSimpleAction *action,
1366 GVariant *parameter, gpointer data)
1367{
1368 map_canvas_focus();
1369}
1370
1371/************************************************************************/
1374 static void report_nations_callback(GSimpleAction *action,
1375 GVariant *parameter,
1376 gpointer data)
1377{
1378 popup_players_dialog(TRUE);
1379}
1380
1381/************************************************************************/
1384 static void report_wow_callback(GSimpleAction *action,
1385 GVariant *parameter,
1386 gpointer data)
1387{
1388 if (GUI_GTK_OPTION(message_chat_location) == GUI_GTK_MSGCHAT_MERGED) {
1389 send_report_request(REPORT_WONDERS_OF_THE_WORLD_LONG);
1390 } else {
1391 send_report_request(REPORT_WONDERS_OF_THE_WORLD);
1392 }
1393}
1394
1395/************************************************************************/
1398 static void report_top_cities_callback(GSimpleAction *action,
1399 GVariant *parameter,
1400 gpointer data)
1401{
1402 send_report_request(REPORT_TOP_CITIES);
1403}
1404
1405/************************************************************************/
1408 static void report_messages_callback(GSimpleAction *action,
1409 GVariant *parameter,
1410 gpointer data)
1411{
1412 meswin_dialog_popup(TRUE);
1413}
1414
1415/************************************************************************/
1418 static void client_lua_script_callback(GSimpleAction *action,
1419 GVariant *parameter,
1420 gpointer data)
1421{
1422 luaconsole_dialog_popup(TRUE);
1423}
1424
1425/************************************************************************/
1428 static void report_demographic_callback(GSimpleAction *action,
1429 GVariant *parameter,
1430 gpointer data)
1431{
1432 send_report_request(REPORT_DEMOGRAPHIC);
1433}
1434
1435/************************************************************************/
1438 static void report_achievements_callback(GSimpleAction *action,
1439 GVariant *parameter,
1440 gpointer data)
1441{
1442 send_report_request(REPORT_ACHIEVEMENTS);
1443}
1444
1445/************************************************************************/
1448 static void help_overview_callback(GSimpleAction *action,
1449 GVariant *parameter,
1450 gpointer data)
1451{
1452 popup_help_dialog_string(HELP_OVERVIEW_ITEM);
1453}
1454
1455/************************************************************************/
1458 static void help_playing_callback(GSimpleAction *action,
1459 GVariant *parameter,
1460 gpointer data)
1461{
1462 popup_help_dialog_string(HELP_PLAYING_ITEM);
1463}
1464
1465/************************************************************************/
1468 static void help_policies_callback(GSimpleAction *action,
1469 GVariant *parameter,
1470 gpointer data)
1471{
1472 popup_help_dialog_string(HELP_MULTIPLIER_ITEM);
1473}
1474
1475/************************************************************************/
1478 static void help_terrain_callback(GSimpleAction *action,
1479 GVariant *parameter,
1480 gpointer data)
1481{
1482 popup_help_dialog_string(HELP_TERRAIN_ITEM);
1483}
1484
1485/************************************************************************/
1488 static void help_economy_callback(GSimpleAction *action,
1489 GVariant *parameter,
1490 gpointer data)
1491{
1492 popup_help_dialog_string(HELP_ECONOMY_ITEM);
1493}
1494
1495/************************************************************************/
1498 static void help_cities_callback(GSimpleAction *action,
1499 GVariant *parameter,
1500 gpointer data)
1501{
1502 popup_help_dialog_string(HELP_CITIES_ITEM);
1503}
1504
1505/************************************************************************/
1508 static void help_improvements_callback(GSimpleAction *action,
1509 GVariant *parameter,
1510 gpointer data)
1511{
1512 popup_help_dialog_string(HELP_IMPROVEMENTS_ITEM);
1513}
1514
1515/************************************************************************/
1518 static void help_wonders_callback(GSimpleAction *action,
1519 GVariant *parameter,
1520 gpointer data)
1521{
1522 popup_help_dialog_string(HELP_WONDERS_ITEM);
1523}
1524
1525/************************************************************************/
1528 static void help_units_callback(GSimpleAction *action,
1529 GVariant *parameter,
1530 gpointer data)
1531{
1532 popup_help_dialog_string(HELP_UNITS_ITEM);
1533}
1534
1535/************************************************************************/
1538 static void help_combat_callback(GSimpleAction *action,
1539 GVariant *parameter,
1540 gpointer data)
1541{
1542 popup_help_dialog_string(HELP_COMBAT_ITEM);
1543}
1544
1545/************************************************************************/
1548 static void help_zoc_callback(GSimpleAction *action,
1549 GVariant *parameter,
1550 gpointer data)
1551{
1552 popup_help_dialog_string(HELP_ZOC_ITEM);
1553}
1554
1555/************************************************************************/
1558 static void help_government_callback(GSimpleAction *action,
1559 GVariant *parameter,
1560 gpointer data)
1561{
1562 popup_help_dialog_string(HELP_GOVERNMENT_ITEM);
1563}
1564
1565/************************************************************************/
1568 static void help_diplomacy_callback(GSimpleAction *action,
1569 GVariant *parameter,
1570 gpointer data)
1571{
1572 popup_help_dialog_string(HELP_DIPLOMACY_ITEM);
1573}
1574
1575/************************************************************************/
1578 static void help_tech_callback(GSimpleAction *action,
1579 GVariant *parameter,
1580 gpointer data)
1581{
1582 popup_help_dialog_string(HELP_TECHS_ITEM);
1583}
1584
1585/************************************************************************/
1588 static void help_space_race_callback(GSimpleAction *action,
1589 GVariant *parameter,
1590 gpointer data)
1591{
1592 popup_help_dialog_string(HELP_SPACE_RACE_ITEM);
1593}
1594
1595/************************************************************************/
1598 static void help_ruleset_callback(GSimpleAction *action,
1599 GVariant *parameter,
1600 gpointer data)
1601{
1602 popup_help_dialog_string(HELP_RULESET_ITEM);
1603}
1604
1605/************************************************************************/
1608 static void help_tileset_callback(GSimpleAction *action,
1609 GVariant *parameter,
1610 gpointer data)
1611{
1612 popup_help_dialog_string(HELP_TILESET_ITEM);
1613}
1614
1615/************************************************************************/
1618 static void help_musicset_callback(GSimpleAction *action,
1619 GVariant *parameter,
1620 gpointer data)
1621{
1622 popup_help_dialog_string(HELP_MUSICSET_ITEM);
1623}
1624
1625/************************************************************************/
1628 static void help_nations_callback(GSimpleAction *action,
1629 GVariant *parameter,
1630 gpointer data)
1631{
1632 popup_help_dialog_string(HELP_NATIONS_ITEM);
1633}
1634
1635/************************************************************************/
1638 static void help_connecting_callback(GSimpleAction *action,
1639 GVariant *parameter,
1640 gpointer data)
1641{
1642 popup_help_dialog_string(HELP_CONNECTING_ITEM);
1643}
1644
1645/************************************************************************/
1648 static void help_controls_callback(GSimpleAction *action,
1649 GVariant *parameter,
1650 gpointer data)
1651{
1652 popup_help_dialog_string(HELP_CONTROLS_ITEM);
1653}
1654
1655/************************************************************************/
1658 static void help_governor_callback(GSimpleAction *action,
1659 GVariant *parameter,
1660 gpointer data)
1661{
1662 popup_help_dialog_string(HELP_CMA_ITEM);
1663}
1664
1665/************************************************************************/
1668 static void help_chatline_callback(GSimpleAction *action,
1669 GVariant *parameter,
1670 gpointer data)
1671{
1672 popup_help_dialog_string(HELP_CHATLINE_ITEM);
1673}
1674
1675/************************************************************************/
1678 static void help_worklist_editor_callback(GSimpleAction *action,
1679 GVariant *parameter,
1680 gpointer data)
1681{
1682 popup_help_dialog_string(HELP_WORKLIST_EDITOR_ITEM);
1683}
1684
1685/************************************************************************/
1688 static void help_language_callback(GSimpleAction *action,
1689 GVariant *parameter,
1690 gpointer data)
1691{
1692 popup_help_dialog_string(HELP_LANGUAGES_ITEM);
1693}
1694
1695/************************************************************************/
1698 static void help_copying_callback(GSimpleAction *action,
1699 GVariant *parameter,
1700 gpointer data)
1701{
1702 popup_help_dialog_string(HELP_COPYING_ITEM);
1703}
1704
1705/************************************************************************/
1708 static void help_about_callback(GSimpleAction *action,
1709 GVariant *parameter,
1710 gpointer data)
1711{
1712 popup_help_dialog_string(HELP_ABOUT_ITEM);
1713}
1714
1715/************************************************************************/
1718 static void edit_mode_callback(GSimpleAction *action,
1719 GVariant *parameter,
1720 gpointer data)
1721{
1722 key_editor_toggle();
1723
1724 /* Unreachable techs in reqtree on/off */
1725 science_report_dialog_popdown();
1726}
1727
1728struct menu_entry_option_map {
1729 const char *menu_entry;
1730 bool *option;
1731 int menu_pos;
1732};
1733
1734 const struct menu_entry_option_map meoms[] = {
1735 { "SAVE_OPTIONS_ON_EXIT", &gui_options.save_options_on_exit, -1 },
1736 { "FULL_SCREEN", &(GUI_GTK_OPTION(fullscreen)), -1 },
1737 { "EDIT_MODE", &game.info.is_edit_mode, -1 },
1738 { "TOGGLE_FOG", NULL, -1 },
1739 { "SHOW_CITY_OUTLINES", &gui_options.draw_city_outlines, VMENU_CITY_OUTLINES },
1740 { "SHOW_CITY_OUTPUT", &gui_options.draw_city_output, VMENU_CITY_OUTPUT },
1741 { "SHOW_MAP_GRID", &gui_options.draw_map_grid, VMENU_MAP_GRID },
1742 { "SHOW_NAT_BORDERS", &gui_options.draw_borders, VMENU_NAT_BORDERS },
1743 { "SHOW_NATIVE_TILES", &gui_options.draw_native, VMENU_NATIVE_TILES },
1744 { "SHOW_CITY_FULL_BAR", &gui_options.draw_full_citybar, VMENU_CITY_FULL_BAR },
1745 { "SHOW_CITY_NAMES", &gui_options.draw_city_names, VMENU_CITY_NAMES },
1746 { "SHOW_CITY_GROWTH", &gui_options.draw_city_growth, VMENU_CITY_GROWTH },
1747 { "SHOW_CITY_PRODUCTIONS", &gui_options.draw_city_productions,
1748 VMENU_CITY_PRODUCTIONS },
1749 { "SHOW_CITY_BUY_COST", &gui_options.draw_city_buycost, VMENU_CITY_BUY_COST },
1750 { "SHOW_CITY_TRADE_ROUTES", &gui_options.draw_city_trade_routes,
1751 VMENU_CITY_TRADE_ROUTES },
1752 { "SHOW_TERRAIN", &gui_options.draw_terrain, VMENU_TERRAIN },
1753 { "SHOW_COASTLINE", &gui_options.draw_coastline, VMENU_COASTLINE },
1754 { "SHOW_PATHS", &gui_options.draw_paths, VMENU_PATHS },
1755 { "SHOW_IRRIGATION", &gui_options.draw_irrigation, VMENU_IRRIGATION },
1756 { "SHOW_MINES", &gui_options.draw_mines, VMENU_MINES },
1757 { "SHOW_BASES", &gui_options.draw_fortress_airbase, VMENU_BASES },
1758 { "SHOW_RESOURCES", &gui_options.draw_specials, VMENU_RESOURCES },
1759 { "SHOW_HUTS", &gui_options.draw_huts, VMENU_HUTS },
1760 { "SHOW_POLLUTION", &gui_options.draw_pollution, VMENU_POLLUTION },
1761 { "SHOW_CITIES", &gui_options.draw_cities, VMENU_CITIES },
1762 { "SHOW_UNITS", &gui_options.draw_units, VMENU_UNITS },
1763 { "SHOW_UNIT_SOLID_BG", &gui_options.solid_color_behind_units, VMENU_UNIT_SOLID_BG },
1764 { "SHOW_UNIT_SHIELDS", &gui_options.draw_unit_shields , VMENU_UNIT_SHIELDS },
1765 { "SHOW_STACK_SIZE", &gui_options.draw_unit_stack_size, VMENU_STACK_SIZE },
1766 { "SHOW_FOCUS_UNIT", &gui_options.draw_focus_unit, VMENU_FOCUS_UNIT },
1767 { "SHOW_FOG_OF_WAR", &gui_options.draw_fog_of_war, VMENU_FOW },
1768
1769 { NULL, NULL, -1 }
1770};
1771
1772/************************************************************************/
1775 static void view_menu_item_toggle(void (*cb)(void),
1776 bool updt_sensitivity,
1777 gpointer data)
1778{
1779 int i;
1780 struct menu_entry_info *info = (struct menu_entry_info *)data;
1781
1782 info->state ^= 1;
1783
1784 cb();
1785
1786 if (updt_sensitivity) {
1787 view_menu_update_sensitivity(G_ACTION_MAP(gui_app()));
1788 }
1789
1790 /* TODO: Make the information available directly from menu_entry_info,
1791 * se we don't need to do this search for it */
1792 for (i = 0; meoms[i].menu_entry != NULL; i++) {
1793 if (!strcmp(meoms[i].menu_entry, info->key)) {
1794 g_menu_remove(view_menu, meoms[i].menu_pos);
1795 menu_item_insert_unref(view_menu, meoms[i].menu_pos,
1796 create_toggle_menu_item_for_key(info->key));
1797 return;
1798 }
1799 }
1800}
1801
1802/************************************************************************/
1805 static void show_city_outlines_callback(GSimpleAction *action,
1806 GVariant *parameter,
1807 gpointer data)
1808{
1809 view_menu_item_toggle(key_city_outlines_toggle, FALSE, data);
1810}
1811
1812/************************************************************************/
1815 static void show_city_output_callback(GSimpleAction *action,
1816 GVariant *parameter,
1817 gpointer data)
1818{
1819 view_menu_item_toggle(key_city_output_toggle, FALSE, data);
1820}
1821
1822/************************************************************************/
1825 static void show_map_grid_callback(GSimpleAction *action, GVariant *parameter,
1826 gpointer data)
1827{
1828 view_menu_item_toggle(key_map_grid_toggle, FALSE, data);
1829}
1830
1831/************************************************************************/
1834 static void show_national_borders_callback(GSimpleAction *action,
1835 GVariant *parameter,
1836 gpointer data)
1837{
1838 view_menu_item_toggle(key_map_borders_toggle, FALSE, data);
1839}
1840
1841/************************************************************************/
1844 static void show_native_tiles_callback(GSimpleAction *action,
1845 GVariant *parameter,
1846 gpointer data)
1847{
1848 view_menu_item_toggle(key_map_native_toggle, FALSE, data);
1849}
1850
1851/************************************************************************/
1854 static void show_city_full_bar_callback(GSimpleAction *action,
1855 GVariant *parameter,
1856 gpointer data)
1857{
1858 view_menu_item_toggle(key_city_full_bar_toggle, TRUE, data);
1859}
1860
1861/************************************************************************/
1864 static void show_city_names_callback(GSimpleAction *action,
1865 GVariant *parameter,
1866 gpointer data)
1867{
1868 view_menu_item_toggle(key_city_names_toggle, TRUE, data);
1869}
1870
1871/************************************************************************/
1874 static void show_city_growth_callback(GSimpleAction *action,
1875 GVariant *parameter,
1876 gpointer data)
1877{
1878 view_menu_item_toggle(key_city_growth_toggle, FALSE, data);
1879}
1880
1881/************************************************************************/
1884 static void show_city_productions_callback(GSimpleAction *action,
1885 GVariant *parameter,
1886 gpointer data)
1887{
1888 view_menu_item_toggle(key_city_productions_toggle, TRUE, data);
1889}
1890
1891/************************************************************************/
1894 static void show_city_buy_cost_callback(GSimpleAction *action,
1895 GVariant *parameter,
1896 gpointer data)
1897{
1898 view_menu_item_toggle(key_city_buycost_toggle, FALSE, data);
1899}
1900
1901/************************************************************************/
1904 static void show_city_trade_routes_callback(GSimpleAction *action,
1905 GVariant *parameter,
1906 gpointer data)
1907{
1908 view_menu_item_toggle(key_city_trade_routes_toggle, FALSE, data);
1909}
1910
1911/************************************************************************/
1914 static void show_terrain_callback(GSimpleAction *action,
1915 GVariant *parameter,
1916 gpointer data)
1917{
1918 view_menu_item_toggle(key_terrain_toggle, TRUE, data);
1919}
1920
1921/************************************************************************/
1924 static void show_coastline_callback(GSimpleAction *action,
1925 GVariant *parameter,
1926 gpointer data)
1927{
1928 view_menu_item_toggle(key_coastline_toggle, FALSE, data);
1929}
1930
1931/************************************************************************/
1934 static void show_paths_callback(GSimpleAction *action,
1935 GVariant *parameter,
1936 gpointer data)
1937{
1938 view_menu_item_toggle(key_paths_toggle, FALSE, data);
1939}
1940
1941/************************************************************************/
1944 static void show_irrigation_callback(GSimpleAction *action,
1945 GVariant *parameter,
1946 gpointer data)
1947{
1948 view_menu_item_toggle(key_irrigation_toggle, FALSE, data);
1949}
1950
1951/************************************************************************/
1954 static void show_mines_callback(GSimpleAction *action,
1955 GVariant *parameter,
1956 gpointer data)
1957{
1958 view_menu_item_toggle(key_mines_toggle, FALSE, data);
1959}
1960
1961/************************************************************************/
1964 static void show_bases_callback(GSimpleAction *action, GVariant *parameter,
1965 gpointer data)
1966{
1967 view_menu_item_toggle(key_bases_toggle, FALSE, data);
1968}
1969
1970/************************************************************************/
1973 static void show_resources_callback(GSimpleAction *action,
1974 GVariant *parameter,
1975 gpointer data)
1976{
1977 view_menu_item_toggle(key_resources_toggle, FALSE, data);
1978}
1979
1980/************************************************************************/
1983 static void show_huts_callback(GSimpleAction *action, GVariant *parameter,
1984 gpointer data)
1985{
1986 view_menu_item_toggle(key_huts_toggle, FALSE, data);
1987}
1988
1989/************************************************************************/
1992 static void show_pollution_callback(GSimpleAction *action, GVariant *parameter,
1993 gpointer data)
1994{
1995 view_menu_item_toggle(key_pollution_toggle, FALSE, data);
1996}
1997
1998/************************************************************************/
2001 static void show_cities_callback(GSimpleAction *action, GVariant *parameter,
2002 gpointer data)
2003{
2004 view_menu_item_toggle(key_cities_toggle, FALSE, data);
2005}
2006
2007/************************************************************************/
2010 static void show_units_callback(GSimpleAction *action, GVariant *parameter,
2011 gpointer data)
2012{
2013 view_menu_item_toggle(key_units_toggle, TRUE, data);
2014}
2015
2016/************************************************************************/
2019 static void show_unit_solid_bg_callback(GSimpleAction *action,
2020 GVariant *parameter,
2021 gpointer data)
2022{
2023 view_menu_item_toggle(key_unit_solid_bg_toggle, FALSE, data);
2024}
2025
2026/************************************************************************/
2029 static void show_unit_shields_callback(GSimpleAction *action,
2030 GVariant *parameter,
2031 gpointer data)
2032{
2033 view_menu_item_toggle(key_unit_shields_toggle, FALSE, data);
2034}
2035
2036/************************************************************************/
2039 static void show_stack_size_callback(GSimpleAction *action,
2040 GVariant *parameter,
2041 gpointer data)
2042{
2043 view_menu_item_toggle(key_unit_stack_size_toggle, FALSE, data);
2044}
2045
2046/************************************************************************/
2049 static void show_focus_unit_callback(GSimpleAction *action,
2050 GVariant *parameter,
2051 gpointer data)
2052{
2053 view_menu_item_toggle(key_focus_unit_toggle, TRUE, data);
2054}
2055
2056/************************************************************************/
2059 static void show_fog_of_war_callback(GSimpleAction *action, GVariant *parameter,
2060 gpointer data)
2061{
2062 view_menu_item_toggle(key_fog_of_war_toggle, TRUE, data);
2063}
2064
2065/************************************************************************/
2068 static void full_screen_callback(GSimpleAction *action, GVariant *parameter,
2069 gpointer data)
2070{
2071 struct menu_entry_info *info = (struct menu_entry_info *)data;
2072
2073 info->state ^= 1;
2074 GUI_GTK_OPTION(fullscreen) = info->state;
2075
2076 fullscreen_opt_refresh(NULL);
2077
2078 g_menu_remove(view_menu, VMENU_FULL_SCREEN);
2079
2080 menu_item_insert_unref(view_menu, VMENU_FULL_SCREEN,
2081 create_toggle_menu_item(info));
2082}
2083
2084/************************************************************************/
2087 static void toggle_fog_callback(GSimpleAction *action,
2088 GVariant *parameter,
2089 gpointer data)
2090{
2091 struct menu_entry_info *info = (struct menu_entry_info *)data;
2092
2093 info->state ^= 1; /* We can only hope that client and server are in sync.
2094 * TODO: Make sure they are. */
2095 key_editor_toggle_fogofwar();
2096
2097 g_menu_remove(edit_menu, 5);
2098
2099 menu_item_insert_unref(edit_menu, 5,
2100 create_toggle_menu_item(info));
2101}
2102
2103/************************************************************************/
2106 static void scenario_properties_callback(GSimpleAction *action,
2107 GVariant *parameter,
2108 gpointer data)
2109{
2110 struct property_editor *pe;
2111
2112 pe = editprop_get_property_editor();
2113 property_editor_reload(pe, OBJTYPE_GAME);
2114 property_editor_popup(pe, OBJTYPE_GAME);
2115}
2116
2117/************************************************************************/
2120 static void save_scenario_callback(GSimpleAction *action, GVariant *parameter,
2121 gpointer data)
2122{
2123 save_scenario_dialog_popup();
2124}
2125
2126/************************************************************************/
2129 static void select_single_callback(GSimpleAction *action, GVariant *parameter,
2130 gpointer data)
2131{
2132 request_unit_select(get_units_in_focus(), SELTYPE_SINGLE, SELLOC_TILE);
2133}
2134
2135/************************************************************************/
2138 static void select_all_on_tile_callback(GSimpleAction *action,
2139 GVariant *parameter,
2140 gpointer data)
2141{
2142 request_unit_select(get_units_in_focus(), SELTYPE_ALL, SELLOC_TILE);
2143}
2144
2145/************************************************************************/
2148 static void select_same_type_tile_callback(GSimpleAction *action,
2149 GVariant *parameter,
2150 gpointer data)
2151{
2152 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
2153}
2154
2155/************************************************************************/
2158 static void select_same_type_cont_callback(GSimpleAction *action,
2159 GVariant *parameter,
2160 gpointer data)
2161{
2162 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_CONT);
2163}
2164
2165/************************************************************************/
2168 static void select_same_type_callback(GSimpleAction *action,
2169 GVariant *parameter,
2170 gpointer data)
2171{
2172 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_WORLD);
2173}
2174
2175/************************************************************************/
2178 static void select_dialog_callback(GSimpleAction *action,
2179 GVariant *parameter,
2180 gpointer data)
2181{
2182 unit_select_dialog_popup(NULL);
2183}
2184
2185/************************************************************************/
2188 static void rally_dialog_callback(GSimpleAction *action,
2189 GVariant *parameter,
2190 gpointer data)
2191{
2192 rally_dialog_popup();
2193}
2194
2195/************************************************************************/
2198 static void infra_dialog_callback(GSimpleAction *action,
2199 GVariant *parameter,
2200 gpointer data)
2201{
2202 infra_dialog_popup();
2203}
2204
2205/************************************************************************/
2208 static void unit_wait_callback(GSimpleAction *action,
2209 GVariant *parameter,
2210 gpointer data)
2211{
2212 key_unit_wait();
2213}
2214
2215/************************************************************************/
2218 static void unit_done_callback(GSimpleAction *action,
2219 GVariant *parameter,
2220 gpointer data)
2221{
2222 key_unit_done();
2223}
2224
2225/************************************************************************/
2228 static void unit_goto_callback(GSimpleAction *action, GVariant *parameter,
2229 gpointer data)
2230{
2231 key_unit_goto();
2232}
2233
2234/************************************************************************/
2237 static void unit_goto_and_callback(GSimpleAction *action,
2238 GVariant *parameter,
2239 gpointer data)
2240{
2241 int sub_target = NO_TARGET;
2242 struct action *paction = (struct action *)data;
2243
2244 fc_assert_ret(paction != NULL);
2245
2246 switch (action_get_sub_target_kind(paction)) {
2247 case ASTK_BUILDING:
2248 {
2249 struct impr_type *pbuilding = g_object_get_data(G_OBJECT(action),
2250 "end_building");
2251 fc_assert_ret(pbuilding != NULL);
2252 sub_target = improvement_number(pbuilding);
2253 }
2254 break;
2255 case ASTK_TECH:
2256 {
2257 struct advance *ptech = g_object_get_data(G_OBJECT(action),
2258 "end_tech");
2259 fc_assert_ret(ptech != NULL);
2260 sub_target = advance_number(ptech);
2261 }
2262 break;
2263 case ASTK_EXTRA:
2264 case ASTK_EXTRA_NOT_THERE:
2265 {
2266 struct extra_type *pextra = g_object_get_data(G_OBJECT(action),
2267 "end_extra");
2268 fc_assert_ret(pextra != NULL);
2269 sub_target = extra_number(pextra);
2270 }
2271 break;
2272 case ASTK_NONE:
2273 sub_target = NO_TARGET;
2274 break;
2275 case ASTK_COUNT:
2276 /* Should not exits */
2277 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
2278 break;
2279 }
2280
2281 request_unit_goto(ORDER_PERFORM_ACTION, paction->id, sub_target);
2282}
2283
2284/************************************************************************/
2287 static void unit_goto_city_callback(GSimpleAction *action,
2288 GVariant *parameter,
2289 gpointer data)
2290{
2291 if (get_num_units_in_focus() > 0) {
2292 popup_goto_dialog();
2293 }
2294}
2295
2296/************************************************************************/
2299 static void unit_return_callback(GSimpleAction *action,
2300 GVariant *parameter,
2301 gpointer data)
2302{
2303 unit_list_iterate(get_units_in_focus(), punit) {
2304 request_unit_return(punit);
2305 } unit_list_iterate_end;
2306}
2307
2308/************************************************************************/
2311 static void unit_explore_callback(GSimpleAction *action,
2312 GVariant *parameter,
2313 gpointer data)
2314{
2315 key_unit_auto_explore();
2316}
2317
2318/************************************************************************/
2321 static void unit_patrol_callback(GSimpleAction *action, GVariant *parameter,
2322 gpointer data)
2323{
2324 key_unit_patrol();
2325}
2326
2327/************************************************************************/
2330 static void unit_teleport_callback(GSimpleAction *action, GVariant *parameter,
2331 gpointer data)
2332{
2333 key_unit_teleport();
2334}
2335
2336/************************************************************************/
2339 static void unit_sentry_callback(GSimpleAction *action,
2340 GVariant *parameter,
2341 gpointer data)
2342{
2343 key_unit_sentry();
2344}
2345
2346/************************************************************************/
2349 static void unsentry_all_callback(GSimpleAction *action,
2350 GVariant *parameter,
2351 gpointer data)
2352{
2353 key_unit_wakeup_others();
2354}
2355
2356/************************************************************************/
2359 static void fortify_callback(GSimpleAction *action,
2360 GVariant *parameter,
2361 gpointer data)
2362{
2363 unit_list_iterate(get_units_in_focus(), punit) {
2364 request_unit_fortify(punit);
2365 } unit_list_iterate_end;
2366}
2367
2368/************************************************************************/
2371 static void unit_board_callback(GSimpleAction *action, GVariant *parameter,
2372 gpointer data)
2373{
2374 unit_list_iterate(get_units_in_focus(), punit) {
2375 request_transport(punit, unit_tile(punit));
2376 } unit_list_iterate_end;
2377}
2378
2379/************************************************************************/
2382 static void unit_deboard_callback(GSimpleAction *action, GVariant *parameter,
2383 gpointer data)
2384{
2385 unit_list_iterate(get_units_in_focus(), punit) {
2386 request_unit_unload(punit);
2387 } unit_list_iterate_end;
2388}
2389
2390/************************************************************************/
2393 static void unit_unload_transporter_callback(GSimpleAction *action,
2394 GVariant *parameter,
2395 gpointer data)
2396{
2397 key_unit_unload_all();
2398}
2399
2400/************************************************************************/
2403 static void unit_homecity_callback(GSimpleAction *action,
2404 GVariant *parameter,
2405 gpointer data)
2406{
2407 key_unit_homecity();
2408}
2409
2410/************************************************************************/
2413 static void unit_upgrade_callback(GSimpleAction *action,
2414 GVariant *parameter,
2415 gpointer data)
2416{
2417 popup_upgrade_dialog(get_units_in_focus());
2418}
2419
2420/************************************************************************/
2423 static void unit_convert_callback(GSimpleAction *action,
2424 GVariant *parameter,
2425 gpointer data)
2426{
2427 key_unit_convert();
2428}
2429
2430/************************************************************************/
2433 static void unit_disband_callback(GSimpleAction *action,
2434 GVariant *parameter,
2435 gpointer data)
2436{
2437 popup_disband_dialog(get_units_in_focus());
2438}
2439
2440/************************************************************************/
2443 static void build_city_callback(GSimpleAction *action,
2444 GVariant *parameter,
2445 gpointer data)
2446{
2447 unit_list_iterate(get_units_in_focus(), punit) {
2448 /* FIXME: this can provide different items for different units...
2449 * not good! */
2450 /* Enable the button for adding to a city in all cases, so we
2451 get an eventual error message from the server if we try. */
2452 if (unit_can_add_or_build_city(punit)) {
2453 request_unit_build_city(punit);
2454 } else if (utype_can_do_action(unit_type_get(punit),
2455 ACTION_HELP_WONDER)) {
2456 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
2457 }
2458 } unit_list_iterate_end;
2459}
2460
2461/************************************************************************/
2464 static void auto_work_callback(GSimpleAction *action,
2465 GVariant *parameter,
2466 gpointer data)
2467{
2468 key_unit_auto_work();
2469}
2470
2471/************************************************************************/
2474 static void build_road_callback(GSimpleAction *action,
2475 GVariant *parameter,
2476 gpointer data)
2477{
2478 unit_list_iterate(get_units_in_focus(), punit) {
2479 /* FIXME: this can provide different actions for different units...
2480 * not good! */
2481 struct extra_type *tgt = next_extra_for_tile(unit_tile(punit),
2482 EC_ROAD,
2483 unit_owner(punit),
2484 punit);
2485 bool building_road = FALSE;
2486
2487 if (tgt != NULL
2488 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD, tgt)) {
2489 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, tgt);
2490 building_road = TRUE;
2491 }
2492
2493 if (!building_road && unit_can_est_trade_route_here(punit)) {
2494 request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
2495 }
2496 } unit_list_iterate_end;
2497}
2498
2499/************************************************************************/
2502 static void build_irrigation_callback(GSimpleAction *action,
2503 GVariant *parameter,
2504 gpointer data)
2505{
2506 key_unit_irrigate();
2507}
2508
2509/************************************************************************/
2512 static void cultivate_callback(GSimpleAction *action,
2513 GVariant *parameter,
2514 gpointer data)
2515{
2516 key_unit_cultivate();
2517}
2518
2519/************************************************************************/
2522 static void plant_callback(GSimpleAction *action,
2523 GVariant *parameter,
2524 gpointer data)
2525{
2526 key_unit_plant();
2527}
2528
2529/************************************************************************/
2532 static void build_mine_callback(GSimpleAction *action,
2533 GVariant *parameter,
2534 gpointer data)
2535{
2536 key_unit_mine();
2537}
2538
2539/************************************************************************/
2542 static void connect_road_callback(GSimpleAction *action,
2543 GVariant *parameter,
2544 gpointer data)
2545{
2546 struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
2547
2548 if (proad != NULL) {
2549 struct extra_type *tgt;
2550
2551 tgt = road_extra_get(proad);
2552
2553 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2554 }
2555}
2556
2557/************************************************************************/
2560 static void connect_rail_callback(GSimpleAction *action,
2561 GVariant *parameter,
2562 gpointer data)
2563{
2564 struct road_type *prail = road_by_gui_type(ROAD_GUI_RAILROAD);
2565
2566 if (prail != NULL) {
2567 struct extra_type *tgt;
2568
2569 tgt = road_extra_get(prail);
2570
2571 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2572 }
2573}
2574
2575/************************************************************************/
2578 static void connect_maglev_callback(GSimpleAction *action,
2579 GVariant *parameter,
2580 gpointer data)
2581{
2582 struct road_type *pmaglev = road_by_gui_type(ROAD_GUI_MAGLEV);
2583
2584 if (pmaglev != NULL) {
2585 struct extra_type *tgt;
2586
2587 tgt = road_extra_get(pmaglev);
2588
2589 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2590 }
2591}
2592
2593/************************************************************************/
2596 static void connect_irrigation_callback(GSimpleAction *action,
2597 GVariant *parameter,
2598 gpointer data)
2599{
2600 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
2601
2602 if (extra_type_list_size(extras) > 0) {
2603 struct extra_type *pextra;
2604
2605 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
2606
2607 key_unit_connect(ACTIVITY_IRRIGATE, pextra);
2608 }
2609}
2610
2611/************************************************************************/
2614 static void transform_terrain_callback(GSimpleAction *action,
2615 GVariant *parameter,
2616 gpointer data)
2617{
2618 key_unit_transform();
2619}
2620
2621/************************************************************************/
2624 static void clean_callback(GSimpleAction *action, GVariant *parameter,
2625 gpointer data)
2626{
2627 key_unit_clean();
2628}
2629
2630/************************************************************************/
2633 static void build_fortress_callback(GSimpleAction *action, GVariant *parameter,
2634 gpointer data)
2635{
2636 key_unit_fortress();
2637}
2638
2639/************************************************************************/
2642 static void build_airbase_callback(GSimpleAction *action, GVariant *parameter,
2643 gpointer data)
2644{
2645 key_unit_airbase();
2646}
2647
2648/************************************************************************/
2651 static void paradrop_callback(GSimpleAction *action,
2652 GVariant *parameter,
2653 gpointer data)
2654{
2655 key_unit_paradrop();
2656}
2657
2658/************************************************************************/
2661 static void pillage_callback(GSimpleAction *action,
2662 GVariant *parameter,
2663 gpointer data)
2664{
2665 key_unit_pillage();
2666}
2667
2668/************************************************************************/
2671 static void do_action_callback(GSimpleAction *action,
2672 GVariant *parameter,
2673 gpointer data)
2674{
2675 key_unit_action_select_tgt();
2676}
2677
2678/************************************************************************/
2681 static void tax_rate_callback(GSimpleAction *action, GVariant *parameter,
2682 gpointer data)
2683{
2684 popup_rates_dialog();
2685}
2686
2687/************************************************************************/
2690 static void multiplier_callback(GSimpleAction *action, GVariant *parameter,
2691 gpointer data)
2692{
2693 popup_multiplier_dialog();
2694}
2695
2696/************************************************************************/
2699 static void government_callback(GSimpleAction *action,
2700 GVariant *parameter,
2701 gpointer data)
2702{
2703 popup_revolution_dialog((struct government *) data);
2704}
2705
2706/************************************************************************/
2709 static void revolution_callback(GSimpleAction *action,
2710 GVariant *parameter,
2711 gpointer data)
2712{
2713 popup_revolution_dialog(NULL);
2714}
2715
2716/************************************************************************/
2719 static void base_callback(GSimpleAction *action,
2720 GVariant *parameter,
2721 gpointer data)
2722{
2723 struct extra_type *pextra = data;
2724
2725 unit_list_iterate(get_units_in_focus(), punit) {
2726 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
2727 } unit_list_iterate_end;
2728}
2729
2730/************************************************************************/
2733 static void road_callback(GSimpleAction *action,
2734 GVariant *parameter,
2735 gpointer data)
2736{
2737 struct extra_type *pextra = data;
2738
2739 unit_list_iterate(get_units_in_focus(), punit) {
2740 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD,
2741 pextra);
2742 } unit_list_iterate_end;
2743}
2744
2745/************************************************************************/
2748 static void irrigation_callback(GSimpleAction *action,
2749 GVariant *parameter,
2750 gpointer data)
2751{
2752 struct extra_type *pextra = data;
2753
2754 unit_list_iterate(get_units_in_focus(), punit) {
2755 request_new_unit_activity_targeted(punit, ACTIVITY_IRRIGATE,
2756 pextra);
2757 } unit_list_iterate_end;
2758}
2759
2760/************************************************************************/
2763 static void mine_callback(GSimpleAction *action,
2764 GVariant *parameter,
2765 gpointer data)
2766{
2767 struct extra_type *pextra = data;
2768
2769 unit_list_iterate(get_units_in_focus(), punit) {
2770 request_new_unit_activity_targeted(punit, ACTIVITY_MINE,
2771 pextra);
2772 } unit_list_iterate_end;
2773}
2774
2775/************************************************************************/
2778 static void clean_menu_callback(GSimpleAction *action,
2779 GVariant *parameter,
2780 gpointer data)
2781{
2782 struct extra_type *pextra = data;
2783
2784 unit_list_iterate(get_units_in_focus(), punit) {
2785 if (can_unit_do_activity_targeted_client(punit, ACTIVITY_CLEAN, pextra)) {
2786 request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN,
2787 pextra);
2788 }
2789 } unit_list_iterate_end;
2790}
2791
2792/************************************************************************/
2795 static void center_view_callback(GSimpleAction *action,
2796 GVariant *parameter,
2797 gpointer data)
2798{
2799 center_on_unit();
2800}
2801
2802/************************************************************************/
2805 static void report_units_callback(GSimpleAction *action,
2806 GVariant *parameter,
2807 gpointer data)
2808{
2809 units_report_dialog_popup(TRUE);
2810}
2811
2812/************************************************************************/
2815 static void report_cities_callback(GSimpleAction *action,
2816 GVariant *parameter,
2817 gpointer data)
2818
2819{
2820 city_report_dialog_popup(TRUE);
2821}
2822
2823/************************************************************************/
2826 static void report_economy_callback(GSimpleAction *action,
2827 GVariant *parameter,
2828 gpointer data)
2829{
2830 economy_report_dialog_popup(TRUE);
2831}
2832
2833/************************************************************************/
2836 static void report_research_callback(GSimpleAction *action,
2837 GVariant *parameter,
2838 gpointer data)
2839{
2840 science_report_dialog_popup(TRUE);
2841}
2842
2843/************************************************************************/
2846 static void report_spaceship_callback(GSimpleAction *action,
2847 GVariant *parameter,
2848 gpointer data)
2849{
2850 if (NULL != client.conn.playing) {
2851 popup_spaceship_dialog(client.conn.playing);
2852 }
2853}
2854
2855/************************************************************************/
2858 static void bg_select_callback(GSimpleAction *action,
2859 GVariant *parameter,
2860 gpointer data)
2861{
2862 key_unit_select_battlegroup(GPOINTER_TO_INT(data), FALSE);
2863}
2864
2865/************************************************************************/
2868 static void bg_assign_callback(GSimpleAction *action,
2869 GVariant *parameter,
2870 gpointer data)
2871{
2872 key_unit_assign_battlegroup(GPOINTER_TO_INT(data), FALSE);
2873}
2874
2875/************************************************************************/
2878 static void bg_append_callback(GSimpleAction *action,
2879 GVariant *parameter,
2880 gpointer data)
2881{
2882 key_unit_assign_battlegroup(GPOINTER_TO_INT(data), TRUE);
2883}
2884
2885/************************************************************************/
2889 static GMenuItem *create_toggle_menu_item(struct menu_entry_info *info)
2890{
2891 char actname[150];
2892 GMenuItem *item;
2893
2894 fc_snprintf(actname, sizeof(actname), "app.%s(%s)",
2895 info->action, info->state ? "true" : "false");
2896 item = g_menu_item_new(Q_(info->name), NULL);
2897 g_menu_item_set_detailed_action(item, actname);
2898
2899 if (info->accl != NULL) {
2900 const char *accls[2] = { info->accl, NULL };
2901
2902 gtk_application_set_accels_for_action(gui_app(), actname, accls);
2903 }
2904
2905 return item;
2906}
2907
2908/************************************************************************/
2912 static GMenuItem *create_toggle_menu_item_for_key(const char *key)
2913{
2914 return create_toggle_menu_item(menu_entry_info_find(key));
2915}
2916
2917/************************************************************************/
2920 static void menu_entry_init(GMenu *sub, const char *key)
2921{
2922 struct menu_entry_info *info = menu_entry_info_find(key);
2923
2924 if (info != NULL) {
2925 GMenuItem *item;
2926
2927 if (info->toggle != NULL) {
2928 item = create_toggle_menu_item(info);
2929 } else {
2930 char actname[150];
2931
2932 fc_snprintf(actname, sizeof(actname), "app.%s", info->action);
2933 item = g_menu_item_new(Q_(info->name), actname);
2934 }
2935
2936 /* Should be menu_item_append_unref()? */
2937 g_menu_append_item(sub, item);
2938 g_object_unref(item);
2939 }
2940}
2941
2942/************************************************************************/
2945 void menus_set_initial_toggle_values(void)
2946{
2947 int i;
2948
2949 for (i = 0; meoms[i].menu_entry != NULL; i++) {
2950 struct menu_entry_info *info = menu_entry_info_find(meoms[i].menu_entry);
2951
2952 if (meoms[i].option != NULL) {
2953 info->state = *meoms[i].option;
2954 } else {
2955 info->state = FALSE; /* Best guess we have */
2956 }
2957 }
2958}
2959
2960/************************************************************************/
2963 static void setup_app_actions(GApplication *fc_app)
2964{
2965 int i;
2966 GVariantType *bvart = g_variant_type_new("b");
2967
2968 /* Simple entries */
2969 g_action_map_add_action_entries(G_ACTION_MAP(fc_app), acts,
2970 G_N_ELEMENTS(acts), fc_app);
2971
2972 /* Toggles */
2973 for (i = 0; menu_entries[i].key != NULL; i++) {
2974 if (menu_entries[i].toggle != NULL) {
2975 GSimpleAction *act;
2976 GVariant *var = g_variant_new("b", TRUE);
2977
2978 act = g_simple_action_new_stateful(menu_entries[i].action, bvart, var);
2979 g_action_map_add_action(G_ACTION_MAP(fc_app), G_ACTION(act));
2980 g_signal_connect(act, "change-state",
2981 G_CALLBACK(menu_entries[i].toggle),
2982 (gpointer)&(menu_entries[i]));
2983 }
2984 }
2985
2986 g_variant_type_free(bvart);
2987
2988 for (i = 0; menu_entries[i].key != NULL; i++) {
2989 if (menu_entries[i].accl != NULL && menu_entries[i].toggle == NULL) {
2990 const char *accls[2] = { menu_entries[i].accl, NULL };
2991 char actname[150];
2992
2993 fc_snprintf(actname, sizeof(actname), "app.%s", menu_entries[i].action);
2994
2995 gtk_application_set_accels_for_action(GTK_APPLICATION(fc_app), actname, accls);
2996 }
2997 }
2998}
2999
3000/************************************************************************/
3003 static void register_bg_actions(GActionMap *map, int bg)
3004{
3005 GSimpleAction *act;
3006 char actname[256];
3007
3008 fc_snprintf(actname, sizeof(actname), "bg_select_%d", bg);
3009 act = g_simple_action_new(actname, NULL);
3010 g_action_map_add_action(map, G_ACTION(act));
3011 g_signal_connect(act, "activate",
3012 G_CALLBACK(bg_select_callback), GINT_TO_POINTER(bg));
3013
3014 fc_snprintf(actname, sizeof(actname), "bg_assign_%d", bg);
3015 act = g_simple_action_new(actname, NULL);
3016 g_action_map_add_action(map, G_ACTION(act));
3017 g_signal_connect(act, "activate",
3018 G_CALLBACK(bg_assign_callback), GINT_TO_POINTER(bg));
3019
3020 fc_snprintf(actname, sizeof(actname), "bg_append_%d", bg);
3021 act = g_simple_action_new(actname, NULL);
3022 g_action_map_add_action(map, G_ACTION(act));
3023 g_signal_connect(act, "activate",
3024 G_CALLBACK(bg_append_callback), GINT_TO_POINTER(bg));
3025}
3026
3027/************************************************************************/
3030 static GMenu *setup_menus(GtkApplication *app)
3031{
3032 GMenu *menubar;
3033 GMenu *topmenu;
3034 GMenu *submenu;
3035 int i;
3036
3037 fc_assert(!menus_built);
3038
3039 menubar = g_menu_new();
3040
3041 topmenu = g_menu_new();
3042 menu_entry_init(topmenu, "CLEAR_CHAT_LOGS");
3043 menu_entry_init(topmenu, "SAVE_CHAT_LOGS");
3044
3045 options_menu = g_menu_new();
3046 menu_entry_init(options_menu, "LOCAL_OPTIONS");
3047 menu_entry_init(options_menu, "MESSAGE_OPTIONS");
3048 menu_entry_init(options_menu, "SERVER_OPTIONS");
3049 menu_entry_init(options_menu, "SAVE_OPTIONS");
3050 menu_entry_init(options_menu, "SAVE_OPTIONS_ON_EXIT");
3051
3052 submenu_append_unref(topmenu, _("_Options"), G_MENU_MODEL(options_menu));
3053
3054#ifdef FREECIV_DEBUG
3055 menu_entry_init(topmenu, "RELOAD_TILESET");
3056#endif /* FREECIV_DEBUG */
3057
3058 menu_entry_init(topmenu, "GAME_SAVE");
3059 menu_entry_init(topmenu, "GAME_SAVE_AS");
3060 menu_entry_init(topmenu, "MAPIMG_SAVE");
3061 menu_entry_init(topmenu, "MAPIMG_SAVE_AS");
3062 menu_entry_init(topmenu, "LEAVE");
3063 menu_entry_init(topmenu, "QUIT");
3064
3065 submenu_append_unref(menubar, _("_Game"), G_MENU_MODEL(topmenu));
3066
3067 edit_menu = g_menu_new();
3068
3069 menu_entry_init(edit_menu, "FIND_CITY");
3070 menu_entry_init(edit_menu, "WORKLISTS");
3071 menu_entry_init(edit_menu, "RALLY_DLG");
3072 menu_entry_init(edit_menu, "INFRA_DLG");
3073 menu_entry_init(edit_menu, "EDIT_MODE");
3074 menu_entry_init(edit_menu, "TOGGLE_FOG");
3075 menu_entry_init(edit_menu, "SCENARIO_PROPERTIES");
3076 menu_entry_init(edit_menu, "SCENARIO_SAVE");
3077 menu_entry_init(edit_menu, "CLIENT_LUA_SCRIPT");
3078
3079 submenu_append_unref(menubar, _("_Edit"), G_MENU_MODEL(edit_menu));
3080
3081 view_menu = g_menu_new();
3082
3083 menu_entry_init(view_menu, "SHOW_CITY_OUTLINES");
3084 menu_entry_init(view_menu, "SHOW_CITY_OUTPUT");
3085 menu_entry_init(view_menu, "SHOW_MAP_GRID");
3086 menu_entry_init(view_menu, "SHOW_NAT_BORDERS");
3087 menu_entry_init(view_menu, "SHOW_NATIVE_TILES");
3088 menu_entry_init(view_menu, "SHOW_CITY_FULL_BAR");
3089 menu_entry_init(view_menu, "SHOW_CITY_NAMES");
3090 menu_entry_init(view_menu, "SHOW_CITY_GROWTH");
3091 menu_entry_init(view_menu, "SHOW_CITY_PRODUCTIONS");
3092 menu_entry_init(view_menu, "SHOW_CITY_BUY_COST");
3093 menu_entry_init(view_menu, "SHOW_CITY_TRADE_ROUTES");
3094 menu_entry_init(view_menu, "SHOW_TERRAIN");
3095 menu_entry_init(view_menu, "SHOW_COASTLINE");
3096 menu_entry_init(view_menu, "SHOW_PATHS");
3097 menu_entry_init(view_menu, "SHOW_IRRIGATION");
3098 menu_entry_init(view_menu, "SHOW_MINES");
3099 menu_entry_init(view_menu, "SHOW_BASES");
3100 menu_entry_init(view_menu, "SHOW_RESOURCES");
3101 menu_entry_init(view_menu, "SHOW_HUTS");
3102 menu_entry_init(view_menu, "SHOW_POLLUTION");
3103 menu_entry_init(view_menu, "SHOW_CITIES");
3104 menu_entry_init(view_menu, "SHOW_UNITS");
3105 menu_entry_init(view_menu, "SHOW_UNIT_SOLID_BG");
3106 menu_entry_init(view_menu, "SHOW_UNIT_SHIELDS");
3107 menu_entry_init(view_menu, "SHOW_STACK_SIZE");
3108 menu_entry_init(view_menu, "SHOW_FOCUS_UNIT");
3109
3110 menu_entry_init(view_menu, "SHOW_FOG_OF_WAR");
3111
3112 menu_entry_init(view_menu, "FULL_SCREEN");
3113 menu_entry_init(view_menu, "CENTER_VIEW");
3114
3115 submenu_append_unref(menubar, Q_("?verb:_View"), G_MENU_MODEL(view_menu));
3116
3117 topmenu = g_menu_new();
3118
3119 menu_entry_init(topmenu, "SELECT_SINGLE");
3120 menu_entry_init(topmenu, "SELECT_ALL_ON_TILE");
3121 menu_entry_init(topmenu, "SELECT_SAME_TYPE_TILE");
3122 menu_entry_init(topmenu, "SELECT_SAME_TYPE_CONT");
3123 menu_entry_init(topmenu, "SELECT_SAME_TYPE");
3124 menu_entry_init(topmenu, "SELECT_DLG");
3125
3126 submenu_append_unref(menubar, _("_Select"), G_MENU_MODEL(topmenu));
3127
3128 unit_menu = g_menu_new();
3129
3130 menu_entry_init(unit_menu, "UNIT_GOTO");
3131
3132 /* Placeholder submenu (so that menu update has something to replace) */
3133 submenu = g_menu_new();
3134 submenu_append_unref(unit_menu, N_("Go to a_nd..."), G_MENU_MODEL(submenu));
3135
3136 menu_entry_init(unit_menu, "UNIT_GOTO_CITY");
3137 menu_entry_init(unit_menu, "UNIT_RETURN");
3138 menu_entry_init(unit_menu, "UNIT_EXPLORE");
3139 menu_entry_init(unit_menu, "UNIT_PATROL");
3140 menu_entry_init(unit_menu, "UNIT_TELEPORT");
3141 menu_entry_init(unit_menu, "UNIT_SENTRY");
3142 menu_entry_init(unit_menu, "UNSENTRY_ALL");
3143 menu_entry_init(unit_menu, "UNIT_BOARD");
3144 menu_entry_init(unit_menu, "UNIT_DEBOARD");
3145 menu_entry_init(unit_menu, "UNIT_UNLOAD_TRANSPORTER");
3146 menu_entry_init(unit_menu, "UNIT_HOMECITY");
3147 menu_entry_init(unit_menu, "UNIT_UPGRADE");
3148 menu_entry_init(unit_menu, "UNIT_CONVERT");
3149 menu_entry_init(unit_menu, "UNIT_DISBAND");
3150 menu_entry_init(unit_menu, "DO_ACTION");
3151 menu_entry_init(unit_menu, "UNIT_WAIT");
3152 menu_entry_init(unit_menu, "UNIT_DONE");
3153
3154 submenu_append_unref(menubar, _("_Unit"), G_MENU_MODEL(unit_menu));
3155
3156 work_menu = g_menu_new();
3157 menu_entry_init(work_menu, "BUILD_CITY");
3158 menu_entry_init(work_menu, "AUTO_WORKER");
3159
3160 /* Placeholder submenus (so that menu update has something to replace) */
3161 submenu = g_menu_new();
3162 submenu_append_unref(work_menu, _("Build _Path"), G_MENU_MODEL(submenu));
3163 submenu = g_menu_new();
3164 submenu_append_unref(work_menu, _("Build _Irrigation"), G_MENU_MODEL(submenu));
3165 submenu = g_menu_new();
3166 submenu_append_unref(work_menu, _("Build _Mine"), G_MENU_MODEL(submenu));
3167 submenu = g_menu_new();
3168 submenu_append_unref(work_menu, _("_Clean Nuisance"), G_MENU_MODEL(submenu));
3169
3170 menu_entry_init(work_menu, "BUILD_ROAD");
3171 menu_entry_init(work_menu, "BUILD_IRRIGATION");
3172 menu_entry_init(work_menu, "BUILD_MINE");
3173 menu_entry_init(work_menu, "CULTIVATE");
3174 menu_entry_init(work_menu, "PLANT");
3175 menu_entry_init(work_menu, "TRANSFORM_TERRAIN");
3176 menu_entry_init(work_menu, "CONNECT_ROAD");
3177 menu_entry_init(work_menu, "CONNECT_RAIL");
3178 menu_entry_init(work_menu, "CONNECT_MAGLEV");
3179 menu_entry_init(work_menu, "CONNECT_IRRIGATION");
3180 menu_entry_init(work_menu, "CLEAN");
3181
3182 submenu_append_unref(menubar, _("_Work"), G_MENU_MODEL(work_menu));
3183
3184 combat_menu = g_menu_new();
3185 menu_entry_init(combat_menu, "FORTIFY");
3186 menu_entry_init(combat_menu, "BUILD_FORTRESS");
3187 menu_entry_init(combat_menu, "BUILD_AIRBASE");
3188
3189 /* Placeholder submenu (so that menu update has something to replace) */
3190 submenu = g_menu_new();
3191 submenu_append_unref(combat_menu, _("Build _Base"), G_MENU_MODEL(submenu));
3192
3193 submenu_append_unref(menubar, _("_Combat"), G_MENU_MODEL(combat_menu));
3194
3195 menu_entry_init(combat_menu, "PARADROP");
3196 menu_entry_init(combat_menu, "PILLAGE");
3197
3198 gov_menu = g_menu_new();
3199
3200 menu_entry_init(gov_menu, "MAP_VIEW");
3201 menu_entry_init(gov_menu, "REPORT_UNITS");
3202 menu_entry_init(gov_menu, "REPORT_NATIONS");
3203 menu_entry_init(gov_menu, "REPORT_CITIES");
3204 menu_entry_init(gov_menu, "REPORT_ECONOMY");
3205 menu_entry_init(gov_menu, "REPORT_RESEARCH");
3206 menu_entry_init(gov_menu, "TAX_RATES");
3207 menu_entry_init(gov_menu, "POLICIES");
3208
3209 /* Placeholder submenu (so that menu update has something to replace) */
3210 submenu = g_menu_new();
3211 submenu_append_unref(gov_menu, _("_Government"), G_MENU_MODEL(submenu));
3212
3213 menu_entry_init(gov_menu, "REPORT_WOW");
3214 menu_entry_init(gov_menu, "REPORT_TOP_CITIES");
3215 menu_entry_init(gov_menu, "REPORT_MESSAGES");
3216 menu_entry_init(gov_menu, "REPORT_DEMOGRAPHIC");
3217 menu_entry_init(gov_menu, "REPORT_SPACESHIP");
3218 menu_entry_init(gov_menu, "REPORT_ACHIEVEMENTS");
3219
3220 submenu_append_unref(menubar, _("C_ivilization"), G_MENU_MODEL(gov_menu));
3221
3222 topmenu = g_menu_new();
3223
3224 /* Keys exist for 4 battle groups */
3225 FC_STATIC_ASSERT(MAX_NUM_BATTLEGROUPS == 4, incompatible_bg_count);
3226
3227 for (i = 0; i < MAX_NUM_BATTLEGROUPS; i++) {
3228 char key[128];
3229
3230 /* User side battle group numbers start from 1 */
3231 fc_snprintf(key, sizeof(key), "BG_SELECT_%d", i + 1);
3232 menu_entry_init(topmenu, key);
3233 fc_snprintf(key, sizeof(key), "BG_ASSIGN_%d", i + 1);
3234 menu_entry_init(topmenu, key);
3235 fc_snprintf(key, sizeof(key), "BG_APPEND_%d", i + 1);
3236 menu_entry_init(topmenu, key);
3237
3238 register_bg_actions(G_ACTION_MAP(app), i);
3239 }
3240
3241 submenu_append_unref(menubar, _("_Battle Groups"), G_MENU_MODEL(topmenu));
3242
3243 topmenu = g_menu_new();
3244
3245 menu_entry_init(topmenu, "HELP_OVERVIEW");
3246 menu_entry_init(topmenu, "HELP_PLAYING");
3247 menu_entry_init(topmenu, "HELP_POLICIES");
3248 menu_entry_init(topmenu, "HELP_TERRAIN");
3249 menu_entry_init(topmenu, "HELP_ECONOMY");
3250 menu_entry_init(topmenu, "HELP_CITIES");
3251 menu_entry_init(topmenu, "HELP_IMPROVEMENTS");
3252 menu_entry_init(topmenu, "HELP_WONDERS");
3253 menu_entry_init(topmenu, "HELP_UNITS");
3254 menu_entry_init(topmenu, "HELP_COMBAT");
3255 menu_entry_init(topmenu, "HELP_ZOC");
3256 menu_entry_init(topmenu, "HELP_GOVERNMENT");
3257 menu_entry_init(topmenu, "HELP_DIPLOMACY");
3258 menu_entry_init(topmenu, "HELP_TECH");
3259 menu_entry_init(topmenu, "HELP_SPACE_RACE");
3260 menu_entry_init(topmenu, "HELP_RULESET");
3261 menu_entry_init(topmenu, "HELP_TILESET");
3262 menu_entry_init(topmenu, "HELP_MUSICSET");
3263 menu_entry_init(topmenu, "HELP_NATIONS");
3264 menu_entry_init(topmenu, "HELP_CONNECTING");
3265 menu_entry_init(topmenu, "HELP_CONTROLS");
3266 menu_entry_init(topmenu, "HELP_GOVERNOR");
3267 menu_entry_init(topmenu, "HELP_CHATLINE");
3268 menu_entry_init(topmenu, "HELP_WORKLIST_EDITOR");
3269 menu_entry_init(topmenu, "HELP_LANGUAGES");
3270 menu_entry_init(topmenu, "HELP_COPYING");
3271 menu_entry_init(topmenu, "HELP_ABOUT");
3272
3273 submenu_append_unref(menubar, _("_Help"), G_MENU_MODEL(topmenu));
3274
3275 menus_built = TRUE;
3276
3277 real_menus_update();
3278
3279 return menubar;
3280}
3281
3282/************************************************************************/
3285 static struct menu_entry_info *menu_entry_info_find(const char *key)
3286{
3287 int i;
3288
3289 for (i = 0; menu_entries[i].key != NULL; i++) {
3290 if (!strcmp(key, menu_entries[i].key)) {
3291 return &(menu_entries[i]);
3292 }
3293 }
3294
3295 return NULL;
3296}
3297
3298/************************************************************************/
3301 static void menu_entry_set_sensitive_info(GActionMap *map,
3302 struct menu_entry_info *info,
3303 gboolean is_enabled)
3304{
3305 GAction *act = g_action_map_lookup_action(map, info->action);
3306
3307 if (act != NULL) {
3308 g_simple_action_set_enabled(G_SIMPLE_ACTION(act), is_enabled);
3309 }
3310}
3311
3312/************************************************************************/
3315 static void menu_entry_set_sensitive(GActionMap *map,
3316 const char *key,
3317 gboolean is_enabled)
3318{
3319 struct menu_entry_info *info = menu_entry_info_find(key);
3320
3321 if (info != NULL) {
3322 menu_entry_set_sensitive_info(map, info, is_enabled);
3323 }
3324}
3325
3326/************************************************************************/
3329 static void menu_entry_group_set_sensitive(GActionMap *map,
3330 enum menu_entry_grouping group,
3331 gboolean is_enabled)
3332{
3333 int i;
3334
3335 for (i = 0; menu_entries[i].key != NULL; i++) {
3336 if (menu_entries[i].grouping == group || group == MGROUP_ALL) {
3337 menu_entry_set_sensitive_info(map, &(menu_entries[i]), is_enabled);
3338 }
3339 }
3340}
3341
3342/************************************************************************/
3345 static void menus_rename(GMenu *parent, int index, const char *key,
3346 const char *new_name)
3347{
3348 struct menu_entry_info *info = menu_entry_info_find(key);
3349
3350 if (info != NULL) {
3351 char actname[150];
3352 GMenuItem *item;
3353
3354 fc_snprintf(actname, sizeof(actname), "app.%s", info->action);
3355 g_menu_remove(parent, index);
3356
3357 item = g_menu_item_new(new_name, actname);
3358 menu_item_insert_unref(parent, index, item);
3359 }
3360}
3361
3362/************************************************************************/
3365 static void view_menu_update_sensitivity(GActionMap *map)
3366{
3367 /* The "full" city bar (i.e. the new way of drawing the
3368 * city name), can draw the city growth even without drawing
3369 * the city name. But the old method cannot. */
3370 if (gui_options.draw_full_citybar) {
3371 menu_entry_set_sensitive(map, "SHOW_CITY_GROWTH", TRUE);
3372 menu_entry_set_sensitive(map, "SHOW_CITY_TRADE_ROUTES", TRUE);
3373 } else {
3374 menu_entry_set_sensitive(map, "SHOW_CITY_GROWTH", gui_options.draw_city_names);
3375 menu_entry_set_sensitive(map, "SHOW_CITY_TRADE_ROUTES",
3376 gui_options.draw_city_names);
3377 }
3378
3379 menu_entry_set_sensitive(map, "SHOW_CITY_BUY_COST",
3380 gui_options.draw_city_productions);
3381 menu_entry_set_sensitive(map, "SHOW_COASTLINE", !gui_options.draw_terrain);
3382 menu_entry_set_sensitive(map, "SHOW_UNIT_SOLID_BG",
3383 gui_options.draw_units || gui_options.draw_focus_unit);
3384 menu_entry_set_sensitive(map, "SHOW_UNIT_SHIELDS",
3385 gui_options.draw_units || gui_options.draw_focus_unit);
3386 menu_entry_set_sensitive(map, "SHOW_FOCUS_UNIT", !gui_options.draw_units);
3387}
3388
3389/************************************************************************/
3395 static const char *get_tile_change_menu_text(struct tile *ptile,
3396 enum unit_activity activity)
3397{
3398 struct tile *newtile = tile_virtual_new(ptile);
3399 const char *text;
3400
3401 tile_apply_activity(newtile, activity, NULL);
3402 text = tile_get_info_text(newtile, FALSE, 0);
3403 tile_virtual_destroy(newtile);
3404
3405 return text;
3406}
3407
3408/************************************************************************/
3411 void real_menus_update(void)
3412{
3413 GtkApplication *fc_app = gui_app();
3414 GActionMap *map = G_ACTION_MAP(fc_app);
3415 GMenu *submenu;
3416 int i, j;
3417 int tgt_kind_group;
3418 struct unit_list *punits;
3419 unsigned num_units;
3420 struct menu_entry_info *info;
3421 struct road_type *proad;
3422 struct extra_type_list *extras;
3423 bool conn_possible;
3424
3425 if (!menus_built || client_state() == C_S_DISCONNECTED) {
3426 return;
3427 }
3428
3429 punits = get_units_in_focus();
3430
3431 submenu = g_menu_new();
3432
3433 i = 0;
3434 j = 0;
3435
3436 /* Add the new action entries grouped by target kind. */
3437 for (tgt_kind_group = 0; tgt_kind_group < ATK_COUNT; tgt_kind_group++) {
3438 action_noninternal_iterate(act_id) {
3439 struct action *paction = action_by_number(act_id);
3440 GSimpleAction *act;
3441 char actname[256];
3442 char name[256];
3443
3444 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
3445 /* This action isn't performed by a unit. */
3446 continue;
3447 }
3448
3449 if (action_id_get_target_kind(act_id) != tgt_kind_group) {
3450 /* Wrong group. */
3451 continue;
3452 }
3453
3454 if (!units_can_do_action(punits, act_id, TRUE)) {
3455 continue;
3456 }
3457
3458 /* Create and add the menu item. */
3459 fc_snprintf(actname, sizeof(actname), "action_%d", i);
3460 act = g_simple_action_new(actname, NULL);
3461 g_action_map_add_action(map, G_ACTION(act));
3462
3463 fc_snprintf(name, sizeof(name), "%s",
3464 action_get_ui_name_mnemonic(act_id, "_"));
3465 fc_snprintf(actname, sizeof(actname), "app.action_%d", i++);
3466
3467 if (action_id_has_complex_target(act_id)) {
3468 GMenu *sub_target_menu = g_menu_new();
3469 char subname[256];
3470
3471#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_) \
3472{ \
3473 fc_snprintf(actname, sizeof(actname), "subtgt_%d", j); \
3474 act = g_simple_action_new(actname, NULL); \
3475 g_action_map_add_action(map, G_ACTION(act)); \
3476 g_object_set_data(G_OBJECT(act), _sub_target_key_, _sub_target_); \
3477 g_signal_connect(act, "activate", G_CALLBACK(unit_goto_and_callback), \
3478 paction); \
3479 fc_snprintf(subname, sizeof(subname), "%s", _sub_target_name_); \
3480 fc_snprintf(actname, sizeof(actname), "app.subtgt_%d", j++); \
3481 menu_item_append_unref(sub_target_menu, \
3482 g_menu_item_new(subname, actname)); \
3483}
3484
3485 switch (action_get_sub_target_kind(paction)) {
3486 case ASTK_BUILDING:
3487 improvement_iterate(pimpr) {
3488 CREATE_SUB_ITEM(pimpr, "end_building",
3489 improvement_name_translation(pimpr));
3490 } improvement_iterate_end;
3491 break;
3492 case ASTK_TECH:
3493 advance_iterate(ptech) {
3494 CREATE_SUB_ITEM(ptech, "end_tech",
3495 advance_name_translation(ptech));
3496 } advance_iterate_end;
3497 break;
3498 case ASTK_EXTRA:
3499 case ASTK_EXTRA_NOT_THERE:
3500 extra_type_iterate(pextra) {
3501 if (!actres_creates_extra(paction->result, pextra)
3502 && !actres_removes_extra(paction->result, pextra)) {
3503 /* Not relevant */
3504 continue;
3505 }
3506 CREATE_SUB_ITEM(pextra, "end_extra",
3507 extra_name_translation(pextra));
3508 } extra_type_iterate_end;
3509 break;
3510 case ASTK_NONE:
3511 /* Should not be here. */
3512 fc_assert(action_get_sub_target_kind(paction) != ASTK_NONE);
3513 break;
3514 case ASTK_COUNT:
3515 /* Should not exits */
3516 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
3517 break;
3518 }
3519
3520#undef CREATE_SUB_ITEM
3521
3522 submenu_append_unref(submenu, name, G_MENU_MODEL(sub_target_menu));
3523 } else {
3524 g_signal_connect(act, "activate",
3525 G_CALLBACK(unit_goto_and_callback), paction);
3526 menu_item_append_unref(submenu, g_menu_item_new(name, actname));
3527 }
3528 } action_noninternal_iterate_end;
3529 }
3530 g_menu_remove(unit_menu, 1);
3531 g_menu_insert_submenu(unit_menu, 1, _("Go to a_nd..."), G_MENU_MODEL(submenu));
3532
3533 submenu = g_menu_new();
3534
3535 if (untargeted_revolution_allowed()) {
3536 menu_entry_init(submenu, "START_REVOLUTION");
3537 }
3538
3539 i = 0;
3540 governments_iterate(g) {
3541 if (g != game.government_during_revolution) {
3542 char name[256];
3543 char actname[256];
3544 GSimpleAction *act;
3545
3546 fc_snprintf(actname, sizeof(actname), "government_%d", i);
3547 act = g_simple_action_new(actname, NULL);
3548 g_simple_action_set_enabled(act, can_change_to_government(client_player(), g));
3549 g_action_map_add_action(map, G_ACTION(act));
3550 g_signal_connect(act, "activate", G_CALLBACK(government_callback), g);
3551
3552 /* TRANS: %s is a government name */
3553 fc_snprintf(name, sizeof(name), _("%s..."),
3554 government_name_translation(g));
3555 fc_snprintf(actname, sizeof(actname), "app.government_%d", i++);
3556 menu_item_append_unref(submenu, g_menu_item_new(name, actname));
3557 }
3558 } governments_iterate_end;
3559 g_menu_remove(gov_menu, 8);
3560 g_menu_insert_submenu(gov_menu, 8, _("_Government"), G_MENU_MODEL(submenu));
3561
3562 submenu = g_menu_new();
3563
3564 extra_type_by_cause_iterate(EC_ROAD, pextra) {
3565 if (pextra->buildable) {
3566 char actname[256];
3567 GSimpleAction *act;
3568
3569 fc_snprintf(actname, sizeof(actname), "path_%d", i);
3570 act = g_simple_action_new(actname, NULL);
3571 g_simple_action_set_enabled(act,
3572 can_units_do_activity_targeted_client(punits,
3573 ACTIVITY_GEN_ROAD,
3574 pextra));
3575 g_action_map_add_action(map, G_ACTION(act));
3576 g_signal_connect(act, "activate", G_CALLBACK(road_callback), pextra);
3577
3578 fc_snprintf(actname, sizeof(actname), "app.path_%d", i++);
3579 menu_item_append_unref(submenu,
3580 g_menu_item_new(extra_name_translation(pextra), actname));
3581 }
3582 } extra_type_by_cause_iterate_end;
3583
3584 g_menu_remove(work_menu, 2);
3585 g_menu_insert_submenu(work_menu, 2, _("Build _Path"), G_MENU_MODEL(submenu));
3586
3587 submenu = g_menu_new();
3588
3589 extra_type_by_cause_iterate(EC_IRRIGATION, pextra) {
3590 if (pextra->buildable) {
3591 char actname[256];
3592 GSimpleAction *act;
3593
3594 fc_snprintf(actname, sizeof(actname), "irrig_%d", i);
3595 act = g_simple_action_new(actname, NULL);
3596 g_simple_action_set_enabled(act,
3597 can_units_do_activity_targeted_client(punits,
3598 ACTIVITY_IRRIGATE,
3599 pextra));
3600 g_action_map_add_action(map, G_ACTION(act));
3601 g_signal_connect(act, "activate", G_CALLBACK(irrigation_callback), pextra);
3602
3603 fc_snprintf(actname, sizeof(actname), "app.irrig_%d", i++);
3604 menu_item_append_unref(submenu,
3605 g_menu_item_new(extra_name_translation(pextra), actname));
3606 }
3607 } extra_type_by_cause_iterate_end;
3608
3609 g_menu_remove(work_menu, 3);
3610 g_menu_insert_submenu(work_menu, 3, _("Build _Irrigation"), G_MENU_MODEL(submenu));
3611
3612 submenu = g_menu_new();
3613
3614 extra_type_by_cause_iterate(EC_MINE, pextra) {
3615 if (pextra->buildable) {
3616 char actname[256];
3617 GSimpleAction *act;
3618
3619 fc_snprintf(actname, sizeof(actname), "mine_%d", i);
3620 act = g_simple_action_new(actname, NULL);
3621 g_simple_action_set_enabled(act,
3622 can_units_do_activity_targeted_client(punits,
3623 ACTIVITY_MINE,
3624 pextra));
3625 g_action_map_add_action(map, G_ACTION(act));
3626 g_signal_connect(act, "activate", G_CALLBACK(mine_callback), pextra);
3627
3628 fc_snprintf(actname, sizeof(actname), "app.mine_%d", i++);
3629 menu_item_append_unref(submenu,
3630 g_menu_item_new(extra_name_translation(pextra), actname));
3631 }
3632 } extra_type_by_cause_iterate_end;
3633
3634 g_menu_remove(work_menu, 4);
3635 g_menu_insert_submenu(work_menu, 4, _("Build _Mine"), G_MENU_MODEL(submenu));
3636
3637 submenu = g_menu_new();
3638
3639 extra_type_by_rmcause_iterate(ERM_CLEAN, pextra) {
3640 char actname[256];
3641 GSimpleAction *act;
3642
3643 fc_snprintf(actname, sizeof(actname), "clean_%d", i);
3644 act = g_simple_action_new(actname, NULL);
3645 g_simple_action_set_enabled(act,
3646 can_units_do_activity_targeted_client(punits,
3647 ACTIVITY_CLEAN,
3648 pextra));
3649 g_action_map_add_action(map, G_ACTION(act));
3650 g_signal_connect(act, "activate", G_CALLBACK(clean_menu_callback), pextra);
3651
3652 fc_snprintf(actname, sizeof(actname), "app.clean_%d", i++);
3653 menu_item_append_unref(submenu,
3654 g_menu_item_new(extra_name_translation(pextra), actname));
3655 } extra_type_by_rmcause_iterate_end;
3656
3657 g_menu_remove(work_menu, 5);
3658 g_menu_insert_submenu(work_menu, 5, _("_Clean Nuisance"),
3659 G_MENU_MODEL(submenu));
3660
3661 submenu = g_menu_new();
3662
3663 extra_type_by_cause_iterate(EC_BASE, pextra) {
3664 if (pextra->buildable) {
3665 char actname[256];
3666 GSimpleAction *act;
3667
3668 fc_snprintf(actname, sizeof(actname), "base_%d", i);
3669 act = g_simple_action_new(actname, NULL);
3670 g_simple_action_set_enabled(act,
3671 can_units_do_activity_targeted_client(punits,
3672 ACTIVITY_BASE,
3673 pextra));
3674 g_action_map_add_action(map, G_ACTION(act));
3675 g_signal_connect(act, "activate", G_CALLBACK(base_callback), pextra);
3676
3677 fc_snprintf(actname, sizeof(actname), "app.base_%d", i++);
3678 menu_item_append_unref(submenu,
3679 g_menu_item_new(extra_name_translation(pextra), actname));
3680 }
3681 } extra_type_by_cause_iterate_end;
3682
3683 g_menu_remove(combat_menu, 3);
3684 g_menu_insert_submenu(combat_menu, 3, _("Build _Base"), G_MENU_MODEL(submenu));
3685
3686 bool units_all_same_tile = TRUE, units_all_same_type = TRUE;
3687 char acttext[128], irrtext[128], mintext[128], transtext[128];
3688 char cultext[128], plantext[128];
3689 struct terrain *pterrain;
3690
3691 if (!can_client_change_view()) {
3692 return;
3693 }
3694
3695 num_units = get_num_units_in_focus();
3696
3697 if (num_units > 0) {
3698 const struct tile *ptile = NULL;
3699 const struct unit_type *ptype = NULL;
3700
3701 unit_list_iterate(punits, punit) {
3702 fc_assert((ptile == NULL) == (ptype == NULL));
3703
3704 if (ptile || ptype) {
3705 if (unit_tile(punit) != ptile) {
3706 units_all_same_tile = FALSE;
3707 }
3708 if (unit_type_get(punit) != ptype) {
3709 units_all_same_type = FALSE;
3710 }
3711 } else {
3712 ptile = unit_tile(punit);
3713 ptype = unit_type_get(punit);
3714 }
3715 } unit_list_iterate_end;
3716 }
3717
3718 menu_entry_group_set_sensitive(map, MGROUP_EDIT, editor_is_active());
3719 menu_entry_group_set_sensitive(map, MGROUP_PLAYING,
3720 can_client_issue_orders() && !editor_is_active());
3721 menu_entry_group_set_sensitive(map, MGROUP_UNIT,
3722 num_units > 0
3723 && can_client_issue_orders()
3724 && !editor_is_active());
3725
3726 menu_entry_set_sensitive(map, "GAME_SAVE_AS",
3727 can_client_access_hack() && C_S_RUNNING <= client_state());
3728 menu_entry_set_sensitive(map, "GAME_SAVE",
3729 can_client_access_hack() && C_S_RUNNING <= client_state());
3730
3731 menu_entry_set_sensitive(map, "SERVER_OPTIONS", client.conn.established);
3732
3733 menu_entry_set_sensitive(map, "LEAVE",
3734 client.conn.established);
3735
3736 menu_entry_set_sensitive(map, "RALLY_DLG", can_client_issue_orders());
3737 menu_entry_set_sensitive(map, "INFRA_DLG", terrain_control.infrapoints);
3738
3739 menu_entry_set_sensitive(map, "POLICIES", multiplier_count() > 0);
3740 menu_entry_set_sensitive(map, "REPORT_TOP_CITIES", game.info.top_cities_count > 0);
3741
3742 info = menu_entry_info_find("EDIT_MODE");
3743 if (info->state != game.info.is_edit_mode) {
3744 info->state = game.info.is_edit_mode;
3745 g_menu_remove(edit_menu, 4);
3746 menu_item_insert_unref(edit_menu, 4,
3747 create_toggle_menu_item(info));
3748
3749 menu_entry_set_sensitive(map, "EDIT_MODE",
3750 can_conn_enable_editing(&client.conn));
3751 editgui_refresh();
3752 }
3753
3754 {
3755 char road_buf[500];
3756
3757 proad = road_by_gui_type(ROAD_GUI_ROAD);
3758 if (proad != NULL) {
3759 /* TRANS: Connect with some road type (Road/Railroad) */
3760 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3761 extra_name_translation(road_extra_get(proad)));
3762 menus_rename(work_menu, 12, "CONNECT_ROAD", road_buf);
3763 }
3764
3765 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3766 if (proad != NULL) {
3767 snprintf(road_buf, sizeof(road_buf), _("Connect With %s"),
3768 extra_name_translation(road_extra_get(proad)));
3769 menus_rename(work_menu, 13, "CONNECT_RAIL", road_buf);
3770 }
3771 }
3772
3773 if (!can_client_issue_orders()) {
3774 return;
3775 }
3776
3777 if (!punits) {
3778 return;
3779 }
3780
3781 /* Remaining part of this function: Update Unit, Work, and Combat menus */
3782
3783 /* Enable the button for adding to a city in all cases, so we
3784 * get an eventual error message from the server if we try. */
3785 menu_entry_set_sensitive(map, "BUILD_CITY",
3786 (can_units_do(punits, unit_can_add_or_build_city)
3787 || can_units_do(punits, unit_can_help_build_wonder_here)));
3788
3789 menu_entry_set_sensitive(map, "DO_ACTION",
3790 units_can_do_action(punits, ACTION_ANY, TRUE));
3791
3792 menu_entry_set_sensitive(map, "UNIT_TELEPORT",
3793 can_units_do_on_map(&(wld.map), punits, can_unit_teleport));
3794
3795 menu_entry_set_sensitive(map, "BUILD_ROAD",
3796 (can_units_do_any_road(&(wld.map), punits)
3797 || can_units_do(punits,
3798 unit_can_est_trade_route_here)));
3799 menu_entry_set_sensitive(map, "BUILD_IRRIGATION",
3800 can_units_do_activity_client(punits, ACTIVITY_IRRIGATE));
3801 menu_entry_set_sensitive(map, "BUILD_MINE",
3802 can_units_do_activity_client(punits, ACTIVITY_MINE));
3803 menu_entry_set_sensitive(map, "CULTIVATE",
3804 can_units_do_activity_client(punits, ACTIVITY_CULTIVATE));
3805 menu_entry_set_sensitive(map, "PLANT",
3806 can_units_do_activity_client(punits, ACTIVITY_PLANT));
3807 menu_entry_set_sensitive(map, "TRANSFORM_TERRAIN",
3808 can_units_do_activity_client(punits, ACTIVITY_TRANSFORM));
3809 menu_entry_set_sensitive(map, "FORTIFY",
3810 can_units_do_activity_client(punits,
3811 ACTIVITY_FORTIFYING));
3812 menu_entry_set_sensitive(map, "PARADROP",
3813 can_units_do_on_map(&(wld.map), punits, can_unit_paradrop));
3814 menu_entry_set_sensitive(map, "PILLAGE",
3815 can_units_do_activity_client(punits, ACTIVITY_PILLAGE));
3816 menu_entry_set_sensitive(map, "CLEAN",
3817 can_units_do_activity_client(punits, ACTIVITY_CLEAN));
3818 menu_entry_set_sensitive(map, "BUILD_FORTRESS",
3819 can_units_do_base_gui(punits, BASE_GUI_FORTRESS));
3820 menu_entry_set_sensitive(map, "BUILD_AIRBASE",
3821 can_units_do_base_gui(punits, BASE_GUI_AIRBASE));
3822 menu_entry_set_sensitive(map, "UNIT_SENTRY",
3823 can_units_do_activity_client(punits, ACTIVITY_SENTRY));
3824 menu_entry_set_sensitive(map, "UNSENTRY_ALL",
3825 units_have_activity_on_tile(punits,
3826 ACTIVITY_SENTRY));
3827 menu_entry_set_sensitive(map, "UNIT_HOMECITY",
3828 can_units_do(punits, can_unit_change_homecity));
3829 menu_entry_set_sensitive(map, "UNIT_UPGRADE", units_can_upgrade(&(wld.map), punits));
3830 menu_entry_set_sensitive(map, "UNIT_CONVERT", units_can_convert(&(wld.map), punits));
3831 menu_entry_set_sensitive(map, "UNIT_DISBAND",
3832 units_can_do_action(punits, ACTION_DISBAND_UNIT,
3833 TRUE));
3834
3835 menu_entry_set_sensitive(map, "AUTO_WORKER",
3836 can_units_do(punits, can_unit_do_autoworker));
3837 menu_entry_set_sensitive(map, "UNIT_EXPLORE",
3838 can_units_do_activity_client(punits, ACTIVITY_EXPLORE));
3839 menu_entry_set_sensitive(map, "UNIT_BOARD",
3840 units_can_load(punits));
3841 menu_entry_set_sensitive(map, "UNIT_DEBOARD",
3842 units_can_unload(&(wld.map), punits));
3843 menu_entry_set_sensitive(map, "UNIT_UNLOAD_TRANSPORTER",
3844 units_are_occupied(punits));
3845
3846 proad = road_by_gui_type(ROAD_GUI_ROAD);
3847 if (proad != NULL) {
3848 struct extra_type *tgt;
3849
3850 tgt = road_extra_get(proad);
3851
3852 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3853 } else {
3854 conn_possible = FALSE;
3855 }
3856 menu_entry_set_sensitive(map, "CONNECT_ROAD", conn_possible);
3857
3858 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
3859 if (proad != NULL) {
3860 struct extra_type *tgt;
3861
3862 tgt = road_extra_get(proad);
3863
3864 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3865 } else {
3866 conn_possible = FALSE;
3867 }
3868 menu_entry_set_sensitive(map, "CONNECT_RAIL", conn_possible);
3869
3870 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
3871 if (proad != NULL) {
3872 struct extra_type *tgt;
3873
3874 tgt = road_extra_get(proad);
3875
3876 conn_possible = can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt);
3877 } else {
3878 conn_possible = FALSE;
3879 }
3880 menu_entry_set_sensitive(map, "CONNECT_MAGLEV", conn_possible);
3881
3882 extras = extra_type_list_by_cause(EC_IRRIGATION);
3883
3884 if (extra_type_list_size(extras) > 0) {
3885 struct extra_type *tgt;
3886
3887 tgt = extra_type_list_get(extras, 0);
3888 conn_possible = can_units_do_connect(punits, ACTIVITY_IRRIGATE, tgt);
3889 } else {
3890 conn_possible = FALSE;
3891 }
3892 menu_entry_set_sensitive(map, "CONNECT_IRRIGATION", conn_possible);
3893
3894 menu_entry_set_sensitive(map, "TAX_RATES",
3895 game.info.changable_tax
3896 && can_client_issue_orders());
3897
3898 if (units_can_do_action(punits, ACTION_HELP_WONDER, TRUE)) {
3899 menus_rename(work_menu, 0, "BUILD_CITY",
3900 action_get_ui_name_mnemonic(ACTION_HELP_WONDER, "_"));
3901 } else {
3902 bool city_on_tile = FALSE;
3903
3904 /* FIXME: This overloading doesn't work well with multiple focus
3905 * units. */
3906 unit_list_iterate(punits, punit) {
3907 if (tile_city(unit_tile(punit))) {
3908 city_on_tile = TRUE;
3909 break;
3910 }
3911 } unit_list_iterate_end;
3912
3913 if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
3914 TRUE)) {
3915 menus_rename(work_menu, 0, "BUILD_CITY",
3916 action_get_ui_name_mnemonic(ACTION_JOIN_CITY, "_"));
3917 } else {
3918 /* Refresh default order */
3919 menus_rename(work_menu, 0, "BUILD_CITY",
3920 action_get_ui_name_mnemonic(ACTION_FOUND_CITY, "_"));
3921 }
3922 }
3923
3924 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
3925 menus_rename(work_menu, 6, "BUILD_ROAD",
3926 action_get_ui_name_mnemonic(ACTION_TRADE_ROUTE, "_"));
3927 } else if (units_have_type_flag(punits, UTYF_WORKERS, TRUE)) {
3928 char road_item[500];
3929 struct extra_type *pextra = NULL;
3930
3931 /* FIXME: This overloading doesn't work well with multiple focus
3932 * units. */
3933 unit_list_iterate(punits, punit) {
3934 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
3935 unit_owner(punit), punit);
3936 if (pextra != NULL) {
3937 break;
3938 }
3939 } unit_list_iterate_end;
3940
3941 if (pextra != NULL) {
3942 /* TRANS: Build road of specific type (Road/Railroad) */
3943 snprintf(road_item, sizeof(road_item), _("Build %s"),
3944 extra_name_translation(pextra));
3945 menus_rename(work_menu, 6, "BUILD_ROAD", road_item);
3946 }
3947 } else {
3948 menus_rename(work_menu, 6, "BUILD_ROAD", _("Build _Road"));
3949 }
3950
3951 if (units_all_same_type && num_units > 0) {
3952 struct unit *punit = unit_list_get(punits, 0);
3953 const struct unit_type *to_unittype
3954 = can_upgrade_unittype(client_player(), unit_type_get(punit));
3955
3956 if (to_unittype) {
3957 /* TRANS: %s is a unit type. */
3958 fc_snprintf(acttext, sizeof(acttext), _("Upgr_ade to %s"),
3959 utype_name_translation(
3960 can_upgrade_unittype(client_player(),
3961 unit_type_get(punit))));
3962 } else {
3963 acttext[0] = '\0';
3964 }
3965 } else {
3966 acttext[0] = '\0';
3967 }
3968 if ('\0' != acttext[0]) {
3969 menus_rename(unit_menu, 13, "UNIT_UPGRADE", acttext);
3970 } else {
3971 menus_rename(unit_menu, 13, "UNIT_UPGRADE", _("Upgr_ade"));
3972 }
3973
3974 if (units_can_convert(&(wld.map), punits)) {
3975 if (units_all_same_type && num_units > 0) {
3976 struct unit *punit = unit_list_get(punits, 0);
3977
3978 /* TRANS: %s is a unit type. */
3979 fc_snprintf(acttext, sizeof(acttext), _("C_onvert to %s"),
3980 utype_name_translation(unit_type_get(punit)->converted_to));
3981 } else {
3982 acttext[0] = '\0';
3983 }
3984 } else {
3985 menu_entry_set_sensitive(map, "UNIT_CONVERT", FALSE);
3986 acttext[0] = '\0';
3987 }
3988 if ('\0' != acttext[0]) {
3989 menus_rename(unit_menu, 14, "UNIT_CONVERT", acttext);
3990 } else {
3991 menus_rename(unit_menu, 14, "UNIT_CONVERT", _("C_onvert"));
3992 }
3993
3994 if (units_all_same_tile && num_units > 0) {
3995 struct unit *first = unit_list_get(punits, 0);
3996
3997 pterrain = tile_terrain(unit_tile(first));
3998
3999 if (units_have_type_flag(punits, UTYF_WORKERS, TRUE)) {
4000 struct extra_type *pextra = NULL;
4001
4002 /* FIXME: this overloading doesn't work well with multiple focus
4003 * units. */
4004 unit_list_iterate(punits, punit) {
4005 pextra = next_extra_for_tile(unit_tile(punit), EC_IRRIGATION,
4006 unit_owner(punit), punit);
4007 if (pextra != NULL) {
4008 break;
4009 }
4010 } unit_list_iterate_end;
4011
4012 if (pextra != NULL) {
4013 /* TRANS: Build irrigation of specific type */
4014 snprintf(irrtext, sizeof(irrtext), _("Build %s"),
4015 extra_name_translation(pextra));
4016 } else {
4017 sz_strlcpy(irrtext, _("Build _Irrigation"));
4018 }
4019 } else {
4020 sz_strlcpy(irrtext, _("Build _Irrigation"));
4021 }
4022
4023 if (pterrain->cultivate_result != T_NONE) {
4024 fc_snprintf(cultext, sizeof(cultext), _("Change to %s"),
4025 get_tile_change_menu_text(unit_tile(first),
4026 ACTIVITY_CULTIVATE));
4027 } else {
4028 sz_strlcpy(cultext, _("_Cultivate"));
4029 }
4030
4031 if (units_have_type_flag(punits, UTYF_WORKERS, TRUE)) {
4032 struct extra_type *pextra = NULL;
4033
4034 /* FIXME: this overloading doesn't work well with multiple focus
4035 * units. */
4036 unit_list_iterate(punits, punit) {
4037 pextra = next_extra_for_tile(unit_tile(punit), EC_MINE,
4038 unit_owner(punit), punit);
4039 if (pextra != NULL) {
4040 break;
4041 }
4042 } unit_list_iterate_end;
4043
4044 if (pextra != NULL) {
4045 /* TRANS: Build mine of specific type */
4046 snprintf(mintext, sizeof(mintext), _("Build %s"),
4047 extra_name_translation(pextra));
4048 } else {
4049 sz_strlcpy(mintext, _("Build _Mine"));
4050 }
4051 } else {
4052 sz_strlcpy(mintext, _("Build _Mine"));
4053 }
4054
4055 if (pterrain->plant_result != T_NONE) {
4056 fc_snprintf(plantext, sizeof(plantext), _("Change to %s"),
4057 get_tile_change_menu_text(unit_tile(first), ACTIVITY_PLANT));
4058 } else {
4059 sz_strlcpy(plantext, _("_Plant"));
4060 }
4061
4062 if (pterrain->transform_result != T_NONE
4063 && pterrain->transform_result != pterrain) {
4064 fc_snprintf(transtext, sizeof(transtext), _("Transf_orm to %s"),
4065 get_tile_change_menu_text(unit_tile(first),
4066 ACTIVITY_TRANSFORM));
4067 } else {
4068 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4069 }
4070 } else {
4071 sz_strlcpy(irrtext, _("Build _Irrigation"));
4072 sz_strlcpy(cultext, _("_Cultivate"));
4073 sz_strlcpy(mintext, _("Build _Mine"));
4074 sz_strlcpy(plantext, _("_Plant"));
4075 sz_strlcpy(transtext, _("Transf_orm Terrain"));
4076 }
4077
4078 menus_rename(work_menu, 7, "BUILD_IRRIGATION", irrtext);
4079 menus_rename(work_menu, 9, "CULTIVATE", cultext);
4080 menus_rename(work_menu, 8, "BUILD_MINE", mintext);
4081 menus_rename(work_menu, 10, "PLANT", plantext);
4082 menus_rename(work_menu, 11, "TRANSFORM_TERRAIN", transtext);
4083
4084 menus_rename(unit_menu, 12, "UNIT_HOMECITY",
4085 action_get_ui_name_mnemonic(ACTION_HOME_CITY, "_"));
4086
4087 menus_rename(combat_menu, 1, "BUILD_FORTRESS",
4088 Q_(terrain_control.gui_type_base0));
4089 menus_rename(combat_menu, 2, "BUILD_AIRBASE",
4090 Q_(terrain_control.gui_type_base1));
4091}
4092
4093/************************************************************************/
4097 void real_menus_init(void)
4098{
4099 if (!menus_built) {
4100 return;
4101 }
4102
4103#ifdef MENUS_GTK3
4104
4105 if (!can_client_change_view()) {
4106 menu_entry_group_set_sensitive(MGROUP_ALL, FALSE);
4107
4108 return;
4109 }
4110
4111 menu_entry_group_set_sensitive(MGROUP_SAFE, TRUE);
4112 menu_entry_group_set_sensitive(MGROUP_PLAYER, client_has_player());
4113
4114 menu_entry_set_sensitive("SHOW_NATIONAL_BORDERS",
4115 BORDERS_DISABLED != game.info.borders);
4116
4117 view_menu_update_sensitivity();
4118#endif /* MENUS_GTK3 */
4119}
4120
4121/**********************************************************************/
4124 void enable_menus(bool enable)
4125{
4126 GtkApplication *fc_app = gui_app();
4127
4128 if (enable) {
4129 if (main_menubar == NULL) {
4130 setup_app_actions(G_APPLICATION(fc_app));
4131 main_menubar = setup_menus(fc_app);
4132 /* Ensure the menus are really created before performing any operations
4133 * on them. */
4134 while (g_main_context_pending(NULL)) {
4135 g_main_context_iteration(NULL, FALSE);
4136 }
4137 }
4138
4139 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), TRUE);
4140 gtk_application_set_menubar(fc_app, G_MENU_MODEL(main_menubar));
4141
4142 } else {
4143 gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(toplevel), FALSE);
4144 gtk_application_set_menubar(fc_app, NULL);
4145 }
4146
4147 /* Workaround for gtk bug that (re)setting the menubar after the window has
4148 * been already created is not noticed. */
4149 g_object_notify(G_OBJECT(gtk_settings_get_default()), "gtk-shell-shows-menubar");
4150}
4151
4152/**********************************************************************/
4155 void menus_disable_unit_commands(void)
4156{
4157 menu_entry_group_set_sensitive(G_ACTION_MAP(gui_app()), MGROUP_UNIT, FALSE);
4158}
action_get_sub_target_kind
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1084
action_get_ui_name_mnemonic
const char * action_get_ui_name_mnemonic(action_id act_id, const char *mnemonic)
Definition actions.c:1223
action_noninternal_iterate_end
#define action_noninternal_iterate_end
Definition actions.h:231
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:390
action_id_get_actor_kind
#define action_id_get_actor_kind(act_id)
Definition actions.h:403
ACTION_ANY
#define ACTION_ANY
Definition actions.h:52
action_noninternal_iterate
#define action_noninternal_iterate(_act_)
Definition actions.h:226
action_id_get_target_kind
#define action_id_get_target_kind(act_id)
Definition actions.h:407
action_id_has_complex_target
#define action_id_has_complex_target(act_id)
Definition actions.h:425
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:1231
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_WONDERS_OF_THE_WORLD_LONG
@ REPORT_WONDERS_OF_THE_WORLD_LONG
Definition conn_types.h:51
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_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_auto_work
void key_unit_auto_work(void)
Definition control.c:3561
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:358
BORDERS_DISABLED
@ BORDERS_DISABLED
Definition fc_types.h:1047
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:929
clear_output_window
void clear_output_window(void)
Definition chatline.c:944
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:6251
editprop_get_property_editor
struct property_editor * editprop_get_property_editor(void)
Definition editprop.c:6204
property_editor_reload
void property_editor_reload(struct property_editor *pe, enum editor_object_type objtype)
Definition editprop.c:6341
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:1207
show_focus_unit_callback
static void show_focus_unit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1443
setup_menus
GtkWidget * setup_menus(GtkWidget *window)
Definition menu.c:2151
help_connecting_callback
static void help_connecting_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:857
menus_rename
static void menus_rename(const char *key, const gchar *new_label)
Definition menu.c:2285
help_combat_callback
static void help_combat_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1065
menu_entry_group_set_sensitive
static void menu_entry_group_set_sensitive(enum menu_entry_grouping group, gboolean is_sensitive)
Definition menu.c:2253
help_ruleset_callback
static void help_ruleset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1009
select_single_callback
static void select_single_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1513
unit_unload_transporter_callback
static void unit_unload_transporter_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1721
help_government_callback
static void help_government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1105
report_achievements_callback
static void report_achievements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:833
show_fog_of_war_callback
static void show_fog_of_war_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1454
help_zoc_callback
static void help_zoc_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1073
show_city_productions_callback
static void show_city_productions_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1264
client_lua_script_callback
static void client_lua_script_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:817
show_city_names_callback
static void show_city_names_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1241
help_space_race_callback
static void help_space_race_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1121
help_tileset_callback
static void help_tileset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1017
help_playing_callback
static void help_playing_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1001
plant_callback
static void plant_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1839
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:2001
help_economy_callback
static void help_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1033
unit_sentry_callback
static void unit_sentry_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1685
center_view_callback
static void center_view_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2041
unit_explore_callback
static void unit_explore_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1669
build_mine_callback
static void build_mine_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1831
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:1659
show_city_trade_routes_callback
static void show_city_trade_routes_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1287
transform_terrain_callback
static void transform_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1911
help_wonders_callback
static void help_wonders_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1097
show_terrain_callback
static void show_terrain_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1298
show_city_growth_callback
static void show_city_growth_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1253
show_stack_size_callback
static void show_stack_size_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1432
multiplier_callback
static void multiplier_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1985
help_terrain_callback
static void help_terrain_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1089
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:1410
show_coastline_callback
static void show_coastline_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1309
toggle_fog_callback
static void toggle_fog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1485
show_city_full_bar_callback
static void show_city_full_bar_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1229
edit_mode_callback
static void edit_mode_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1162
help_chatline_callback
static void help_chatline_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:873
show_paths_callback
static void show_paths_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1319
connect_road_callback
static void connect_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1847
help_overview_callback
static void help_overview_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:993
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:1113
show_units_callback
static void show_units_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1399
show_irrigation_callback
static void show_irrigation_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1329
show_map_grid_callback
static void show_map_grid_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1196
help_improvements_callback
static void help_improvements_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1049
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:825
help_worklist_editor_callback
static void help_worklist_editor_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:881
help_cities_callback
static void help_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1041
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:841
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:1537
unit_convert_callback
static void unit_convert_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1746
select_dialog_callback
static void select_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1553
show_huts_callback
static void show_huts_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1369
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:1738
help_tech_callback
static void help_tech_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1081
unit_goto_callback
static void unit_goto_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1593
clean_callback
static void clean_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2026
build_city_callback
static void build_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1762
unit_patrol_callback
static void unit_patrol_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1677
real_menus_init
void real_menus_init(void)
Definition menu.c:2910
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:1561
help_about_callback
static void help_about_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1145
build_road_callback
static void build_road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1789
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:1389
unit_homecity_callback
static void unit_homecity_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1730
menu_entry_set_sensitive
static void menu_entry_set_sensitive(const char *key, gboolean is_sensitive)
Definition menu.c:2240
show_pollution_callback
static void show_pollution_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1379
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:1879
full_screen_callback
static void full_screen_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1465
report_top_cities_callback
static void report_top_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:801
help_controls_callback
static void help_controls_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:865
select_same_type_callback
static void select_same_type_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1545
connect_rail_callback
static void connect_rail_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1863
unit_wait_callback
static void unit_wait_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1577
get_tile_change_menu_text
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2338
build_airbase_callback
static void build_airbase_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1945
report_cities_callback
static void report_cities_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2057
infra_dialog_callback
static void infra_dialog_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1569
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:1977
help_musicset_callback
static void help_musicset_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1025
unit_goto_city_callback
static void unit_goto_city_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1649
menu_entry_info_find
static struct menu_entry_info * menu_entry_info_find(const char *key)
Definition menu.c:2211
auto_work_callback
static void auto_work_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1781
government_callback
static void government_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1993
report_economy_callback
static void report_economy_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2065
report_messages_callback
static void report_messages_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:809
show_bases_callback
static void show_bases_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1349
select_same_type_tile_callback
static void select_same_type_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1529
save_options_on_exit_callback
static void save_options_on_exit_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1153
show_native_tiles_callback
static void show_native_tiles_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1218
menu_entry_init
static void menu_entry_init(GtkBuildable *item)
Definition menu.c:2091
show_unit_shields_callback
static void show_unit_shields_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1421
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:1493
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:1711
help_policies_callback
static void help_policies_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:849
unit_done_callback
static void unit_done_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1585
help_nations_callback
static void help_nations_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1129
unit_goto_and_callback
static void unit_goto_and_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1601
show_city_output_callback
static void show_city_output_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1185
show_city_outlines_callback
static void show_city_outlines_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1174
save_scenario_callback
static void save_scenario_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1505
help_copying_callback
static void help_copying_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1137
cultivate_callback
static void cultivate_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1823
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:2353
report_spaceship_callback
static void report_spaceship_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2081
select_all_on_tile_callback
static void select_all_on_tile_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1521
show_city_buy_cost_callback
static void show_city_buy_cost_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1276
build_fortress_callback
static void build_fortress_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1927
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:2306
unit_board_callback
static void unit_board_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1701
fortify_callback
static void fortify_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1935
show_resources_callback
static void show_resources_callback(GtkCheckMenuItem *item, gpointer data)
Definition menu.c:1359
connect_irrigation_callback
static void connect_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1895
build_irrigation_callback
static void build_irrigation_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1815
report_units_callback
static void report_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2049
road_callback
static void road_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2013
unit_disband_callback
static void unit_disband_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1754
help_units_callback
static void help_units_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:1057
report_research_callback
static void report_research_callback(GtkMenuItem *item, gpointer data)
Definition menu.c:2073
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
fc_app
static GtkApplication * fc_app
Definition gui_main.c:183
gui_app
GtkApplication * gui_app(void)
Definition gui_main.c:2681
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
help_governor_callback
static void help_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:1654
irrigation_callback
static void irrigation_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2744
bg_append_callback
static void bg_append_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2874
unsentry_all_callback
static void unsentry_all_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2345
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:2908
pillage_callback
static void pillage_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2657
enable_menus
void enable_menus(bool enable)
Definition menu.c:4120
setup_app_actions
static void setup_app_actions(GApplication *fc_app)
Definition menu.c:2959
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:2999
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:2705
view_menu
static GMenu * view_menu
Definition menu.c:85
work_menu
static GMenu * work_menu
Definition menu.c:88
bg_assign_callback
static void bg_assign_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2864
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:3297
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:1950
edit_menu
static GMenu * edit_menu
Definition menu.c:84
menus_disable_unit_commands
void menus_disable_unit_commands(void)
Definition menu.c:4151
unit_teleport_callback
static void unit_teleport_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2326
paradrop_callback
static void paradrop_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2647
meoms
const struct menu_entry_option_map meoms[]
Definition menu.c:1730
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:2667
bg_select_callback
static void bg_select_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2854
mine_callback
static void mine_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2759
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:2885
menus_set_initial_toggle_values
void menus_set_initial_toggle_values(void)
Definition menu.c:2941
clean_menu_callback
static void clean_menu_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition menu.c:2774
view_menu_item_toggle
static void view_menu_item_toggle(void(*cb)(void), bool updt_sensitivity, gpointer data)
Definition menu.c:1771
editgui.h
editprop.h
gamedlgs.h
gui_stuff.h
infradlg.h
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:68
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:4281
client_optset
const struct option_set * client_optset
Definition options.c:1315
options_save
void options_save(option_save_log_callback log_cb)
Definition options.c:6341
gui_options
struct client_options gui_options
Definition options.c:71
options.h
GUI_GTK_MSGCHAT_MERGED
@ GUI_GTK_MSGCHAT_MERGED
Definition options.h:69
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:106
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:216
client_options::draw_specials
bool draw_specials
Definition options.h:208
client_options::draw_city_output
bool draw_city_output
Definition options.h:195
client_options::draw_city_names
bool draw_city_names
Definition options.h:197
client_options::draw_city_productions
bool draw_city_productions
Definition options.h:199
client_options::draw_mines
bool draw_mines
Definition options.h:206
client_options::draw_borders
bool draw_borders
Definition options.h:215
client_options::draw_fortress_airbase
bool draw_fortress_airbase
Definition options.h:207
client_options::draw_city_buycost
bool draw_city_buycost
Definition options.h:200
client_options::draw_unit_stack_size
bool draw_unit_stack_size
Definition options.h:219
client_options::draw_irrigation
bool draw_irrigation
Definition options.h:205
client_options::draw_terrain
bool draw_terrain
Definition options.h:202
client_options::draw_units
bool draw_units
Definition options.h:212
client_options::draw_fog_of_war
bool draw_fog_of_war
Definition options.h:214
client_options::draw_city_trade_routes
bool draw_city_trade_routes
Definition options.h:201
client_options::draw_unit_shields
bool draw_unit_shields
Definition options.h:218
client_options::draw_cities
bool draw_cities
Definition options.h:211
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:196
client_options::draw_city_growth
bool draw_city_growth
Definition options.h:198
client_options::draw_huts
bool draw_huts
Definition options.h:209
client_options::draw_focus_unit
bool draw_focus_unit
Definition options.h:213
client_options::draw_paths
bool draw_paths
Definition options.h:204
client_options::draw_city_outlines
bool draw_city_outlines
Definition options.h:194
client_options::draw_coastline
bool draw_coastline
Definition options.h:203
client_options::draw_full_citybar
bool draw_full_citybar
Definition options.h:217
client_options::draw_pollution
bool draw_pollution
Definition options.h:210
client_options::solid_color_behind_units
bool solid_color_behind_units
Definition options.h:150
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::accl
const char * accl
Definition menu.c:95
menu_entry_info::key
const char * key
Definition menu.c:98
menu_entry_info::state
bool state
Definition menu.c:98
menu_entry_info::grouping
enum menu_entry_grouping grouping
Definition menu.c:103
menu_entry_info::toggle
void(* toggle)(GSimpleAction *act, GVariant *value, gpointer data)
Definition menu.c:97
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_option_map
Definition menu.c:1724
menu_entry_option_map::option
bool * option
Definition menu.c:1726
menu_entry_option_map::menu_entry
const char * menu_entry
Definition menu.c:1725
menu_entry_option_map::menu_pos
int menu_pos
Definition menu.c:1727
option
Definition options.c:514
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:135
packet_game_info::changable_tax
bool changable_tax
Definition packets_gen.h:144
packet_game_info::is_edit_mode
bool is_edit_mode
Definition packets_gen.h:191
packet_game_info::top_cities_count
int top_cities_count
Definition packets_gen.h:251
property_editor
Definition editprop.c:646
road_type
Definition road.h:71
terrain
Definition terrain.h:75
terrain::cultivate_result
struct terrain * cultivate_result
Definition terrain.h:108
terrain::plant_result
struct terrain * plant_result
Definition terrain.h:111
terrain::transform_result
struct terrain * transform_result
Definition terrain.h:122
tile
Definition tile.h:50
unit_type
Definition unittype.h:507
unit
Definition unit.h:140
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:960
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:300
advance_number
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
advance_iterate
#define advance_iterate(_p)
Definition tech.h:276
advance_iterate_end
#define advance_iterate_end
Definition tech.h:277
T_NONE
#define T_NONE
Definition terrain.h:61
tile_virtual_destroy
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1035
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:111
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:505
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:474
unit_can_help_build_wonder_here
bool unit_can_help_build_wonder_here(const struct unit *punit)
Definition unit.c:261
can_unit_do_autoworker
bool can_unit_do_autoworker(const struct unit *punit)
Definition unit.c:626
can_unit_teleport
bool can_unit_teleport(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:827
can_unit_paradrop
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:843
unit.h
unit_tile
#define unit_tile(_pu)
Definition unit.h:397
ORDER_PERFORM_ACTION
@ ORDER_PERFORM_ACTION
Definition unit.h:48
unit_owner
#define unit_owner(_pu)
Definition unit.h:396
MAX_NUM_BATTLEGROUPS
#define MAX_NUM_BATTLEGROUPS
Definition unit.h:192
units_can_convert
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:350
units_are_occupied
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:273
units_can_unload
bool units_can_unload(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:301
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:335
units_have_activity_on_tile
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:319
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