+ int pages;
+ if (visible_cols.print_profiles){
+ pages = (dive_table.nr + 5) / 6;
+ gtk_print_operation_set_n_pages(operation, pages);
+ } else {
+ pages = (dive_table.nr + 9) / 15;
+ gtk_print_operation_set_n_pages(operation, pages);
+ }
+}
+
+static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
+{
+ GtkWidget *vbox, *button, *frame, *box;
+ gtk_print_operation_set_custom_tab_label(operation, "Dive details");
+
+ vbox = gtk_vbox_new(TRUE, 5);
+
+ frame = gtk_frame_new("Print options");
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
+
+ box = gtk_hbox_new(FALSE, 1);
+ gtk_container_add(GTK_CONTAINER(frame), box);
+ button = gtk_check_button_new_with_label("Show profiles");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.print_profiles);
+ gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(print_profiles_toggle), NULL);
+
+ gtk_widget_show_all(vbox);
+ return vbox;
+}
+
+static void print_dialog_apply(GtkPrintOperation *operation, GtkWidget *widget, gpointer user_data)
+{
+ if (visible_cols.print_profiles){
+ g_signal_connect(operation, "draw_page", G_CALLBACK(draw_page), NULL);
+ } else {
+ g_signal_connect(operation, "draw_page", G_CALLBACK(draw_page_table), NULL);
+ }