void monopoly_create_dlg(void) { GtkWidget *dlg_vbox; GtkWidget *vbox; GtkWidget *lbl; GSList *monop_grp = NULL; if (monop_dlg != NULL) { gtk_window_present(GTK_WINDOW(monop_dlg)); return; }; /* Dialog caption */ monop_dlg = gtk_dialog_new_with_buttons(_("Monopoly"), GTK_WINDOW(app_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_signal_connect(G_OBJECT(monop_dlg), "destroy", G_CALLBACK(gtk_widget_destroyed), &monop_dlg); gtk_widget_realize(monop_dlg); /* Disable close */ gdk_window_set_functions(monop_dlg->window, GDK_FUNC_ALL | GDK_FUNC_CLOSE); dlg_vbox = GTK_DIALOG(monop_dlg)->vbox; gtk_widget_show(dlg_vbox); vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); /* Label */ lbl = gtk_label_new(_("Select the resource you wish to " "monopolize.")); gtk_widget_show(lbl); gtk_box_pack_start(GTK_BOX(vbox), lbl, TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(lbl), 0, 0.5); monop_grp = add_resource_btn(vbox, monop_grp, BRICK_RESOURCE); monop_grp = add_resource_btn(vbox, monop_grp, GRAIN_RESOURCE); monop_grp = add_resource_btn(vbox, monop_grp, ORE_RESOURCE); monop_grp = add_resource_btn(vbox, monop_grp, WOOL_RESOURCE); monop_grp = add_resource_btn(vbox, monop_grp, LUMBER_RESOURCE); frontend_gui_register(gui_get_dialog_button (GTK_DIALOG(monop_dlg), 0), GUI_MONOPOLY, "clicked"); gtk_dialog_set_default_response(GTK_DIALOG(monop_dlg), GTK_RESPONSE_OK); /* This _must_ be after frontend_gui_register, otherwise the * regeneration of the button happens before the destruction, which * results in an incorrectly sensitive OK button. */ g_signal_connect(gui_get_dialog_button(GTK_DIALOG(monop_dlg), 0), "destroy", G_CALLBACK(monopoly_destroyed), NULL); gtk_widget_show(monop_dlg); frontend_gui_update(); }
static GtkWidget *build_main_interface(void) { GtkWidget *vbox; GtkWidget *hpaned; GtkWidget *vpaned; GtkWidget *panel; hpaned = gtk_hpaned_new(); gtk_widget_show(hpaned); vbox = gtk_vbox_new(FALSE, 3); gtk_widget_show(vbox); gtk_paned_pack1(GTK_PANED(hpaned), vbox, FALSE, TRUE); gtk_box_pack_start(GTK_BOX(vbox), identity_build_panel(), FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), resource_build_panel(), FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), build_develop_panel(), FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), player_build_summary(), TRUE, TRUE, 0); main_paned = gtk_hpaned_new(); gtk_widget_show(main_paned); vpaned = gtk_vpaned_new(); gtk_widget_show(vpaned); gtk_paned_pack1(GTK_PANED(main_paned), vpaned, TRUE, TRUE); gtk_paned_pack1(GTK_PANED(vpaned), build_map_panel(), TRUE, TRUE); chat_panel = gtk_vbox_new(FALSE, 0); gui_show_splash_page(TRUE, chat_panel); panel = chat_build_panel(); frontend_gui_register(panel, GUI_DISCONNECT, NULL); gtk_box_pack_start(GTK_BOX(chat_panel), panel, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(chat_panel), build_messages_panel(), TRUE, TRUE, 0); set_16_9_layout(config_get_int_with_default ("settings/layout_16_9", FALSE)); gtk_paned_pack2(GTK_PANED(hpaned), main_paned, TRUE, TRUE); return hpaned; }
static GtkWidget *discard_create_dlg(gint num) { GtkWidget *dlg_vbox; GtkWidget *vbox; gchar *text; discard.dlg = gtk_dialog_new_with_buttons( /* Dialog caption */ _("" "Discard Resources"), GTK_WINDOW (app_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_signal_connect(G_OBJECT(discard.dlg), "destroy", G_CALLBACK(gtk_widget_destroyed), &discard.dlg); gtk_widget_realize(discard.dlg); /* Disable close */ gdk_window_set_functions(discard.dlg->window, GDK_FUNC_ALL | GDK_FUNC_CLOSE); dlg_vbox = GTK_DIALOG(discard.dlg)->vbox; gtk_widget_show(dlg_vbox); vbox = gtk_vbox_new(FALSE, 6); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); text = g_strdup_printf(ngettext("You must discard %d resource", "You must discard %d resources", num), num); discard.resource_widget = resource_table_new(text, RESOURCE_TABLE_LESS_IN_HAND, FALSE, TRUE); g_free(text); resource_table_set_total(RESOURCETABLE(discard.resource_widget), /* Label */ _("Total discards"), num); gtk_widget_show(discard.resource_widget); gtk_box_pack_start(GTK_BOX(vbox), discard.resource_widget, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(discard.resource_widget), "change", G_CALLBACK(amount_changed_cb), NULL); frontend_gui_register(gui_get_dialog_button (GTK_DIALOG(discard.dlg), 0), GUI_DISCARD, "clicked"); /* This _must_ be after frontend_gui_register, otherwise the * regeneration of the button happens before the destruction, which * results in an incorrectly sensitive OK button. */ g_signal_connect(gui_get_dialog_button(GTK_DIALOG(discard.dlg), 0), "destroy", G_CALLBACK(button_destroyed), GINT_TO_POINTER(num)); gtk_widget_show(discard.dlg); frontend_gui_update(); return discard.dlg; }
GtkWidget *quote_build_page(void) { GtkWidget *scroll_win; GtkWidget *panel_vbox; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *bbox; scroll_win = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scroll_win), GTK_SHADOW_NONE); gtk_widget_show(scroll_win); panel_vbox = gtk_vbox_new(FALSE, 3); gtk_widget_show(panel_vbox); gtk_container_set_border_width(GTK_CONTAINER(panel_vbox), 6); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (scroll_win), panel_vbox); hbox = gtk_hbox_new(FALSE, 6); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(panel_vbox), hbox, FALSE, TRUE, 0); player_icon = gtk_image_new(); gtk_widget_show(player_icon); gtk_box_pack_start(GTK_BOX(hbox), player_icon, FALSE, FALSE, 0); desc_lbl = gtk_label_new(""); gtk_widget_show(desc_lbl); gtk_box_pack_start(GTK_BOX(hbox), desc_lbl, TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(desc_lbl), 0, 0.5); hbox = gtk_hbox_new(FALSE, 6); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(panel_vbox), hbox, TRUE, TRUE, 0); vbox = gtk_vbox_new(FALSE, 3); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, TRUE, 0); want_table = resource_table_new( /* Label */ _("I want"), RESOURCE_TABLE_MORE_IN_HAND, FALSE, FALSE); gtk_widget_show(want_table); gtk_box_pack_start(GTK_BOX(vbox), want_table, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(want_table), "change", G_CALLBACK(amount_changed_cb), NULL); give_table = resource_table_new( /* Label */ _("Give them"), RESOURCE_TABLE_LESS_IN_HAND, FALSE, FALSE); gtk_widget_show(give_table); gtk_box_pack_start(GTK_BOX(vbox), give_table, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(give_table), "change", G_CALLBACK(amount_changed_cb), NULL); bbox = gtk_hbutton_box_new(); gtk_widget_show(bbox); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); /* Button text */ submit_btn = gtk_button_new_with_label(_("Quote")); frontend_gui_register(submit_btn, GUI_QUOTE_SUBMIT, "clicked"); gtk_widget_show(submit_btn); gtk_container_add(GTK_CONTAINER(bbox), submit_btn); /* Button text */ delete_btn = gtk_button_new_with_label(_("Delete")); frontend_gui_register(delete_btn, GUI_QUOTE_DELETE, "clicked"); gtk_widget_show(delete_btn); gtk_container_add(GTK_CONTAINER(bbox), delete_btn); vbox = gtk_vbox_new(FALSE, 3); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); quoteview = quote_view_new(FALSE, can_delete_this_quote, GTK_STOCK_DELETE, NULL); gtk_widget_show(quoteview); gtk_box_pack_start(GTK_BOX(vbox), quoteview, TRUE, TRUE, 0); g_signal_connect(QUOTEVIEW(quoteview), "selection-changed", G_CALLBACK(quote_selected_cb), NULL); g_signal_connect(G_OBJECT(quoteview), "selection-activated", G_CALLBACK(quote_dblclick_cb), delete_btn); bbox = gtk_hbutton_box_new(); gtk_widget_show(bbox); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD); /* Button text */ reject_btn = gtk_button_new_with_label(_("Reject Domestic Trade")); frontend_gui_register(reject_btn, GUI_QUOTE_REJECT, "clicked"); gtk_widget_show(reject_btn); gtk_container_add(GTK_CONTAINER(bbox), reject_btn); return scroll_win; }
void plenty_create_dlg(const gint * bank) { GtkWidget *dlg_vbox; GtkWidget *vbox; const char *str; gint r; gint total; plenty.dlg = gtk_dialog_new_with_buttons(_("Year of Plenty"), GTK_WINDOW(app_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_signal_connect(GTK_OBJECT(plenty.dlg), "destroy", G_CALLBACK(gtk_widget_destroyed), &plenty.dlg); gtk_widget_realize(plenty.dlg); /* Disable close */ gdk_window_set_functions(plenty.dlg->window, GDK_FUNC_ALL | GDK_FUNC_CLOSE); dlg_vbox = GTK_DIALOG(plenty.dlg)->vbox; gtk_widget_show(dlg_vbox); vbox = gtk_vbox_new(FALSE, 5); gtk_widget_show(vbox); gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); total = 0; if (bank != NULL) for (r = 0; r < NO_RESOURCE; ++r) { plenty.bank[r] = bank[r]; total += bank[r]; } if (total == 1) str = _("Please choose one resource from the bank"); else if (total >= 2) { total = 2; str = _("Please choose two resources from the bank"); } else str = _("The bank is empty"); plenty.resource_widget = resource_table_new(str, RESOURCE_TABLE_MORE_IN_HAND, TRUE, TRUE); resource_table_set_total(RESOURCETABLE(plenty.resource_widget), /* Text for total in year of plenty dialog */ _("Total resources"), total); resource_table_limit_bank(RESOURCETABLE(plenty.resource_widget), TRUE); resource_table_set_bank(RESOURCETABLE(plenty.resource_widget), plenty.bank); gtk_widget_show(plenty.resource_widget); gtk_box_pack_start(GTK_BOX(vbox), plenty.resource_widget, FALSE, TRUE, 0); g_signal_connect(G_OBJECT(plenty.resource_widget), "change", G_CALLBACK(amount_changed_cb), NULL); frontend_gui_register(gui_get_dialog_button (GTK_DIALOG(plenty.dlg), 0), GUI_PLENTY, "clicked"); /* This _must_ be after frontend_gui_register, otherwise the * regeneration of the button happens before the destruction, which * results in an incorrectly sensitive OK button. */ g_signal_connect(gui_get_dialog_button(GTK_DIALOG(plenty.dlg), 0), "destroy", G_CALLBACK(plenty_destroyed), NULL); gtk_widget_show(plenty.dlg); frontend_gui_update(); }