247 GtkWidget *
shell, *notebook, *label, *sw, *
view, *table;
248 GtkCellRenderer *rend;
249 GtkTreeViewColumn *col;
255 shell = gtk_dialog_new_with_buttons(NULL,
262 gtk_window_set_default_size(GTK_WINDOW(
shell), 350, 350);
264 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_CLOSE);
266 g_signal_connect(
shell,
"destroy",
268 g_signal_connect(
shell,
"response",
269 G_CALLBACK(gtk_window_destroy), NULL);
271 notebook = gtk_notebook_new();
272 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
273 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
shell))), notebook);
276 table = gtk_grid_new();
277 gtk_widget_set_margin_bottom(table, 6);
278 gtk_widget_set_margin_end(table, 6);
279 gtk_widget_set_margin_start(table, 6);
280 gtk_widget_set_margin_top(table, 6);
282 gtk_grid_set_row_spacing(GTK_GRID(table), 2);
283 gtk_grid_set_column_spacing(GTK_GRID(table), 12);
286 label = gtk_label_new_with_mnemonic(
_(
"_Overview"));
287 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
292 gtk_widget_set_halign(label, GTK_ALIGN_START);
293 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
294 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
296 label = gtk_label_new(NULL);
297 pdialog->table_labels[i] = label;
298 gtk_widget_set_halign(label, GTK_ALIGN_START);
299 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
300 gtk_grid_attach(GTK_GRID(table), label, 1, i, 1, 1);
302 pdialog->table_labels[i] = NULL;
307 pdialog->diplstates = gtk_tree_store_new(1, G_TYPE_STRING);
309 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
pdialog->diplstates));
310 gtk_widget_set_margin_bottom(
view, 6);
311 gtk_widget_set_margin_end(
view, 6);
312 gtk_widget_set_margin_start(
view, 6);
313 gtk_widget_set_margin_top(
view, 6);
316 g_object_unref(
pdialog->diplstates);
317 gtk_widget_set_margin_start(
view, 6);
318 gtk_widget_set_margin_end(
view, 6);
319 gtk_widget_set_margin_top(
view, 6);
320 gtk_widget_set_margin_bottom(
view, 6);
321 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
323 rend = gtk_cell_renderer_text_new();
324 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
326 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
328 gtk_tree_view_expand_all(GTK_TREE_VIEW(
view));
330 sw = gtk_scrolled_window_new();
331 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
332 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
334 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
335 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
337 label = gtk_label_new_with_mnemonic(
_(
"_Diplomacy"));
338 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
341 pdialog->techs = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING);
342 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(
pdialog->techs),
343 1, GTK_SORT_ASCENDING);
345 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
pdialog->techs));
346 gtk_widget_set_margin_bottom(
view, 6);
347 gtk_widget_set_margin_end(
view, 6);
348 gtk_widget_set_margin_start(
view, 6);
349 gtk_widget_set_margin_top(
view, 6);
352 g_object_unref(
pdialog->techs);
353 gtk_widget_set_margin_start(
view, 6);
354 gtk_widget_set_margin_end(
view, 6);
355 gtk_widget_set_margin_top(
view, 6);
356 gtk_widget_set_margin_bottom(
view, 6);
357 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
359 rend = gtk_cell_renderer_toggle_new();
360 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
362 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
364 rend = gtk_cell_renderer_text_new();
365 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
367 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
369 sw = gtk_scrolled_window_new();
370 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
371 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
373 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
374 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
376 label = gtk_label_new_with_mnemonic(
_(
"_Techs"));
377 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
379 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
394 GtkCellRenderer *rend;
400 shell = gtk_dialog_new_with_buttons(NULL,
407 gtk_window_set_default_size(GTK_WINDOW(
shell), 350, 350);
409 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_CLOSE);
411 g_signal_connect(
shell,
"destroy",
413 g_signal_connect(
shell,
"response",
414 G_CALLBACK(gtk_window_destroy), NULL);
417 pdialog->
rule = gtk_label_new(
"-");
422 pdialog->
wonders = gtk_list_store_new(4, G_TYPE_STRING,
426 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(pdialog->
wonders),
427 3, GTK_SORT_DESCENDING);
428 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->
wonders));
429 gtk_widget_set_margin_bottom(
view, 6);
430 gtk_widget_set_margin_end(
view, 6);
431 gtk_widget_set_margin_start(
view, 6);
432 gtk_widget_set_margin_top(
view, 6);
435 g_object_unref(pdialog->
wonders);
436 gtk_widget_set_margin_start(
view, 6);
437 gtk_widget_set_margin_end(
view, 6);
438 gtk_widget_set_margin_top(
view, 6);
439 gtk_widget_set_margin_bottom(
view, 6);
440 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
442 rend = gtk_cell_renderer_text_new();
443 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
449 rend = gtk_cell_renderer_text_new();
450 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
454 sw = gtk_scrolled_window_new();
455 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
456 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
457 gtk_box_append(GTK_BOX(box), pdialog->
rule);
458 gtk_box_append(GTK_BOX(box),
view);
459 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), box);
461 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
462 GTK_POLICY_AUTOMATIC,
463 GTK_POLICY_AUTOMATIC);
465 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
shell))), sw);
467 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
483 const struct research *mresearch, *presearch;
484 GtkTreeIter diplstates[DS_LAST];
492 gchar *
title = g_strdup_printf(
_(
"Foreign Intelligence: %s Empire"),
494 gtk_window_set_title(GTK_WINDOW(pdialog->
shell),
title);
504 gtk_tree_store_append(pdialog->
diplstates, &it, NULL);
505 g_value_init(&v, G_TYPE_STRING);
506 g_value_set_static_string(&v, diplstate_type_translated_name(i));
507 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
517 if (other == p || !other->
is_alive) {
521 gtk_tree_store_append(pdialog->
diplstates, &it,
522 &diplstates[state->
type]);
523 g_value_init(&v, G_TYPE_STRING);
525 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
530 gtk_list_store_clear(pdialog->
techs);
538 gtk_list_store_append(pdialog->
techs, &it);
540 gtk_list_store_set(pdialog->
techs, &it,
559 buf = g_strdup(tbuf);
562 if (trade_knowledge) {
565 buf = g_strdup(
_(
"(Unknown)"));
574 if (trade_knowledge) {
577 buf = g_strdup(
_(
"(Unknown)"));
581 if (embassy_knowledge) {
584 buf = g_strdup(
_(
"(Unknown)"));
588 if (embassy_knowledge) {
591 buf = g_strdup(
_(
"(Unknown)"));
595 if (embassy_knowledge) {
598 buf = g_strdup(
_(
"(Unknown)"));
608 buf = g_strdup(
_(
"(Unknown)"));
611 if (embassy_knowledge) {
613 buf = g_strdup(
_(
"(none)"));
615 buf = g_strdup(
_(
"(Unknown)"));
619 buf = g_strdup_printf(
"%s(%d/%d)",
629 if (embassy_knowledge) {
632 buf = g_strdup(
_(
"(Unknown)"));
638 gtk_label_set_text(GTK_LABEL(pdialog->
table_labels[i]), buf);