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_widget_destroy), NULL);
271 notebook = gtk_notebook_new();
272 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
273 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
shell))), notebook);
276 table = gtk_grid_new();
277 g_object_set(table,
"margin", 6, NULL);
279 gtk_grid_set_row_spacing(GTK_GRID(table), 2);
280 gtk_grid_set_column_spacing(GTK_GRID(table), 12);
283 label = gtk_label_new_with_mnemonic(
_(
"_Overview"));
284 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
289 gtk_widget_set_halign(label, GTK_ALIGN_START);
290 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
291 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
293 label = gtk_label_new(NULL);
294 pdialog->table_labels[i] = label;
295 gtk_widget_set_halign(label, GTK_ALIGN_START);
296 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
297 gtk_grid_attach(GTK_GRID(table), label, 1, i, 1, 1);
299 pdialog->table_labels[i] = NULL;
304 pdialog->diplstates = gtk_tree_store_new(1, G_TYPE_STRING);
306 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
pdialog->diplstates));
307 g_object_set(
view,
"margin", 6, NULL);
310 g_object_unref(
pdialog->diplstates);
311 gtk_container_set_border_width(GTK_CONTAINER(
view), 6);
312 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
314 rend = gtk_cell_renderer_text_new();
315 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
317 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
319 gtk_tree_view_expand_all(GTK_TREE_VIEW(
view));
321 sw = gtk_scrolled_window_new(NULL,NULL);
322 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
323 GTK_SHADOW_ETCHED_IN);
324 gtk_container_add(GTK_CONTAINER(sw),
view);
326 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
327 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
329 label = gtk_label_new_with_mnemonic(
_(
"_Diplomacy"));
330 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
333 pdialog->techs = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING);
334 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(
pdialog->techs),
335 1, GTK_SORT_ASCENDING);
337 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
pdialog->techs));
338 g_object_set(
view,
"margin", 6, NULL);
341 g_object_unref(
pdialog->techs);
342 gtk_container_set_border_width(GTK_CONTAINER(
view), 6);
343 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
345 rend = gtk_cell_renderer_toggle_new();
346 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
348 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
350 rend = gtk_cell_renderer_text_new();
351 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
353 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
355 sw = gtk_scrolled_window_new(NULL,NULL);
356 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
357 GTK_SHADOW_ETCHED_IN);
358 gtk_container_add(GTK_CONTAINER(sw),
view);
360 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
361 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
363 label = gtk_label_new_with_mnemonic(
_(
"_Techs"));
364 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
366 gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
381 GtkCellRenderer *rend;
387 shell = gtk_dialog_new_with_buttons(NULL,
394 gtk_window_set_default_size(GTK_WINDOW(
shell), 350, 350);
396 gtk_dialog_set_default_response(GTK_DIALOG(
shell), GTK_RESPONSE_CLOSE);
398 g_signal_connect(
shell,
"destroy",
400 g_signal_connect(
shell,
"response",
401 G_CALLBACK(gtk_widget_destroy), NULL);
404 pdialog->
rule = gtk_label_new(
"-");
409 pdialog->
wonders = gtk_list_store_new(4, G_TYPE_STRING,
413 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(pdialog->
wonders),
414 3, GTK_SORT_DESCENDING);
415 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->
wonders));
416 g_object_set(
view,
"margin", 6, NULL);
419 g_object_unref(pdialog->
wonders);
420 gtk_container_set_border_width(GTK_CONTAINER(
view), 6);
421 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
423 rend = gtk_cell_renderer_text_new();
424 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
430 rend = gtk_cell_renderer_text_new();
431 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
435 sw = gtk_scrolled_window_new(NULL, NULL);
436 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
437 GTK_SHADOW_ETCHED_IN);
438 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
439 gtk_container_add(GTK_CONTAINER(box), pdialog->
rule);
440 gtk_container_add(GTK_CONTAINER(box),
view);
441 gtk_container_add(GTK_CONTAINER(sw), box);
443 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
444 GTK_POLICY_AUTOMATIC,
445 GTK_POLICY_AUTOMATIC);
447 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
shell))),
450 gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
466 const struct research *mresearch, *presearch;
467 GtkTreeIter diplstates[DS_LAST];
475 gchar *
title = g_strdup_printf(
_(
"Foreign Intelligence: %s Empire"),
477 gtk_window_set_title(GTK_WINDOW(pdialog->
shell),
title);
487 gtk_tree_store_append(pdialog->
diplstates, &it, NULL);
488 g_value_init(&v, G_TYPE_STRING);
489 g_value_set_static_string(&v, diplstate_type_translated_name(i));
490 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
500 if (other == p || !other->
is_alive) {
504 gtk_tree_store_append(pdialog->
diplstates, &it,
505 &diplstates[state->
type]);
506 g_value_init(&v, G_TYPE_STRING);
508 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
513 gtk_list_store_clear(pdialog->
techs);
521 gtk_list_store_append(pdialog->
techs, &it);
523 gtk_list_store_set(pdialog->
techs, &it,
542 buf = g_strdup(tbuf);
545 if (trade_knowledge) {
548 buf = g_strdup(
_(
"(Unknown)"));
557 if (trade_knowledge) {
560 buf = g_strdup(
_(
"(Unknown)"));
564 if (embassy_knowledge) {
567 buf = g_strdup(
_(
"(Unknown)"));
571 if (embassy_knowledge) {
574 buf = g_strdup(
_(
"(Unknown)"));
578 if (embassy_knowledge) {
581 buf = g_strdup(
_(
"(Unknown)"));
591 buf = g_strdup(
_(
"(Unknown)"));
594 if (embassy_knowledge) {
596 buf = g_strdup(
_(
"(none)"));
598 buf = g_strdup(
_(
"(Unknown)"));
602 buf = g_strdup_printf(
"%s(%d/%d)",
612 if (embassy_knowledge) {
615 buf = g_strdup(
_(
"(Unknown)"));
621 gtk_label_set_text(GTK_LABEL(pdialog->
table_labels[i]), buf);