242 struct player *pgiver, *pother;
243 GtkWidget *
item, *menu;
244 bool any_map =
FALSE;
247 gtk_container_foreach(GTK_CONTAINER(parent),
248 (GtkCallback) gtk_widget_destroy, NULL);
251 pgiver = (
struct player *) g_object_get_data(G_OBJECT(parent),
"plr");
258 menu = gtk_menu_new();
260 item = gtk_menu_item_new_with_mnemonic(
_(
"World-map"));
261 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
262 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
263 g_signal_connect(
item,
"activate",
270 menu = gtk_menu_new();
273 item = gtk_menu_item_new_with_mnemonic(
_(
"Sea-map"));
274 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
275 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
276 g_signal_connect(
item,
"activate",
282 item = gtk_menu_item_new_with_mnemonic(
_(
"_Maps"));
283 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item), menu);
284 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
285 gtk_widget_show_all(
item);
292 GtkWidget *advance_item;
293 GList *sorting_list = NULL;
296 advance_item = gtk_menu_item_new_with_mnemonic(
_(
"_Advances"));
297 gtk_menu_shell_append(GTK_MENU_SHELL(parent), advance_item);
308 == TECH_PREREQS_KNOWN)) {
309 sorting_list = g_list_prepend(sorting_list, padvance);
313 if (NULL == sorting_list) {
315 gtk_widget_set_sensitive(advance_item,
FALSE);
318 const struct advance *padvance;
321 menu = gtk_menu_new();
324 item = gtk_menu_item_new_with_label(
_(
"All advances"));
325 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
326 g_object_set_data(G_OBJECT(
item),
"player_from",
328 g_object_set_data(G_OBJECT(
item),
"player_to",
330 g_signal_connect(
item,
"activate",
333 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
334 gtk_separator_menu_item_new());
336 for (list_item = sorting_list; NULL != list_item;
337 list_item = g_list_next(list_item)) {
338 padvance = (
const struct advance *) list_item->data;
340 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
341 g_object_set_data(G_OBJECT(
item),
"player_from",
343 g_object_set_data(G_OBJECT(
item),
"player_to",
345 g_signal_connect(
item,
"activate",
350 gtk_menu_item_set_submenu(GTK_MENU_ITEM(advance_item), menu);
351 g_list_free(sorting_list);
354 gtk_widget_show_all(advance_item);
368 int n = city_list_size(pgiver->
cities);
370 menu = gtk_menu_new();
373 struct city **city_list_ptrs;
379 city_list_ptrs[i] = pcity;
389 for (j = 0; j < i; j++) {
396 deal->
id = city_list_ptrs[j]->
id;
398 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
399 g_signal_connect(
item,
"activate",
405 free(city_list_ptrs);
408 item = gtk_menu_item_new_with_mnemonic(
_(
"_Cities"));
409 gtk_widget_set_sensitive(
item, (i > 0));
410 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item), menu);
411 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
412 gtk_widget_show_all(
item);
417 item = gtk_menu_item_new_with_mnemonic(
_(
"_Give shared vision"));
418 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
419 g_signal_connect(
item,
"activate",
425 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
426 gtk_widget_show(
item);
431 item = gtk_menu_item_new_with_mnemonic(
_(
"Give _embassy"));
432 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
433 g_signal_connect(
item,
"activate",
440 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
441 gtk_widget_show(
item);
446 enum diplstate_type ds;
447 int pact_clauses = 0;
451 menu = gtk_menu_new();
454 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Cease-fire"));
455 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
456 g_signal_connect(
item,
"activate",
458 gtk_widget_set_sensitive(
item, ds != DS_CEASEFIRE && ds != DS_TEAM);
463 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Peace"));
464 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
465 g_signal_connect(
item,
"activate",
467 gtk_widget_set_sensitive(
item, ds != DS_PEACE && ds != DS_TEAM);
472 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Alliance"));
473 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
474 g_signal_connect(
item,
"activate",
476 gtk_widget_set_sensitive(
item, ds != DS_ALLIANCE && ds != DS_TEAM);
480 if (pact_clauses > 0) {
481 item = gtk_menu_item_new_with_mnemonic(
_(
"_Pacts"));
482 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item), menu);
483 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
484 gtk_widget_show_all(
item);
486 g_object_unref(menu);
672 GtkWidget *vbox, *hbox, *table, *mainbox;
673 GtkWidget *label, *sw, *
view, *image, *spin;
674 GtkWidget *menubar, *menuitem, *menu, *
notebook;
677 GtkCellRenderer *rend;
692 buf = g_strdup_printf(
_(
"Diplomacy [%d]"), dialog_list_size(
dialog_list));
702 _(
"Accept treaty"), GTK_RESPONSE_ACCEPT);
715 for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); i++) {
717 = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
719 = g_object_get_data(G_OBJECT(prev_page),
"gui-dialog-data");
720 const char *prev_label
721 = gtk_label_get_text(GTK_LABEL(prev_dialog->
v.
tab.
label));
724 gtk_notebook_reorder_child(GTK_NOTEBOOK(
notebook),
735 vbox = gtk_grid_new();
736 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
737 GTK_ORIENTATION_VERTICAL);
738 gtk_grid_set_row_spacing(GTK_GRID(
vbox), 5);
739 gtk_container_set_border_width(GTK_CONTAINER(
vbox), 2);
740 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
743 label = gtk_label_new(NULL);
744 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
745 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
746 buf = g_strdup_printf(
"<span size=\"large\"><u>%s</u></span>",
748 gtk_label_set_markup(GTK_LABEL(
label), buf);
750 gtk_container_add(GTK_CONTAINER(
vbox),
label);
752 hbox = gtk_grid_new();
753 gtk_grid_set_column_spacing(GTK_GRID(hbox), 5);
754 gtk_container_add(GTK_CONTAINER(
vbox), hbox);
759 image = gtk_image_new_from_surface(flag_spr->
surface);
760 gtk_container_add(GTK_CONTAINER(hbox), image);
763 label = gtk_label_new(NULL);
765 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
766 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
767 buf = g_strdup_printf(
"<span size=\"large\" weight=\"bold\">%s</span>",
769 gtk_label_set_markup(GTK_LABEL(
label), buf);
771 gtk_container_add(GTK_CONTAINER(hbox),
label);
773 image = gtk_image_new();
775 gtk_container_add(GTK_CONTAINER(hbox), image);
780 menu = gtk_menu_new();
781 pdialog->
menu0 = menu;
783 menuitem = gtk_menu_item_new_with_label(
_(
"Add Clause..."));
784 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
785 gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
786 g_object_set_data(G_OBJECT(menu),
"plr", plr0);
787 g_signal_connect(menu,
"show", G_CALLBACK(
popup_add_menu), pdialog);
790 table = gtk_grid_new();
791 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
792 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
793 gtk_grid_set_column_spacing(GTK_GRID(table), 16);
794 gtk_container_add(GTK_CONTAINER(
vbox), table);
797 spin = gtk_spin_button_new_with_range(0.0, plr0->
economic.
gold + 0.1,
799 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
800 gtk_entry_set_width_chars(GTK_ENTRY(spin), 16);
801 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
802 g_object_set_data(G_OBJECT(spin),
"plr", plr0);
803 g_signal_connect_after(spin,
"value-changed",
806 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
807 "mnemonic-widget", spin,
"label",
_(
"Gold:"),
808 "xalign", 0.0,
"yalign", 0.5, NULL);
809 gtk_grid_attach(GTK_GRID(table),
label, 0, 0, 1, 1);
811 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
813 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
817 vbox = gtk_grid_new();
818 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
819 GTK_ORIENTATION_VERTICAL);
820 gtk_grid_set_row_spacing(GTK_GRID(
vbox), 5);
821 gtk_container_set_border_width(GTK_CONTAINER(
vbox), 2);
822 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
825 label = gtk_label_new(NULL);
826 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
827 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
828 buf = g_strdup_printf(
"<span size=\"large\"><u>%s</u></span>",
830 gtk_label_set_markup(GTK_LABEL(
label), buf);
832 gtk_container_add(GTK_CONTAINER(
vbox),
label);
834 hbox = gtk_grid_new();
835 gtk_grid_set_column_spacing(GTK_GRID(hbox), 5);
836 gtk_container_add(GTK_CONTAINER(
vbox), hbox);
841 image = gtk_image_new_from_surface(flag_spr->
surface);
842 gtk_container_add(GTK_CONTAINER(hbox), image);
845 label = gtk_label_new(NULL);
847 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
848 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
849 buf = g_strdup_printf(
"<span size=\"large\" weight=\"bold\">%s</span>",
851 gtk_label_set_markup(GTK_LABEL(
label), buf);
853 gtk_container_add(GTK_CONTAINER(hbox),
label);
855 image = gtk_image_new();
857 gtk_container_add(GTK_CONTAINER(hbox), image);
862 menu = gtk_menu_new();
863 pdialog->
menu1 = menu;
865 menuitem = gtk_menu_item_new_with_label(
_(
"Add Clause..."));
866 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
867 gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
868 g_object_set_data(G_OBJECT(menu),
"plr", plr1);
869 g_signal_connect(menu,
"show", G_CALLBACK(
popup_add_menu), pdialog);
872 table = gtk_grid_new();
873 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
874 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
875 gtk_grid_set_column_spacing(GTK_GRID(table), 16);
876 gtk_container_add(GTK_CONTAINER(
vbox), table);
879 spin = gtk_spin_button_new_with_range(0.0, plr1->
economic.
gold + 0.1,
881 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
882 gtk_entry_set_width_chars(GTK_ENTRY(spin), 16);
883 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
884 g_object_set_data(G_OBJECT(spin),
"plr", plr1);
885 g_signal_connect_after(spin,
"value-changed",
888 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
889 "mnemonic-widget", spin,
"label",
_(
"Gold:"),
890 "xalign", 0.0,
"yalign", 0.5, NULL);
891 gtk_grid_attach(GTK_GRID(table),
label, 0, 0, 1, 1);
893 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
895 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
899 mainbox = gtk_grid_new();
900 gtk_orientable_set_orientation(GTK_ORIENTABLE(mainbox),
901 GTK_ORIENTATION_VERTICAL);
902 gtk_container_add(GTK_CONTAINER(pdialog->
dialog->
vbox), mainbox);
904 store = gtk_list_store_new(1, G_TYPE_STRING);
905 pdialog->
store = store;
907 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
910 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
911 g_object_unref(store);
912 gtk_widget_set_size_request(
view, 320, 100);
914 rend = gtk_cell_renderer_text_new();
915 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
916 rend,
"text", 0, NULL);
918 sw = gtk_scrolled_window_new(NULL, NULL);
919 g_object_set(sw,
"margin", 2, NULL);
920 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
921 GTK_SHADOW_ETCHED_IN);
922 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
923 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
924 gtk_container_add(GTK_CONTAINER(sw),
view);
926 label = g_object_new(GTK_TYPE_LABEL,
927 "use-underline",
TRUE,
928 "mnemonic-widget",
view,
929 "label",
_(
"C_lauses:"),
934 vbox = gtk_grid_new();
935 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
936 GTK_ORIENTATION_VERTICAL);
937 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
938 gtk_container_add(GTK_CONTAINER(
vbox),
label);
939 gtk_container_add(GTK_CONTAINER(
vbox), sw);
941 gtk_widget_show_all(mainbox);