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;
341 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
342 g_object_set_data(G_OBJECT(
item),
"player_from",
344 g_object_set_data(G_OBJECT(
item),
"player_to",
346 g_signal_connect(
item,
"activate",
351 gtk_menu_item_set_submenu(GTK_MENU_ITEM(advance_item), menu);
352 g_list_free(sorting_list);
355 gtk_widget_show_all(advance_item);
370 int n = city_list_size(pgiver->
cities);
372 menu = gtk_menu_new();
375 struct city **city_list_ptrs;
381 city_list_ptrs[i] = pcity;
391 for (j = 0; j < i; j++) {
398 deal->
id = city_list_ptrs[j]->
id;
400 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
401 g_signal_connect(
item,
"activate",
407 free(city_list_ptrs);
410 item = gtk_menu_item_new_with_mnemonic(
_(
"_Cities"));
411 gtk_widget_set_sensitive(
item, (i > 0));
412 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item), menu);
413 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
414 gtk_widget_show_all(
item);
419 item = gtk_menu_item_new_with_mnemonic(
_(
"_Give shared vision"));
420 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
421 g_signal_connect(
item,
"activate",
427 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
428 gtk_widget_show(
item);
433 item = gtk_menu_item_new_with_mnemonic(
_(
"Give _embassy"));
434 g_object_set_data(G_OBJECT(
item),
"plr", pgiver);
435 g_signal_connect(
item,
"activate",
442 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
443 gtk_widget_show(
item);
448 enum diplstate_type ds;
449 int pact_clauses = 0;
453 menu = gtk_menu_new();
456 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Cease-fire"));
457 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
458 g_signal_connect(
item,
"activate",
460 gtk_widget_set_sensitive(
item, ds != DS_CEASEFIRE && ds != DS_TEAM);
465 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Peace"));
466 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
467 g_signal_connect(
item,
"activate",
469 gtk_widget_set_sensitive(
item, ds != DS_PEACE && ds != DS_TEAM);
474 item = gtk_menu_item_new_with_mnemonic(
Q_(
"?diplomatic_state:Alliance"));
475 gtk_menu_shell_append(GTK_MENU_SHELL(menu),
item);
476 g_signal_connect(
item,
"activate",
478 gtk_widget_set_sensitive(
item, ds != DS_ALLIANCE && ds != DS_TEAM);
482 if (pact_clauses > 0) {
483 item = gtk_menu_item_new_with_mnemonic(
_(
"_Pacts"));
484 gtk_menu_item_set_submenu(GTK_MENU_ITEM(
item), menu);
485 gtk_menu_shell_append(GTK_MENU_SHELL(parent),
item);
486 gtk_widget_show_all(
item);
488 g_object_unref(menu);
674 GtkWidget *vbox, *hbox, *table, *mainbox;
675 GtkWidget *label, *sw, *
view, *image, *spin;
676 GtkWidget *menubar, *menuitem, *menu, *
notebook;
679 GtkCellRenderer *rend;
694 buf = g_strdup_printf(
_(
"Diplomacy [%d]"), dialog_list_size(
dialog_list));
704 _(
"Accept treaty"), GTK_RESPONSE_ACCEPT);
717 for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); i++) {
719 = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
721 = g_object_get_data(G_OBJECT(prev_page),
"gui-dialog-data");
722 const char *prev_label
723 = gtk_label_get_text(GTK_LABEL(prev_dialog->
v.
tab.
label));
726 gtk_notebook_reorder_child(GTK_NOTEBOOK(
notebook),
737 vbox = gtk_grid_new();
738 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
739 GTK_ORIENTATION_VERTICAL);
740 gtk_grid_set_row_spacing(GTK_GRID(
vbox), 5);
741 gtk_container_set_border_width(GTK_CONTAINER(
vbox), 2);
742 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
745 label = gtk_label_new(NULL);
746 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
747 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
748 buf = g_strdup_printf(
"<span size=\"large\"><u>%s</u></span>",
750 gtk_label_set_markup(GTK_LABEL(
label), buf);
752 gtk_container_add(GTK_CONTAINER(
vbox),
label);
754 hbox = gtk_grid_new();
755 gtk_grid_set_column_spacing(GTK_GRID(hbox), 5);
756 gtk_container_add(GTK_CONTAINER(
vbox), hbox);
761 image = gtk_image_new_from_surface(flag_spr->
surface);
762 gtk_container_add(GTK_CONTAINER(hbox), image);
765 label = gtk_label_new(NULL);
767 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
768 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
769 buf = g_strdup_printf(
"<span size=\"large\" weight=\"bold\">%s</span>",
771 gtk_label_set_markup(GTK_LABEL(
label), buf);
773 gtk_container_add(GTK_CONTAINER(hbox),
label);
775 image = gtk_image_new();
777 gtk_container_add(GTK_CONTAINER(hbox), image);
782 menu = gtk_menu_new();
783 pdialog->
menu0 = menu;
785 menuitem = gtk_image_menu_item_new_with_label(
_(
"Add Clause..."));
786 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
787 gtk_image_new_from_stock(GTK_STOCK_ADD,
788 GTK_ICON_SIZE_MENU));
789 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
790 gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
791 g_object_set_data(G_OBJECT(menu),
"plr", plr0);
792 g_signal_connect(menu,
"show", G_CALLBACK(
popup_add_menu), pdialog);
795 table = gtk_grid_new();
796 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
797 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
798 gtk_grid_set_column_spacing(GTK_GRID(table), 16);
799 gtk_container_add(GTK_CONTAINER(
vbox), table);
802 spin = gtk_spin_button_new_with_range(0.0, plr0->
economic.
gold + 0.1,
804 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
805 gtk_entry_set_width_chars(GTK_ENTRY(spin), 16);
806 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
807 g_object_set_data(G_OBJECT(spin),
"plr", plr0);
808 g_signal_connect_after(spin,
"value-changed",
811 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
812 "mnemonic-widget", spin,
"label",
_(
"Gold:"),
813 "xalign", 0.0,
"yalign", 0.5, NULL);
814 gtk_grid_attach(GTK_GRID(table),
label, 0, 0, 1, 1);
816 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
818 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
822 vbox = gtk_grid_new();
823 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
824 GTK_ORIENTATION_VERTICAL);
825 gtk_grid_set_row_spacing(GTK_GRID(
vbox), 5);
826 gtk_container_set_border_width(GTK_CONTAINER(
vbox), 2);
827 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
830 label = gtk_label_new(NULL);
831 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
832 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
833 buf = g_strdup_printf(
"<span size=\"large\"><u>%s</u></span>",
835 gtk_label_set_markup(GTK_LABEL(
label), buf);
837 gtk_container_add(GTK_CONTAINER(
vbox),
label);
839 hbox = gtk_grid_new();
840 gtk_grid_set_column_spacing(GTK_GRID(hbox), 5);
841 gtk_container_add(GTK_CONTAINER(
vbox), hbox);
846 image = gtk_image_new_from_surface(flag_spr->
surface);
847 gtk_container_add(GTK_CONTAINER(hbox), image);
850 label = gtk_label_new(NULL);
852 gtk_widget_set_halign(
label, GTK_ALIGN_CENTER);
853 gtk_widget_set_valign(
label, GTK_ALIGN_CENTER);
854 buf = g_strdup_printf(
"<span size=\"large\" weight=\"bold\">%s</span>",
856 gtk_label_set_markup(GTK_LABEL(
label), buf);
858 gtk_container_add(GTK_CONTAINER(hbox),
label);
860 image = gtk_image_new();
862 gtk_container_add(GTK_CONTAINER(hbox), image);
867 menu = gtk_menu_new();
868 pdialog->
menu1 = menu;
870 menuitem = gtk_image_menu_item_new_with_label(
_(
"Add Clause..."));
871 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
872 gtk_image_new_from_stock(GTK_STOCK_ADD,
873 GTK_ICON_SIZE_MENU));
874 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
875 gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menuitem);
876 g_object_set_data(G_OBJECT(menu),
"plr", plr1);
877 g_signal_connect(menu,
"show", G_CALLBACK(
popup_add_menu), pdialog);
880 table = gtk_grid_new();
881 gtk_widget_set_halign(table, GTK_ALIGN_CENTER);
882 gtk_widget_set_valign(table, GTK_ALIGN_CENTER);
883 gtk_grid_set_column_spacing(GTK_GRID(table), 16);
884 gtk_container_add(GTK_CONTAINER(
vbox), table);
887 spin = gtk_spin_button_new_with_range(0.0, plr1->
economic.
gold + 0.1,
889 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
890 gtk_entry_set_width_chars(GTK_ENTRY(spin), 16);
891 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
892 g_object_set_data(G_OBJECT(spin),
"plr", plr1);
893 g_signal_connect_after(spin,
"value-changed",
896 label = g_object_new(GTK_TYPE_LABEL,
"use-underline",
TRUE,
897 "mnemonic-widget", spin,
"label",
_(
"Gold:"),
898 "xalign", 0.0,
"yalign", 0.5, NULL);
899 gtk_grid_attach(GTK_GRID(table),
label, 0, 0, 1, 1);
901 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
903 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
907 mainbox = gtk_grid_new();
908 gtk_orientable_set_orientation(GTK_ORIENTABLE(mainbox),
909 GTK_ORIENTATION_VERTICAL);
910 gtk_container_add(GTK_CONTAINER(pdialog->
dialog->
vbox), mainbox);
912 store = gtk_list_store_new(1, G_TYPE_STRING);
913 pdialog->
store = store;
915 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
918 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
919 g_object_unref(store);
920 gtk_widget_set_size_request(
view, 320, 100);
922 rend = gtk_cell_renderer_text_new();
923 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
924 rend,
"text", 0, NULL);
926 sw = gtk_scrolled_window_new(NULL, NULL);
927 g_object_set(sw,
"margin", 2, NULL);
928 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
929 GTK_SHADOW_ETCHED_IN);
930 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
931 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
932 gtk_container_add(GTK_CONTAINER(sw),
view);
934 label = g_object_new(GTK_TYPE_LABEL,
935 "use-underline",
TRUE,
936 "mnemonic-widget",
view,
937 "label",
_(
"C_lauses:"),
942 vbox = gtk_grid_new();
943 gtk_orientable_set_orientation(GTK_ORIENTABLE(
vbox),
944 GTK_ORIENTATION_VERTICAL);
945 gtk_container_add(GTK_CONTAINER(mainbox),
vbox);
946 gtk_container_add(GTK_CONTAINER(
vbox),
label);
947 gtk_container_add(GTK_CONTAINER(
vbox), sw);
949 gtk_widget_show_all(mainbox);