246 GtkWidget *
shell, *notebook, *label, *sw, *
view, *table;
247 GtkCellRenderer *rend;
248 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);
403 pdialog->
rule = gtk_label_new(
"-");
408 pdialog->
wonders = gtk_list_store_new(4, G_TYPE_STRING,
412 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(pdialog->
wonders),
413 3, GTK_SORT_DESCENDING);
414 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->
wonders));
415 g_object_set(
view,
"margin", 6, NULL);
418 g_object_unref(pdialog->
wonders);
419 gtk_container_set_border_width(GTK_CONTAINER(
view), 6);
420 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
422 rend = gtk_cell_renderer_text_new();
423 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
429 rend = gtk_cell_renderer_text_new();
430 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(
view), -1, NULL,
434 sw = gtk_scrolled_window_new(NULL, NULL);
435 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
436 GTK_SHADOW_ETCHED_IN);
437 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
438 gtk_container_add(GTK_CONTAINER(box), pdialog->
rule);
439 gtk_container_add(GTK_CONTAINER(box),
view);
440 gtk_container_add(GTK_CONTAINER(sw), box);
442 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
443 GTK_POLICY_AUTOMATIC,
444 GTK_POLICY_AUTOMATIC);
446 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
shell))),
449 gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(
shell)));
465 const struct research *mresearch, *presearch;
466 GtkTreeIter diplstates[DS_LAST];
474 gchar *
title = g_strdup_printf(
_(
"Foreign Intelligence: %s Empire"),
476 gtk_window_set_title(GTK_WINDOW(pdialog->
shell),
title);
486 gtk_tree_store_append(pdialog->
diplstates, &it, NULL);
487 g_value_init(&v, G_TYPE_STRING);
488 g_value_set_static_string(&v, diplstate_type_translated_name(i));
489 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
499 if (other == p || !other->
is_alive) {
503 gtk_tree_store_append(pdialog->
diplstates, &it,
504 &diplstates[state->
type]);
505 g_value_init(&v, G_TYPE_STRING);
507 gtk_tree_store_set_value(pdialog->
diplstates, &it, 0, &v);
512 gtk_list_store_clear(pdialog->
techs);
520 gtk_list_store_append(pdialog->
techs, &it);
522 gtk_list_store_set(pdialog->
techs, &it,
541 buf = g_strdup(tbuf);
544 if (trade_knowledge) {
547 buf = g_strdup(
_(
"(Unknown)"));
556 if (trade_knowledge) {
559 buf = g_strdup(
_(
"(Unknown)"));
563 if (embassy_knowledge) {
566 buf = g_strdup(
_(
"(Unknown)"));
570 if (embassy_knowledge) {
573 buf = g_strdup(
_(
"(Unknown)"));
577 if (embassy_knowledge) {
580 buf = g_strdup(
_(
"(Unknown)"));
590 buf = g_strdup(
_(
"(Unknown)"));
593 if (embassy_knowledge) {
595 buf = g_strdup(
_(
"(none)"));
597 buf = g_strdup(
_(
"(Unknown)"));
601 buf = g_strdup_printf(
"%s(%d/%d)",
611 if (embassy_knowledge) {
614 buf = g_strdup(
_(
"(Unknown)"));
620 gtk_label_set_text(GTK_LABEL(pdialog->
table_labels[i]), buf);