155 enum client_pages page = PAGE_MAIN;
171 static PangoLayout *
layout;
172 PangoFontDescription* desc;
173 static int pwidth, pheight;
174 static bool left =
FALSE;
175 GtkAllocation allocation;
178 cairo_set_source_surface(cr, intro->
surface, 0, 0);
185 layout = pango_layout_new(gtk_widget_create_pango_context(GTK_WIDGET(w)));
186 desc = pango_font_description_from_string(
"Sans Bold 10");
187 pango_layout_set_font_description(
layout, desc);
188 pango_font_description_free(desc);
192 if (rev_ver == NULL) {
194 fc_snprintf(msgbuf,
sizeof(msgbuf),
_(
"%s%s, %s client"),
200 fc_snprintf(msgbuf,
sizeof(msgbuf),
_(
"%s%s\ncommit: %s\n%s client"),
204 pango_layout_set_text(
layout, msgbuf, -1);
206 pango_layout_get_pixel_size(
layout, &pwidth, &pheight);
208 gtk_widget_get_allocation(GTK_WIDGET(w), &allocation);
210 cairo_set_source_rgb(cr, 0, 0, 0);
211 cairo_move_to(cr, left ? 4 : allocation.width - pwidth - 3,
212 allocation.height - pheight - 3);
213 pango_cairo_show_layout(cr,
layout);
215 cairo_set_source_rgb(cr, 1, 1, 1);
216 cairo_move_to(cr, left ? 3 : allocation.width - pwidth - 4,
217 allocation.height - pheight - 4);
218 pango_cairo_show_layout(cr,
layout);
236 GtkWidget *
widget, *vgrid, *frame, *darea, *button, *table;
238 struct sprite *intro_in, *intro;
244 size = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
246 vgrid = gtk_grid_new();
247 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
248 GTK_ORIENTATION_VERTICAL);
251 frame = gtk_frame_new(NULL);
252 gtk_widget_set_margin_bottom(frame, 18);
253 gtk_widget_set_margin_end(frame, 18);
254 gtk_widget_set_margin_start(frame, 18);
255 gtk_widget_set_margin_top(frame, 18);
256 gtk_widget_set_halign(frame, GTK_ALIGN_CENTER);
257 gtk_grid_attach(GTK_GRID(vgrid), frame, 0, grid_row++, 1, 1);
269#if IS_BETA_VERSION || IS_DEVEL_VERSION
274 if (sh -
height < space_needed) {
277 if (sh < (space_needed + 0.2 *
height)) {
281 scale = (double)(sh - space_needed) /
height;
290 darea = gtk_drawing_area_new();
292 gtk_drawing_area_set_draw_func(GTK_DRAWING_AREA(darea),
294 g_signal_connect(
widget,
"destroy",
296 gtk_frame_set_child(GTK_FRAME(frame), darea);
298#if IS_BETA_VERSION || IS_DEVEL_VERSION
303 gtk_widget_set_name(label,
"beta_label");
304 gtk_widget_set_halign(label, GTK_ALIGN_CENTER);
305 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
306 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
307 gtk_grid_attach(GTK_GRID(vgrid), label, 0, grid_row++, 1, 1);
311 table = gtk_grid_new();
312 gtk_widget_set_margin_bottom(table, 12);
313 gtk_widget_set_margin_end(table, 12);
314 gtk_widget_set_margin_start(table, 12);
315 gtk_widget_set_margin_top(table, 12);
316 gtk_widget_set_hexpand(table,
TRUE);
317 gtk_widget_set_vexpand(table,
TRUE);
318 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
319 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
321 gtk_grid_set_row_spacing(GTK_GRID(table), 8);
322 gtk_grid_set_column_spacing(GTK_GRID(table), 18);
323 gtk_grid_attach(GTK_GRID(vgrid), table, 0, grid_row++, 1, 1);
325 button = gtk_button_new_with_mnemonic(
_(
"Start _New Game"));
326 gtk_size_group_add_widget(
size, button);
327 gtk_grid_attach(GTK_GRID(table), button, 0, 0, 1, 1);
328 gtk_widget_set_tooltip_text(button,
329 _(
"Launches local server, and connects to it for a single-player game."));
330 g_signal_connect(button,
"clicked",
333 button = gtk_button_new_with_mnemonic(
_(
"Start _Scenario Game"));
334 gtk_size_group_add_widget(
size, button);
335 gtk_grid_attach(GTK_GRID(table), button, 0, 1, 1, 1);
336 gtk_widget_set_tooltip_text(button,
337 _(
"Loads one of the scenarios for a single-player game. "
338 "Tutorial is one of the scenarios."));
339 g_signal_connect(button,
"clicked",
342 button = gtk_button_new_with_mnemonic(
_(
"_Load Saved Game"));
343 gtk_size_group_add_widget(
size, button);
344 gtk_grid_attach(GTK_GRID(table), button, 0, 2, 1, 1);
345 gtk_widget_set_tooltip_text(button,
346 _(
"Continues previously saved single-player game."));
347 g_signal_connect(button,
"clicked",
350 button = gtk_button_new_with_mnemonic(
_(
"C_onnect to Network Game"));
351 gtk_size_group_add_widget(
size, button);
352 gtk_grid_attach(GTK_GRID(table), button, 1, 0, 1, 1);
353 gtk_widget_set_tooltip_text(button,
354 _(
"Connects to outside server. "
355 "Sometimes you want to launch a separate server even for local games."));
356 g_signal_connect(button,
"clicked",
359 button = gtk_button_new_with_mnemonic(
_(
"Client Settings"));
360 gtk_size_group_add_widget(
size, button);
361 gtk_grid_attach(GTK_GRID(table), button, 1, 1, 1, 1);
362 gtk_widget_set_tooltip_text(button,
363 _(
"Adjusting client-side options."));
367 gtk_size_group_add_widget(
size, button);
368 g_object_unref(
size);
369 gtk_grid_attach(GTK_GRID(table), button, 1, 2, 1, 1);
370 gtk_widget_set_tooltip_text(button,
371 _(
"Gives you a break from playing freeciv."));
372 g_signal_connect(button,
"clicked",
382typedef struct fileinfo_list * (*save_dialog_files_fn_t) (void);
419 const struct fileinfo_list *files)
423 gtk_list_store_clear(store);
425 gtk_list_store_append(store, &iter);
426 gtk_list_store_set(store, &iter,
438 struct fileinfo_list *files;
443 files = pdialog->
files();
445 (gtk_tree_view_get_model(pdialog->
tree_view)),
447 fileinfo_list_destroy(files);
454 gint response, gpointer data)
456 if (response == GTK_RESPONSE_OK) {
458 GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(
widget));
461 gchar *filename = g_file_get_parse_name(file);
463 if (NULL != filename) {
468 g_object_unref(file);
472 gtk_window_destroy(GTK_WINDOW(
widget));
479 GtkFileChooserAction
action,
482 GtkWidget *filechoose;
486 _(
"_Cancel"), GTK_RESPONSE_CANCEL,
487 (
action == GTK_FILE_CHOOSER_ACTION_SAVE) ?
488 _(
"_Save") :
_(
"_Open"),
489 GTK_RESPONSE_OK, NULL);
492 g_signal_connect(filechoose,
"response",
496 gtk_window_present(GTK_WINDOW(filechoose));
510 GTK_FILE_CHOOSER_ACTION_SAVE,
515 GtkTreeSelection *selection;
518 const gchar *full_path;
520 selection = gtk_tree_view_get_selection(pdialog->
tree_view);
521 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
532 const char *text = gtk_entry_buffer_get_text(gtk_entry_get_buffer(pdialog->
entry));
533 gchar *filename = g_filename_from_utf8(text, -1, NULL, NULL, NULL);
535 if (NULL == filename) {
538 pdialog->
action(filename);
546 gtk_window_destroy(GTK_WINDOW(pdialog->
shell));
554 GtkTreeViewColumn *column,
577 const gchar *filename;
579 if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
586 gtk_entry_buffer_set_text(gtk_entry_get_buffer(pdialog->
entry), filename, -1);
593 const char *savefilelabel,
600 GtkCellRenderer *rend;
601 GtkTreeSelection *selection;
614 shell = gtk_dialog_new_with_buttons(
title, NULL, 0,
617 _(
"_Cancel"), GTK_RESPONSE_CANCEL,
620 g_object_set_data_full(G_OBJECT(
shell),
"save_dialog", pdialog,
621 (GDestroyNotify) free);
622 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_CANCEL);
625 g_signal_connect(
shell,
"response",
628 vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
632 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
635 g_object_unref(store);
636 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
637 g_signal_connect(
view,
"row-activated",
641 sbox = gtk_grid_new();
642 gtk_orientable_set_orientation(GTK_ORIENTABLE(sbox),
643 GTK_ORIENTATION_VERTICAL);
644 gtk_grid_set_row_spacing(GTK_GRID(sbox), 2);
645 gtk_box_append(vbox, sbox);
647 label = g_object_new(GTK_TYPE_LABEL,
648 "use-underline",
TRUE,
649 "mnemonic-widget",
view,
654 gtk_grid_attach(GTK_GRID(sbox), label, 0, grids_row++, 1, 1);
656 sw = gtk_scrolled_window_new();
657 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw), 300);
658 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 300);
659 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
660 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
661 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
662 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
663 gtk_grid_attach(GTK_GRID(sbox), sw, 0, grids_row++, 1, 1);
665 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
666 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
667 g_signal_connect(selection,
"changed",
670 rend = gtk_cell_renderer_text_new();
671 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view),
672 -1, NULL, rend,
"text",
676 entry = gtk_entry_new();
678 g_signal_connect(
entry,
"activate",
682 sbox = gtk_grid_new();
684 gtk_widget_set_margin_bottom(sbox, 12);
685 gtk_widget_set_margin_end(sbox, 12);
686 gtk_widget_set_margin_start(sbox, 12);
687 gtk_widget_set_margin_top(sbox, 12);
688 gtk_orientable_set_orientation(GTK_ORIENTABLE(sbox),
689 GTK_ORIENTATION_VERTICAL);
690 gtk_grid_set_row_spacing(GTK_GRID(sbox), 2);
692 label = g_object_new(GTK_TYPE_LABEL,
693 "use-underline",
TRUE,
694 "mnemonic-widget",
entry,
695 "label", savefilelabel,
699 gtk_grid_attach(GTK_GRID(sbox), label, 0, grids_row++, 1, 1);
701 gtk_grid_attach(GTK_GRID(sbox),
entry, 0, grids_row++, 1, 1);
702 gtk_box_append(vbox, sbox);
705 gtk_window_set_focus(GTK_WINDOW(
shell),
entry);
706 gtk_widget_show(GTK_WIDGET(vbox));
726 GtkTreeSelection *sel = NULL;
730 const gchar *host, *portstr;
748 view = gtk_tree_selection_get_tree_view(sel);
749 store = GTK_LIST_STORE(gtk_tree_view_get_model(
view));
750 gtk_list_store_clear(store);
756 host = gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_host)));
757 portstr = gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_port)));
758 port = atoi(portstr);
763 if (pserver->humans >= 0) {
764 fc_snprintf(buf,
sizeof(buf),
"%d", pserver->humans);
768 gtk_list_store_append(store, &it);
769 gtk_list_store_set(store, &it,
773 3,
_(pserver->state),
774 4, pserver->nplayers,
778 if (strcmp(host, pserver->host) == 0 && port == pserver->port) {
779 gtk_tree_selection_select_iter(sel, &it);
835 scan_data->
timer = 0;
889 gtk_label_set_text(GTK_LABEL(
statusbar), txt);
907 gtk_label_set_text(GTK_LABEL(
statusbar),
"");
918 gtk_label_set_text(GTK_LABEL(
statusbar), text);
933 gtk_widget_set_margin_start(
statusbar, 2);
936 gtk_widget_set_margin_bottom(
statusbar, 2);
954 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_password)),
970 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_password)),
"", -1);
987 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_password)),
"", -1);
1073 gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_login))));
1075 gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_host))));
1079 errbuf,
sizeof(errbuf)) != -1) {
1089 gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_password))));
1107 gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
network_password))));
1124 GtkTreeViewColumn *arg2,
1136 GtkListStore *store;
1143 gtk_list_store_clear(store);
1144 if (!pserver || !pserver->
players) {
1149 for (i = 0; i <
n; i++) {
1150 gtk_list_store_append(store, &iter);
1151 gtk_list_store_set(store, &iter,
1165 GtkTreeModel *model;
1170 const struct server *pserver = NULL;
1172 if (!gtk_tree_selection_get_selected(select, &model, &it)) {
1181 path = gtk_tree_model_get_path(model, &it);
1187 gint
pos = gtk_tree_path_get_indices(path)[0];
1189 pserver = server_list_get(srvrs->
servers,
pos);
1195 gtk_tree_path_free(path);
1199 gtk_tree_model_get(model, &it, 0, &host, 1, &port, -1);
1201 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_host)), host, -1);
1202 fc_snprintf(portstr,
sizeof(portstr),
"%d", port);
1203 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_port)), portstr, -1);
1219 gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(
network_port)), buf, -1);
1227 GtkWidget *box, *sbox, *bbox, *hbox, *notebook;
1228 GtkWidget *button, *label, *
view, *sw, *table;
1229 GtkTreeSelection *selection;
1230 GtkListStore *store;
1231 GtkEventController *controller;
1233 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
1234 gtk_widget_set_margin_start(box, 4);
1235 gtk_widget_set_margin_end(box, 4);
1236 gtk_widget_set_margin_top(box, 4);
1237 gtk_widget_set_margin_bottom(box, 4);
1239 notebook = gtk_notebook_new();
1240 gtk_box_append(GTK_BOX(box), notebook);
1243 lan_store = gtk_list_store_new(7, G_TYPE_STRING,
1251 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
lan_store));
1252 gtk_widget_set_hexpand(
view,
TRUE);
1253 gtk_widget_set_vexpand(
view,
TRUE);
1255 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(
view));
1257 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
1259 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
1261 controller = gtk_event_controller_focus_new();
1262 g_signal_connect(controller,
"enter",
1264 gtk_widget_add_controller(
view, controller);
1266 g_signal_connect(
view,
"row-activated",
1268 g_signal_connect(selection,
"changed",
1279 label = gtk_label_new_with_mnemonic(
_(
"Local _Area Network"));
1281 sw = gtk_scrolled_window_new();
1282 gtk_widget_set_margin_start(sw, 4);
1283 gtk_widget_set_margin_end(sw, 4);
1284 gtk_widget_set_margin_top(sw, 4);
1285 gtk_widget_set_margin_bottom(sw, 4);
1286 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
1287 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1288 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1289 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
1290 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
1294 meta_store = gtk_list_store_new(7, G_TYPE_STRING,
1303 gtk_widget_set_hexpand(
view,
TRUE);
1304 gtk_widget_set_vexpand(
view,
TRUE);
1306 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(
view));
1308 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
1310 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
1312 controller = gtk_event_controller_focus_new();
1313 g_signal_connect(controller,
"enter",
1315 gtk_widget_add_controller(
view, controller);
1317 g_signal_connect(
view,
"row-activated",
1319 g_signal_connect(selection,
"changed",
1330 label = gtk_label_new_with_mnemonic(
_(
"Internet _Metaserver"));
1332 sw = gtk_scrolled_window_new();
1333 gtk_widget_set_margin_start(sw, 4);
1334 gtk_widget_set_margin_end(sw, 4);
1335 gtk_widget_set_margin_top(sw, 4);
1336 gtk_widget_set_margin_bottom(sw, 4);
1337 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
1338 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1339 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1340 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
1342 gtk_notebook_prepend_page(GTK_NOTEBOOK(notebook), sw, label);
1344 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
1348 sbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
1349 gtk_box_append(GTK_BOX(box), sbox);
1351 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
1352 gtk_widget_set_margin_bottom(hbox, 8);
1353 gtk_widget_set_margin_end(hbox, 8);
1354 gtk_widget_set_margin_start(hbox, 8);
1355 gtk_widget_set_margin_top(hbox, 8);
1356 gtk_box_append(GTK_BOX(sbox), hbox);
1358 table = gtk_grid_new();
1359 gtk_grid_set_row_spacing(GTK_GRID(table), 2);
1360 gtk_grid_set_column_spacing(GTK_GRID(table), 12);
1361 gtk_box_append(GTK_BOX(hbox), table);
1366 gtk_grid_attach(GTK_GRID(table),
network_host, 1, 0, 1, 1);
1368 label = g_object_new(GTK_TYPE_LABEL,
1369 "use-underline",
TRUE,
1371 "label",
_(
"_Host:"),
1376 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
1381 gtk_grid_attach(GTK_GRID(table),
network_port, 1, 1, 1, 1);
1383 label = g_object_new(GTK_TYPE_LABEL,
1384 "use-underline",
TRUE,
1386 "label",
_(
"_Port:"),
1391 gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);
1397 gtk_grid_attach(GTK_GRID(table),
network_login, 1, 3, 1, 1);
1399 label = g_object_new(GTK_TYPE_LABEL,
1400 "use-underline",
TRUE,
1402 "label",
_(
"_Login:"),
1406 gtk_widget_set_margin_top(label, 10);
1408 gtk_grid_attach(GTK_GRID(table), label, 0, 3, 1, 1);
1416 label = g_object_new(GTK_TYPE_LABEL,
1417 "use-underline",
TRUE,
1419 "label",
_(
"Pass_word:"),
1424 gtk_grid_attach(GTK_GRID(table), label, 0, 4, 1, 1);
1432 label = g_object_new(GTK_TYPE_LABEL,
1433 "use-underline",
TRUE,
1435 "label",
_(
"Conf_irm Password:"),
1440 gtk_grid_attach(GTK_GRID(table), label, 0, 5, 1, 1);
1443 store = gtk_list_store_new(4, G_TYPE_STRING,
1449 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1450 gtk_widget_set_hexpand(
view,
TRUE);
1457 sw = gtk_scrolled_window_new();
1458 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
1459 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
1460 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1461 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
1462 gtk_box_append(GTK_BOX(hbox), sw);
1464 bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1465 gtk_widget_set_margin_bottom(bbox, 2);
1466 gtk_widget_set_margin_end(bbox, 2);
1467 gtk_widget_set_margin_start(bbox, 2);
1468 gtk_widget_set_margin_top(bbox, 2);
1469 gtk_box_set_spacing(GTK_BOX(bbox), 12);
1470 gtk_box_append(GTK_BOX(sbox), bbox);
1472 button = gtk_button_new_from_icon_name(
"view-refresh");
1473 gtk_box_append(GTK_BOX(bbox), button);
1474 g_signal_connect(button,
"clicked",
1477 button = gtk_button_new_with_mnemonic(
_(
"_Cancel"));
1478 gtk_box_append(GTK_BOX(bbox), button);
1479 g_signal_connect(button,
"clicked",
1482 button = gtk_button_new_with_mnemonic(
_(
"C_onnect"));
1483 gtk_box_append(GTK_BOX(bbox), button);
1484 g_signal_connect(button,
"clicked",
1578 g_object_set_data(
object,
"player_id",
1579 GINT_TO_POINTER(NULL != pplayer
1582 g_object_set_data(
object,
"connection_id",
1583 GINT_TO_POINTER(NULL != pconn ? pconn->
id : 0));
1596 if (NULL != ppplayer) {
1597 id = GPOINTER_TO_INT(g_object_get_data(
object,
"player_id"));
1599 if (NULL != *ppplayer) {
1603 if (NULL != ppconn) {
1604 id = GPOINTER_TO_INT(g_object_get_data(
object,
"connection_id"));
1606 if (NULL != *ppconn) {
1627 enum ai_level *levels = (
enum ai_level *)data;
1631 i = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
1634 enum ai_level
level = levels[i];
1665 const char *
name = NULL;
1682 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w)));
1735 struct team_slot *tslot = g_object_get_data(G_OBJECT(
action),
"slot");
1794 (
char *) g_object_get_data(G_OBJECT(
action),
"command"),
1822 GVariant *parameter, gpointer data)
1829 (
char *) g_object_get_data(G_OBJECT(
action),
"command"),
1842 char buf[4096] =
"";
1858 popup = gtk_message_dialog_new(NULL, 0,
1859 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
1861 gtk_window_set_title(GTK_WINDOW(popup),
_(
"Player/conn info"));
1863 g_signal_connect(popup,
"response", G_CALLBACK(gtk_window_destroy), NULL);
1864 gtk_window_present(GTK_WINDOW(popup));
1894 GActionGroup *group;
1896 group = G_ACTION_GROUP(g_simple_action_group_new());
1898 menu = g_menu_new();
1902 buf = g_strdup_printf(
_(
"%s info"),
1905 act = g_simple_action_new(
"info", NULL);
1906 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1910 if (NULL != pplayer) {
1911 act = g_simple_action_new(
"toggle_ready", NULL);
1912 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1914 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
is_human(pplayer));
1916 "win.toggle_ready"));
1918 act = g_simple_action_new(
"pick_nation", NULL);
1919 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1921 g_simple_action_set_enabled(G_SIMPLE_ACTION(act),
1926 act = g_simple_action_new(
"observe", NULL);
1927 g_object_set_data_full(G_OBJECT(act),
"command", g_strdup(
"observe"),
1928 (GDestroyNotify) g_free);
1929 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1934 act = g_simple_action_new(
"take_plr", NULL);
1935 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1943 act = g_simple_action_new(
"cut_conn", NULL);
1944 g_object_set_data_full(G_OBJECT(act),
"command", g_strdup(
"cut"),
1945 (GDestroyNotify) g_free);
1946 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1952 act = g_simple_action_new(
"aitoggle", NULL);
1953 g_object_set_data_full(G_OBJECT(act),
"command", g_strdup(
"aitoggle"),
1954 (GDestroyNotify) g_free);
1955 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1960 act = g_simple_action_new(
"remove", NULL);
1961 g_object_set_data_full(G_OBJECT(act),
"command", g_strdup(
"remove"),
1962 (GDestroyNotify) g_free);
1963 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1971 enum cmdlevel
level;
1977 buf = g_strdup_printf(
_(
"Give %s access"), cmdlevel_name(
level));
1980 act = g_simple_action_new(actbuf, NULL);
1981 g_object_set_data_full(G_OBJECT(act),
"command",
1982 g_strdup_printf(
"cmdlevel %s",
1983 cmdlevel_name(
level)),
1984 (GDestroyNotify) g_free);
1985 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
1994 && NULL != pplayer &&
is_ai(pplayer)) {
1995 enum ai_level
level;
2001 buf = g_strdup_printf(
_(
"Difficulty: %s"), ai_level_translated_name(
level));
2004 act = g_simple_action_new(actbuf, NULL);
2005 g_object_set_data_full(G_OBJECT(act),
"command",
2007 (GDestroyNotify) g_free);
2008 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2017 if (pplayer != NULL ) {
2018 const int count = pplayer->
team
2020 bool need_empty_team = (count != 1);
2028 if (!need_empty_team) {
2031 need_empty_team =
FALSE;
2037 buf = g_strdup_printf(
_(
"Put on %s"),
2039 fc_snprintf(actbuf,
sizeof(actbuf),
"team_%d",
id);
2041 act = g_simple_action_new(actbuf, NULL);
2042 g_object_set_data(G_OBJECT(act),
"slot", tslot);
2043 g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(act));
2045 fc_snprintf(actbuf,
sizeof(actbuf),
"win.team_%d",
id);
2052 conn_popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(menu));
2054 gtk_widget_insert_action_group(
conn_popover,
"win", group);
2065 GtkTreeSelection *selection =
2067 GtkTreePath *path = data;
2069 gtk_tree_selection_unselect_path(selection, path);
2070 gtk_tree_path_free(path);
2080 double x,
double y, gpointer data)
2082 GtkEventController *controller = GTK_EVENT_CONTROLLER(gesture);
2083 GtkTreeView *tree = GTK_TREE_VIEW(gtk_event_controller_get_widget(controller));
2084 GtkTreePath *path = NULL;
2085 GtkTreeSelection *selection = gtk_tree_view_get_selection(tree);
2087 if (!gtk_tree_view_get_path_at_pos(tree,
2089 &path, NULL, NULL, NULL)) {
2093 if (gtk_tree_selection_path_is_selected(selection, path)) {
2099 gtk_tree_path_free(path);
2109 double x,
double y, gpointer data)
2111 GtkEventController *controller = GTK_EVENT_CONTROLLER(gesture);
2112 GtkWidget *tree = gtk_event_controller_get_widget(controller);
2113 GtkWidget *parent = data;
2114 GtkTreePath *path = NULL;
2116 GtkTreeSelection *selection;
2117 GtkTreeModel *model;
2119 int player_no, conn_id;
2123 GdkRectangle rect = { .x = x, .y = y, .width = 1, .height = 1};
2125 gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tree), x, y, &bx, &by);
2127 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree), bx, by,
2128 &path, NULL, NULL, NULL)) {
2132 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
2133 model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
2135 if (!gtk_tree_selection_path_is_selected(selection, path)) {
2136 gtk_tree_selection_select_path(selection, path);
2138 gtk_tree_model_get_iter(model, &iter, path);
2147 gtk_widget_set_parent(menu, parent);
2148 gtk_popover_set_pointing_to(GTK_POPOVER(menu), &rect);
2150 gtk_popover_popup(GTK_POPOVER(menu));
2152 gtk_tree_path_free(path);
2165 GtkTreeStore *store = GTK_TREE_STORE(gtk_tree_view_get_model(tree_view));
2167 gtk_tree_store_set(store, iter,
2180 GtkTreeModel *model;
2181 GtkTreeSelection *selection =
2184 if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
2187 if (NULL != ppplayer) {
2191 if (NULL != ppconn) {
2199 if (NULL != ppplayer) {
2202 if (NULL != ppconn) {
2213 GtkTreeModel *model;
2214 GtkTreeIter parent, child, *iter = NULL;
2215 GtkTreeSelection *selection;
2217 const int search_id = pconn->
id;
2228 valid = gtk_tree_model_get_iter_first(model, &parent);
2229 while (valid && NULL == iter) {
2231 if (search_id ==
id) {
2237 valid = gtk_tree_model_iter_children(model, &child, &parent);
2238 while (valid && NULL == iter) {
2240 if (search_id ==
id) {
2244 valid = gtk_tree_model_iter_next(model, &child);
2247 valid = gtk_tree_model_iter_next(model, &parent);
2252 gtk_tree_selection_select_iter(selection, iter);
2254 log_error(
"%s(): connection %s not found.",
2278 struct player *selected_plr;
2281 if (row_selected && NULL != selected_plr) {
2298 struct player *selected_plr;
2301 if (row_selected && NULL != selected_plr) {
2320 struct player *selected_plr;
2328 text =
_(
"Not _ready");
2330 int num_unready = 0;
2333 if (
is_human(pplayer) && !pplayer->is_ready) {
2338 if (num_unready > 1) {
2366 if (row_selected && NULL != selected_plr) {
2371 text =
_(
"Pick _Nation");
2374 text =
_(
"_Take a Player");
2381 if (row_selected && NULL != selected_plr) {
2387 text =
_(
"_Observe");
2390 text =
_(
"Do not _observe");
2404 const struct player *pplayer)
2409 if (NULL != start) {
2411 if (!gtk_tree_model_iter_next(model, iter)) {
2414 }
else if (!gtk_tree_model_get_iter_first(model, iter)) {
2420 if (
id == search_id) {
2423 }
while (gtk_tree_model_iter_next(model, iter));
2433 GtkTreeIter *parent, GtkTreeIter *start,
2436 const int search_id = pconn->
id;
2439 if (NULL != start) {
2441 if (!gtk_tree_model_iter_next(model, iter)) {
2444 }
else if (!gtk_tree_model_iter_children(model, iter, parent)) {
2450 if (
id == search_id) {
2453 }
while (gtk_tree_model_iter_next(model, iter));
2467 GtkTreeModel *model = GTK_TREE_MODEL(store);
2469 GtkTreeIter child, prev_child, *pprev_child;
2470 GtkTreeIter parent, prev_parent, *pprev_parent = NULL;
2471 GdkPixbuf *flag, *
color;
2473 struct player *pselected_player;
2476 const char *nation, *plr_name, *
team;
2488 if (
level == new_level) {
2495 if (
level == AI_LEVEL_COUNT) {
2509 flag = pplayer->nation ?
get_flag(pplayer->nation) : NULL;
2513 if (pconn->playing == pplayer && !pconn->observer) {
2514 conn_id = pconn->id;
2520 if (
is_ai(pplayer) && !pplayer->was_created
2521 && !pplayer->is_connected) {
2524 ai_level_translated_name(pplayer->ai_common.skill_level));
2532 is_ready = !
is_human(pplayer) ?
TRUE : pplayer->is_ready;
2535 nation =
_(
"Random");
2536 if (pplayer->was_created) {
2549 gtk_tree_store_move_after(store, &parent, pprev_parent);
2551 gtk_tree_store_insert_after(store, &parent, NULL, pprev_parent);
2554 gtk_tree_store_set(store, &parent,
2571 if (pconn->id == conn_id) {
2575 pprev_child, pconn)) {
2576 gtk_tree_store_move_after(store, &child, pprev_child);
2578 gtk_tree_store_insert_after(store, &child, &parent, pprev_child);
2581 gtk_tree_store_set(store, &child,
2591 pprev_child = &prev_child;
2595 if (NULL != pprev_child) {
2598 path = gtk_tree_model_get_path(model, &parent);
2601 gtk_tree_path_free(path);
2606 if (NULL != pprev_child) {
2608 if (gtk_tree_model_iter_next(model, &child)) {
2609 while (gtk_tree_store_remove(store, &child)) {
2613 }
else if (gtk_tree_model_iter_children(model, &child, &parent)) {
2614 while (gtk_tree_store_remove(store, &child)) {
2619 prev_parent = parent;
2620 pprev_parent = &prev_parent;
2622 g_object_unref(flag);
2625 g_object_unref(
color);
2632 if (NULL != pconn->playing || !pconn->observer) {
2637 gtk_tree_store_move_after(store, &parent, pprev_parent);
2639 gtk_tree_store_insert_after(store, &parent, NULL, pprev_parent);
2642 gtk_tree_store_set(store, &parent,
2651 prev_parent = parent;
2652 pprev_parent = &prev_parent;
2657 if (NULL != pconn->playing || pconn->observer) {
2662 gtk_tree_store_move_after(store, &parent, pprev_parent);
2664 gtk_tree_store_insert_after(store, &parent, NULL, pprev_parent);
2667 gtk_tree_store_set(store, &parent,
2676 prev_parent = parent;
2677 pprev_parent = &prev_parent;
2681 if (NULL != pprev_parent) {
2682 parent = prev_parent;
2683 if (gtk_tree_model_iter_next(model, &parent)) {
2684 while (gtk_tree_store_remove(store, &parent)) {
2689 gtk_tree_store_clear(store);
2693 if (NULL == pselected_player && NULL != pselected_conn) {
2707 const char *
title,
int colnum,
const char *key)
2709 GtkCellRenderer *rend;
2710 GtkTreeViewColumn *col;
2712 if (gtype == G_TYPE_BOOLEAN) {
2713 rend = gtk_cell_renderer_toggle_new();
2714 col = gtk_tree_view_column_new_with_attributes(
title, rend,
2715 "active", colnum, NULL);
2716 }
else if (gtype == GDK_TYPE_PIXBUF) {
2717 rend = gtk_cell_renderer_pixbuf_new();
2718 col = gtk_tree_view_column_new_with_attributes(
title, rend,
2719 "pixbuf", colnum, NULL);
2721 rend = gtk_cell_renderer_text_new();
2722 col = gtk_tree_view_column_new_with_attributes(
title, rend,
2729 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
2730 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), col);
2733 g_object_set_data(G_OBJECT(treeview), key, col);
2742 GtkWidget *box, *sbox, *table, *vgrid;
2743 GtkWidget *
view, *sw, *text, *toolkit_view, *button, *spin;
2745 GtkTreeSelection *selection;
2746 enum ai_level
level;
2750 static enum ai_level levels[AI_LEVEL_COUNT];
2755 GtkGesture *gesture;
2756 GtkEventController *controller;
2758 box = gtk_grid_new();
2759 gtk_orientable_set_orientation(GTK_ORIENTABLE(box),
2760 GTK_ORIENTATION_VERTICAL);
2761 gtk_grid_set_row_spacing(GTK_GRID(box), 8);
2762 gtk_widget_set_margin_start(box, 4);
2763 gtk_widget_set_margin_end(box, 4);
2764 gtk_widget_set_margin_top(box, 4);
2765 gtk_widget_set_margin_bottom(box, 4);
2767 sbox = gtk_grid_new();
2768 gtk_grid_set_column_spacing(GTK_GRID(sbox), 12);
2769 gtk_grid_attach(GTK_GRID(box), sbox, 0, box_row++, 1, 1);
2771 vgrid = gtk_grid_new();
2772 gtk_widget_set_margin_bottom(vgrid, 12);
2773 gtk_widget_set_margin_end(vgrid, 12);
2774 gtk_widget_set_margin_start(vgrid, 12);
2775 gtk_widget_set_margin_top(vgrid, 12);
2776 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
2777 GTK_ORIENTATION_VERTICAL);
2778 gtk_grid_set_row_spacing(GTK_GRID(vgrid), 2);
2779 gtk_widget_set_halign(vgrid, GTK_ALIGN_CENTER);
2780 gtk_widget_set_valign(vgrid, GTK_ALIGN_CENTER);
2781 gtk_grid_attach(GTK_GRID(sbox), vgrid, sbox_col++, 0, 1, 1);
2783 table = gtk_grid_new();
2785 gtk_grid_set_row_spacing(GTK_GRID(table), 2);
2786 gtk_grid_set_column_spacing(GTK_GRID(table), 12);
2787 gtk_grid_attach(GTK_GRID(vgrid), table, 0, grid_row++, 1, 1);
2791 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
2792 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin),
2793 GTK_UPDATE_IF_VALID);
2797 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
2801 g_signal_connect_after(spin,
"value_changed",
2804 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
2806 label = g_object_new(GTK_TYPE_LABEL,
2807 "use-underline",
TRUE,
2808 "mnemonic-widget", spin,
2810 "label",
_(
"Number of _Players\n(including AI):"),
2814 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
2820 const char *level_name = ai_level_translated_name(
level);
2822 gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(
ai_lvl_combobox), i, level_name);
2833 label = g_object_new(GTK_TYPE_LABEL,
2834 "use-underline",
TRUE,
2836 "label",
_(
"AI Skill _Level:"),
2840 gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);
2846 gtk_grid_attach(GTK_GRID(table),
ruleset_combo, 1, 2, 1, 1);
2848 label = g_object_new(GTK_TYPE_LABEL,
2849 "use-underline",
TRUE,
2851 "label",
_(
"Ruleset:"),
2855 gtk_grid_attach(GTK_GRID(table), label, 0, 2, 1, 1);
2858 _(
"_More Game Options..."));
2859 gtk_widget_set_margin_bottom(button, 8);
2860 gtk_widget_set_margin_end(button, 8);
2861 gtk_widget_set_margin_start(button, 8);
2862 gtk_widget_set_margin_top(button, 8);
2863 gtk_widget_set_halign(button, GTK_ALIGN_CENTER);
2864 gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
2865 g_signal_connect(button,
"clicked",
2867 gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1);
2871 gtk_widget_set_hexpand(
view,
TRUE);
2873 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
TRUE);
2876 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
view));
2877 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
2878 g_signal_connect(selection,
"changed",
2896 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
2897 g_signal_connect(controller,
"pressed",
2899 gtk_widget_add_controller(
view, controller);
2901 g_signal_connect(
view,
"row-collapsed",
2903 GINT_TO_POINTER(
TRUE));
2904 g_signal_connect(
view,
"row-expanded",
2906 GINT_TO_POINTER(
FALSE));
2908 sw = gtk_scrolled_window_new();
2909 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
2910 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
2911 GTK_POLICY_AUTOMATIC,
2913 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200);
2914 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
2918 gesture = gtk_gesture_click_new();
2919 gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 3);
2920 controller = GTK_EVENT_CONTROLLER(gesture);
2921 g_signal_connect(controller,
"pressed",
2923 gtk_widget_add_controller(
view, controller);
2925 gtk_grid_attach(GTK_GRID(sbox), sw, sbox_col++, 0, 1, 1);
2927 sw = gtk_scrolled_window_new();
2928 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
2929 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
2930 GTK_POLICY_AUTOMATIC,
2932 gtk_grid_attach(GTK_GRID(box), sw, 0, box_row++, 1, 1);
2935 gtk_widget_set_hexpand(text,
TRUE);
2936 gtk_widget_set_vexpand(text,
TRUE);
2938 gtk_widget_set_name(text,
"chatline");
2939 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
2940 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
2941 gtk_text_view_set_editable(GTK_TEXT_VIEW(text),
FALSE);
2942 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), text);
2952 gtk_grid_attach(GTK_GRID(box), toolkit_view, 0, box_row++, 1, 1);
2954 button = gtk_button_new_with_mnemonic(
_(
"_Cancel"));
2956 g_signal_connect(button,
"clicked", G_CALLBACK(
main_callback), NULL);
2983 if (load_successful) {
3007 const gchar *filename;
3009 if (!gtk_tree_selection_get_selected(
load_selection, NULL, &it)) {
3013 gtk_tree_model_get(GTK_TREE_MODEL(
load_store), &it,
3024 GTK_FILE_CHOOSER_ACTION_OPEN,
3038 fileinfo_list_destroy(files);
3046 GtkWidget *box, *sbox, *bbox;
3048 GtkWidget *button, *label, *
view, *sw;
3049 GtkCellRenderer *rend;
3053 box = gtk_grid_new();
3054 gtk_orientable_set_orientation(GTK_ORIENTABLE(box),
3055 GTK_ORIENTATION_VERTICAL);
3056 gtk_grid_set_row_spacing(GTK_GRID(box), 18);
3057 gtk_widget_set_margin_start(box, 4);
3058 gtk_widget_set_margin_end(box, 4);
3059 gtk_widget_set_margin_top(box, 4);
3060 gtk_widget_set_margin_bottom(box, 4);
3064 gtk_widget_set_vexpand(
view,
TRUE);
3067 rend = gtk_cell_renderer_text_new();
3068 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view),
3069 -1, NULL, rend,
"text", 0, NULL);
3072 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
3074 gtk_tree_selection_set_mode(
load_selection, GTK_SELECTION_SINGLE);
3076 g_signal_connect(
view,
"row-activated",
3079 sbox = gtk_grid_new();
3080 gtk_widget_set_halign(sbox, GTK_ALIGN_CENTER);
3081 gtk_orientable_set_orientation(GTK_ORIENTABLE(sbox),
3082 GTK_ORIENTATION_VERTICAL);
3083 gtk_grid_set_row_spacing(GTK_GRID(sbox), 2);
3084 gtk_grid_attach(GTK_GRID(box), sbox, 0, box_row++, 1, 1);
3086 label = g_object_new(GTK_TYPE_LABEL,
3087 "use-underline",
TRUE,
3088 "mnemonic-widget",
view,
3089 "label",
_(
"Choose Saved Game to _Load:"),
3093 gtk_grid_attach(GTK_GRID(sbox), label, 0, sbox_row++, 1, 1);
3095 sw = gtk_scrolled_window_new();
3096 gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw), 300);
3097 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
3098 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC,
3099 GTK_POLICY_AUTOMATIC);
3100 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
3101 gtk_grid_attach(GTK_GRID(sbox), sw, 0, sbox_row++, 1, 1);
3103 bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
3104 gtk_widget_set_hexpand(bbox,
TRUE);
3105 gtk_box_set_spacing(GTK_BOX(bbox), 12);
3106 gtk_grid_attach(GTK_GRID(box), bbox, 0, box_row++, 1, 1);
3108 button = gtk_button_new_with_mnemonic(
_(
"_Browse..."));
3109 gtk_box_append(GTK_BOX(bbox), button);
3110 g_signal_connect(button,
"clicked",
3113 button = gtk_button_new_with_mnemonic(
_(
"_Cancel"));
3114 gtk_box_append(GTK_BOX(bbox), button);
3115 g_signal_connect(button,
"clicked",
3118 button = gtk_button_new_with_mnemonic(
_(
"_OK"));
3119 gtk_box_append(GTK_BOX(bbox), button);
3120 g_signal_connect(button,
"clicked",
3132 GtkTextBuffer *buffer;
3141 2, &description, -1);
3153 maj = ver / 1000000;
3159 fc_snprintf(vername,
sizeof(vername),
"%d.%d+", maj, min);
3161 fc_snprintf(vername,
sizeof(vername),
"%d.%d", maj, min);
3175 gtk_text_buffer_set_text(buffer, description, -1);
3177 gtk_text_buffer_set_text(buffer, authors, -1);
3194 gtk_tree_model_get(GTK_TREE_MODEL(
scenario_store), &it, 1, &filename, -1);
3204 GTK_FILE_CHOOSER_ACTION_OPEN,
3213 struct fileinfo_list *files;
3224 const char *sname, *sdescription, *sauthors;
3227 int current_ver = MAJOR_VERSION * 1000000 + MINOR_VERSION * 10000;
3230 current_dev = current_ver;
3231 if (PATCH_VERSION >= 90) {
3233 current_dev += PATCH_VERSION * 100;
3237 if (fcver < 30000) {
3243 if (fcver % 10000 >= 9000) {
3244 fcdev = fcver - (fcver % 100);
3246 fcdev = fcver - (fcver % 10000);
3250 "scenario.description");
3252 log_debug(
"scenario file: %s from %s", sname, pfile->fullname);
3255 if (fcdev <= current_dev) {
3256 bool add_new =
TRUE;
3258 if (sname != NULL) {
3262 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(
scenario_store), &it);
3269 if (!strcmp(sname, oname)) {
3275 log_debug(
"Duplicate %s (%d vs %d)", sname, existing, fcver);
3277 if (existing > fcver) {
3280 }
else if (existing < fcver) {
3285 0, sname && strlen(sname) ?
Q_(sname) : pfile->name,
3287 2, (NULL != sdescription &&
'\0' != sdescription[0]
3288 ?
Q_(sdescription) :
""),
3289 3, (NULL != sauthors && sauthors[0] !=
'\0'
3290 ?
Q_(sauthors) :
""),
3297 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(
scenario_store), &it);
3306 0, sname && strlen(sname) ?
Q_(sname) : pfile->name,
3308 2, (NULL != sdescription &&
'\0' != sdescription[0]
3309 ?
Q_(sdescription) :
""),
3310 3, (NULL != sauthors && sauthors[0] !=
'\0'
3311 ?
Q_(sauthors) :
""),
3321 fileinfo_list_destroy(files);
3329 GtkWidget *vgrid, *hbox, *sbox, *bbox, *filenamebox, *descbox;
3330 GtkWidget *versionbox, *vertext;
3331 GtkWidget *button, *label, *
view, *sw, *swa, *text;
3332 GtkCellRenderer *rend;
3334 int filenamecol = 0;
3338 vgrid = gtk_grid_new();
3339 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
3340 GTK_ORIENTATION_VERTICAL);
3341 gtk_grid_set_row_spacing(GTK_GRID(vgrid), 18);
3342 gtk_widget_set_margin_start(vgrid, 4);
3343 gtk_widget_set_margin_end(vgrid, 4);
3344 gtk_widget_set_margin_top(vgrid, 4);
3345 gtk_widget_set_margin_bottom(vgrid, 4);
3353 gtk_widget_set_hexpand(
view,
TRUE);
3354 gtk_widget_set_vexpand(
view,
TRUE);
3357 rend = gtk_cell_renderer_text_new();
3358 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view),
3359 -1, NULL, rend,
"text", 0, NULL);
3364 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
3368 g_signal_connect(
view,
"row-activated",
3371 label = g_object_new(GTK_TYPE_LABEL,
3372 "use-underline",
TRUE,
3373 "mnemonic-widget",
view,
3374 "label",
_(
"Choose a _Scenario:"),
3378 gtk_grid_attach(GTK_GRID(vgrid), label, 0, grid_row++, 1, 1);
3380 sbox = gtk_grid_new();
3381 gtk_grid_set_column_spacing(GTK_GRID(sbox), 12);
3382 gtk_grid_set_row_homogeneous(GTK_GRID(sbox),
TRUE);
3383 gtk_orientable_set_orientation(GTK_ORIENTABLE(sbox),
3384 GTK_ORIENTATION_VERTICAL);
3385 gtk_grid_set_row_spacing(GTK_GRID(sbox), 2);
3386 gtk_grid_attach(GTK_GRID(vgrid), sbox, 0, grid_row++, 1, 1);
3388 hbox = gtk_grid_new();
3389 gtk_grid_set_column_homogeneous(GTK_GRID(hbox),
TRUE);
3390 gtk_grid_set_column_spacing(GTK_GRID(hbox), 12);
3392 sw = gtk_scrolled_window_new();
3393 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
3394 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC,
3395 GTK_POLICY_AUTOMATIC);
3396 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
3397 gtk_grid_attach(GTK_GRID(sbox), sw, 0, 0, 1, 2);
3399 text = gtk_text_view_new();
3400 gtk_widget_set_hexpand(text,
TRUE);
3401 gtk_widget_set_vexpand(text,
TRUE);
3402 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
3403 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2);
3404 gtk_text_view_set_editable(GTK_TEXT_VIEW(text),
FALSE);
3407 sw = gtk_scrolled_window_new();
3408 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
3409 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC,
3410 GTK_POLICY_AUTOMATIC);
3411 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), text);
3413 text = gtk_text_view_new();
3414 gtk_widget_set_hexpand(text,
TRUE);
3415 gtk_widget_set_vexpand(text,
TRUE);
3416 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
3417 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2);
3418 gtk_text_view_set_editable(GTK_TEXT_VIEW(text),
FALSE);
3421 swa = gtk_scrolled_window_new();
3422 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(swa),
TRUE);
3423 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swa), GTK_POLICY_AUTOMATIC,
3424 GTK_POLICY_AUTOMATIC);
3425 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(swa), text);
3427 text = gtk_label_new(
_(
"Filename:"));
3433 filenamebox = gtk_grid_new();
3434 gtk_grid_set_column_spacing(GTK_GRID(hbox), 12);
3435 gtk_widget_set_margin_bottom(filenamebox, 5);
3436 gtk_widget_set_margin_end(filenamebox, 5);
3437 gtk_widget_set_margin_start(filenamebox, 5);
3438 gtk_widget_set_margin_top(filenamebox, 5);
3440 gtk_grid_attach(GTK_GRID(filenamebox), text, filenamecol++, 0, 1, 1);
3442 filenamecol++, 0, 1, 1);
3445 vertext = gtk_label_new(
_(
"Format:"));
3451 versionbox = gtk_grid_new();
3452 gtk_grid_set_column_spacing(GTK_GRID(hbox), 12);
3453 gtk_widget_set_margin_bottom(versionbox, 5);
3454 gtk_widget_set_margin_end(versionbox, 5);
3455 gtk_widget_set_margin_start(versionbox, 5);
3456 gtk_widget_set_margin_top(versionbox, 5);
3458 gtk_grid_attach(GTK_GRID(versionbox), vertext, vercol++, 0, 1, 1);
3462 descbox = gtk_grid_new();
3463 gtk_orientable_set_orientation(GTK_ORIENTABLE(descbox),
3464 GTK_ORIENTATION_VERTICAL);
3465 gtk_grid_set_row_spacing(GTK_GRID(descbox), 6);
3466 gtk_grid_attach(GTK_GRID(descbox), sw, 0, descrow++, 1, 1);
3467 gtk_grid_attach(GTK_GRID(descbox), swa, 0, descrow++, 1, 1);
3468 gtk_grid_attach(GTK_GRID(descbox), filenamebox,
3469 0, descrow++, 1, 1);
3470 gtk_grid_attach(GTK_GRID(descbox), versionbox,
3471 0, descrow++, 1, 1);
3472 gtk_grid_attach(GTK_GRID(sbox), descbox, 1, 0, 1, 2);
3474 bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
3475 gtk_box_set_spacing(GTK_BOX(bbox), 12);
3476 gtk_grid_attach(GTK_GRID(vgrid), bbox, 0, grid_row++, 1, 1);
3478 button = gtk_button_new_with_mnemonic(
_(
"_Browse..."));
3479 gtk_box_append(GTK_BOX(bbox), button);
3480 g_signal_connect(button,
"clicked",
3483 button = gtk_button_new_with_mnemonic(
_(
"_Cancel"));
3484 gtk_box_append(GTK_BOX(bbox), button);
3485 g_signal_connect(button,
"clicked",
3488 button = gtk_button_new_with_mnemonic(
_(
"_OK"));
3489 gtk_box_append(GTK_BOX(bbox), button);
3490 g_signal_connect(button,
"clicked",
3518 log_debug(
"Switching client page from %s to %s.",
3520 client_pages_name(new_page));
3533 if (
vmode == NULL) {
3534 gtk_window_unmaximize(GTK_WINDOW(
toplevel));
3565 if (
vmode == NULL) {
3566 gtk_window_maximize(GTK_WINDOW(
toplevel));
3584 if (new_page == PAGE_START || new_page == PAGE_GAME) {
3591 gtk_notebook_set_current_page(GTK_NOTEBOOK(
toplevel_tabs), new_page);
3594 while (g_main_context_pending(NULL)) {
3595 g_main_context_iteration(NULL,
FALSE);
3645 static GtkWidget *
shell = NULL;
3647 if (NULL !=
shell) {
3656 gtk_window_present(GTK_WINDOW(
shell));
3680 static GtkWidget *
shell = NULL;
3682 if (NULL !=
shell) {
3691 gtk_window_present(GTK_WINDOW(
shell));
3709 static GtkWidget *
shell = NULL;
3711 if (NULL !=
shell) {
3720 gtk_window_present(GTK_WINDOW(
shell));
3733 _(
"Error Creating the Map Image!"), msg);
3747 gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(
ruleset_combo));
3748 for (i = 0; i < num_rulesets; i++) {
3750 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(
ruleset_combo), rulesets[i]);
3751 if (!strcmp(
"default", rulesets[i])) {
3759 gtk_combo_box_set_active(GTK_COMBO_BOX(
ruleset_combo), def_idx);
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite int int int width
#define SERVER_COMMAND_PREFIX_STR
int send_chat_printf(const char *format,...)
int send_chat(const char *message)
void output_window_append(const struct ft_color color, const char *featured_text)
bool can_client_control(void)
bool client_is_global_observer(void)
bool client_is_observer(void)
enum client_states client_state(void)
char fc_password[MAX_LEN_PASSWORD]
enum ai_level server_ai_level(void)
bool mapimg_client_createmap(const char *filename)
void center_on_something(void)
static struct fc_sockaddr_list * list
int connect_to_server(const char *username, const char *hostname, int port, char *errbuf, int errbufsize)
void disconnect_from_server(void)
void send_save_game(const char *filename)
void set_ruleset(const char *ruleset)
bool is_server_running(void)
bool client_start_server(void)
bool can_client_access_hack(void)
const char * conn_description(const struct connection *pconn)
struct connection * conn_by_number(int id)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
void fc_allocate_mutex(fc_mutex *mutex)
void fc_release_mutex(fc_mutex *mutex)
const struct ft_color ftc_client
static PangoLayout * layout
void inputline_toolkit_view_append_button(GtkWidget *toolkit_view, GtkWidget *button)
GtkWidget * inputline_toolkit_view_new(void)
void inputline_grab_focus(void)
void chatline_scroll_to_bottom(bool delayed)
void popup_races_dialog(struct player *pplayer)
const char * client_string
GtkTextBuffer * message_buffer
struct video_mode * resolution_request_get(void)
void enable_menus(bool enable)
void refresh_chat_buttons(void)
void add_idle_callback(void(callback)(void *), void *data)
void reset_unit_table(void)
static struct video_mode vmode
GtkWidget * toplevel_tabs
#define GUI_GTK_OPTION(optname)
void gtk_tree_view_focus(GtkTreeView *view)
void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text)
GtkTreeViewColumn * add_treeview_column(GtkWidget *view, const char *title, GType gtype, int model_index)
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
void mapview_freeze(void)
void overview_size_changed(void)
static struct gui_dialog * shell
void option_dialog_popup(const char *name, const struct option_set *poptset)
static GtkListStore * load_store
static void update_network_page(void)
void handle_game_load(bool load_successful, const char *filename)
GtkWidget * create_start_page(void)
GtkWidget * create_network_page(void)
static void client_aitoggle_player(void *data)
static GtkWidget * nation_button
static void update_server_list(enum server_scan_type sstype, const struct server_list *list)
static void start_scenario_callback(GtkWidget *w, gpointer data)
static GtkTreeSelection * scenario_selection
static void update_start_page_buttons(void)
static void save_dialog_response_callback(GtkWidget *w, gint response, gpointer data)
GtkWidget * create_scenario_page(void)
static void show_conn_popup(struct player *pplayer, struct connection *pconn)
static GtkWidget * network_confirm_password_label
void save_mapimg_dialog_popup(void)
static void ruleset_selected(const char *name)
static void ready_button_callback(GtkWidget *w, gpointer data)
static bool conn_list_selection(struct player **ppplayer, struct connection **ppconn)
static struct server_scan_timer_data meta_scan
static void update_network_lists(void)
static GtkWidget * statusbar
static GtkWidget * server_playerlist_view
static GtkListStore * save_dialog_store_new(void)
void append_network_statusbar(const char *text, bool force)
static gboolean update_network_statusbar(gpointer data)
void set_rulesets(int num_rulesets, char **rulesets)
void mapimg_client_save(const char *filename)
static void conn_menu_player_command(GObject *object, gpointer data)
static void load_filename(const char *filename)
static void conn_menu_nation_chosen(GObject *object, gpointer data)
static GtkWidget * scenario_description
void save_game_dialog_popup(void)
enum client_pages get_current_client_page(void)
static GtkListStore * lan_store
static enum connection_state connection_status
static struct server_scan_timer_data lan_scan
static void save_dialog_list_callback(GtkTreeSelection *selection, gpointer data)
static void connect_network_game_callback(GtkWidget *w, gpointer data)
static GtkTreeView * connection_list_view
static GtkWidget * network_login
static GtkWidget * network_login_label
static void connect_callback(GtkWidget *w, gpointer data)
static void scenario_browse_callback(GtkWidget *w, gpointer data)
static GtkListStore * meta_store
static void update_load_page(void)
static void save_dialog_update(struct save_dialog *pdialog)
static GtkWidget * scenario_authors
static GtkWidget * start_aifill_spin
static void ruleset_entry_changed(GtkWidget *w, gpointer data)
void(* save_dialog_action_fn_t)(const char *filename)
static void open_settings(void)
static void set_connection_state(enum connection_state state)
static GtkWidget * ruleset_combo
static void observe_button_callback(GtkWidget *w, gpointer data)
static void conn_menu_ready_chosen(GObject *object, gpointer data)
static void server_scan_error(struct server_scan *scan, const char *message)
static void load_callback(void)
static void save_dialog_file_chooser_callback(GtkWidget *widget, gint response, gpointer data)
static void network_list_callback(GtkTreeSelection *select, gpointer data)
static GtkListStore * server_playerlist_store
static void nation_button_callback(GtkWidget *w, gpointer data)
void real_set_client_page(enum client_pages new_page)
static void conn_menu_connection_command(GObject *object, gpointer data)
static void scenario_list_callback(void)
static gboolean intro_expose(GtkWidget *w, cairo_t *cr, gpointer *data)
static void load_browse_callback(GtkWidget *w, gpointer data)
static void network_activate_callback(GtkTreeView *view, GtkTreePath *arg1, GtkTreeViewColumn *arg2, gpointer data)
static struct fileinfo_list * save_dialog_scenario_list(void)
static void connection_state_reset(void)
void real_conn_list_dialog_update(void *unused)
static bool holding_srv_list_mutex
static GtkTreeStore * connection_list_store
static struct fileinfo_list * save_dialog_savegame_list(void)
static void start_new_game_callback(GtkWidget *w, gpointer data)
void destroy_server_scans(void)
void save_scenario_dialog_popup(void)
static GtkTreeSelection * lan_selection
static void save_dialog_save_scenario(const char *filename)
struct fileinfo_list *(* save_dialog_files_fn_t)(void)
static gboolean check_server_scan(gpointer data)
static void save_dialog_store_update(GtkListStore *store, const struct fileinfo_list *files)
static void ai_fill_changed_by_user(GtkWidget *w, gpointer data)
static gboolean delayed_unselect_path(gpointer data)
static void conn_menu_player_take(GObject *object, gpointer data)
static void conn_menu_info_chosen(GObject *object, gpointer data)
static bool model_get_player_iter(GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *start, const struct player *pplayer)
static GtkTreeSelection * load_selection
static void ai_skill_callback(GtkWidget *w, gpointer data)
static enum client_pages current_page
static GtkWidget * statusbar_frame
static GtkWidget * network_confirm_password
static void client_take_player(struct player *pplayer)
static void clear_network_statusbar(void)
static GtkTreeSelection * meta_selection
static void save_dialog_row_callback(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data)
static void connection_list_row_callback(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data)
GtkWidget * create_load_page(void)
static GtkWidget * ai_lvl_combobox
static GtkWidget * network_password_label
static GtkWidget * save_dialog_new(const char *title, const char *savelabel, const char *savefilelabel, save_dialog_action_fn_t action, save_dialog_files_fn_t files)
static void intro_free(GtkWidget *w, gpointer *data)
static GtkWidget * network_password
static GtkWidget * network_host
void handle_authentication_req(enum authentication_type type, const char *message)
static GtkTreeStore * connection_list_store_new(void)
static bool send_new_aifill_to_server
static void save_dialog_file_chooser_popup(const char *title, GtkFileChooserAction action, save_dialog_action_fn_t cb)
static GtkWidget * network_port
static void add_tree_col(GtkWidget *treeview, GType gtype, const char *title, int colnum, const char *key)
static void save_dialog_entry_callback(GtkEntry *entry, gpointer data)
static void main_callback(GtkWidget *w, gpointer data)
void update_start_page(void)
static void scenario_callback(void)
static GtkWidget * start_options_table
static bool no_ruleset_callback
void ai_fill_changed_by_server(int aifill)
static void update_server_playerlist(const struct server *pserver)
static GtkWidget * observe_button
static GtkWidget * scenario_version
GtkWidget * create_statusbar(void)
static void game_options_callback(GtkWidget *w, gpointer data)
static GtkListStore * scenario_store
static GtkWidget * network_host_label
static bool model_get_conn_iter(GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *parent, GtkTreeIter *start, const struct connection *pconn)
static GQueue * statusbar_queue
GtkWidget * start_message_area
static GtkWidget * network_port_label
static void update_scenario_page(void)
static GtkWidget * scenario_filename
static void conn_menu_team_chosen(GObject *object, gpointer data)
static GtkWidget * create_conn_menu(struct player *pplayer, struct connection *pconn)
static void load_saved_game_callback(GtkWidget *w, gpointer data)
static guint statusbar_timer
static bool object_extract(GObject *object, struct player **ppplayer, struct connection **ppconn)
static void object_put(GObject *object, struct player *pplayer, struct connection *pconn)
static struct fileinfo_list * save_dialog_mapimg_list(void)
GtkWidget * create_main_page(void)
static void conn_list_select_conn(struct connection *pconn)
static GtkWidget * ready_button
GdkPixbuf * create_player_icon(const struct player *plr)
GdkPixbuf * get_flag(const struct nation_type *nation)
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
void free_sprite(struct sprite *s)
struct sprite * sprite_scale(struct sprite *src, int new_w, int new_h)
struct sprite * load_gfxfile(const char *filename)
void voteinfo_gui_update(void)
GtkWidget * voteinfo_bar_new(bool split_bar)
GtkWidget * pregame_votebar
GtkWidget * icon_label_button_new(const gchar *icon_name, const gchar *label_text)
gboolean terminate_signal_processing(GtkEventControllerFocus *controller, gpointer data)
void animation_idle_cb(void *data)
void main_message_area_resize(void *data)
void widget_destroyed(GtkWidget *wdg, void *data)
#define menu_item_append_unref(menu, item)
static gboolean connect_list_right_button(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
void(* save_dialog_action_fn_t)(const char *filename)
struct fileinfo_list *(* save_dialog_files_fn_t)(void)
static void close_conn_menu_popover(void)
static gboolean connect_list_left_button(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static GtkWidget * conn_popover
static struct server_list * server_list
static enum client_pages old_page
void conn_list_dialog_update(void)
#define fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_error(message,...)
const char * mapimg_error(void)
const char * nation_adjective_for_player(const struct player *pplayer)
bool can_conn_edit_players_nation(const struct connection *pconn, const struct player *pplayer)
#define NO_NATION_SELECTED
const struct option_set * server_optset
const struct option_set * client_optset
int option_int_get(const struct option *poption)
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
bool option_int_set(struct option *poption, int val)
int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
int dsend_packet_save_scenario(struct connection *pc, const char *name)
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
void client_start_server_and_set_page(enum client_pages page)
void set_client_page(enum client_pages page)
enum client_pages get_client_page(void)
bool is_settable_ai_level(enum ai_level level)
struct player * player_by_number(const int player_id)
int player_slot_count(void)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
#define ai_level_cmd(_level_)
#define players_iterate_end
#define players_iterate(_pplayer)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
void secfile_destroy(struct section_file *secfile)
struct section_file * secfile_load_section(const char *filename, const char *section, bool allow_duplicates)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
struct srv_list * server_scan_get_list(struct server_scan *scan)
void server_scan_finish(struct server_scan *scan)
struct server_scan * server_scan_begin(enum server_scan_type type, ServerScanErrorFunc error_func)
enum server_scan_type server_scan_get_type(const struct server_scan *scan)
enum server_scan_status server_scan_poll(struct server_scan *scan)
#define server_list_iterate_end
#define server_list_iterate(serverlist, pserver)
struct setting_list * level[OLEVELS_NUM]
const struct strvec * get_scenario_dirs(void)
const struct strvec * get_save_dirs(void)
char * skip_to_basename(char *filepath)
struct fileinfo_list * fileinfolist_infix(const struct strvec *dirs, const char *infix, bool nodups)
#define fileinfo_list_iterate(list, pnode)
#define fileinfo_list_iterate_end
const char * aifill(int amount)
struct conn_list * est_connections
struct packet_game_info info
enum cmdlevel access_level
char username[MAX_LEN_NAME]
char password[MAX_LEN_PASSWORD]
save_dialog_action_fn_t action
save_dialog_files_fn_t files
struct server_scan * scan
struct server::players * players
cairo_surface_t * surface
struct server_list * servers
int fc_snprintf(char *str, size_t n, const char *format,...)
int cat_snprintf(char *str, size_t n, const char *format,...)
int fc_remove(const char *filename)
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
const char * team_name_translation(const struct team *pteam)
struct team * team_slot_get_team(const struct team_slot *tslot)
const char * team_slot_name_translation(const struct team_slot *tslot)
int team_number(const struct team *pteam)
int team_slot_index(const struct team_slot *tslot)
const struct player_list * team_members(const struct team *pteam)
bool team_slot_is_used(const struct team_slot *tslot)
const char * team_slot_rule_name(const struct team_slot *tslot)
#define team_slots_iterate_end
#define team_slots_iterate(_tslot)
const char * tileset_main_intro_filename(const struct tileset *t)
void update_queue_connect_processing_finished(int request_id, uq_callback_t callback, void *data)
const char * fc_git_revision(void)
const char * unstable_message(void)
const char * word_version(void)