- reset_focus();
- if (ui.filename!=NULL) {
- if (g_str_has_suffix(ui.filename, ".xoj")) {
- in_fn = g_strdup(ui.filename);
- g_strlcpy(g_strrstr(in_fn, "xoj"), "pdf", 4);
- }
- else
- in_fn = g_strdup_printf("%s.pdf", ui.filename);
- gnome_print_config_set(config, (guchar *)"Printer", (guchar *)"PDF");
- gnome_print_config_set(config, (guchar *)GNOME_PRINT_KEY_OUTPUT_FILENAME, (guchar *)in_fn);
- gnome_print_config_set(config, (guchar *)"Settings.Transport.Backend.FileName", (guchar *)in_fn);
- g_strlcpy(g_strrstr(in_fn, "pdf"), "ps", 3);
- gnome_print_config_set(config, (guchar *)"Printer", (guchar *)"GENERIC");
- gnome_print_config_set (config, (guchar *)GNOME_PRINT_KEY_OUTPUT_FILENAME, (guchar *)in_fn);
- s = gnome_print_config_get(config, (guchar *)"Settings.Transport.Backend.FileName");
- if (s != NULL) {
- g_free(s);
- gnome_print_config_set(config, (guchar *)"Settings.Transport.Backend.FileName", (guchar *)in_fn);
- }
- g_free(in_fn);
- }
-
- gpj = gnome_print_job_new(config); /* was NULL */
- gnome_print_config_unref(config);
-/* end */
- printDialog = gnome_print_dialog_new(gpj, (guchar *)"Print", GNOME_PRINT_DIALOG_RANGE);
- gnome_print_dialog_construct_range_page(GNOME_PRINT_DIALOG(printDialog),
- GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_RANGE,
- 1, journal.npages, (guchar *)"Current page", (guchar *)"Pages");
- /* don't have "Current page" as option, else it becomes the default!! */
-
- gtk_dialog_set_response_sensitive(GTK_DIALOG(printDialog),
- GNOME_PRINT_DIALOG_RESPONSE_PREVIEW, FALSE);
- /* the print-job-preview "feature" is completely, hopelessly broken */
-
- response = gtk_dialog_run(GTK_DIALOG(printDialog));
- if (response <= 0) {
- gtk_widget_destroy(printDialog);
- return;
- }
-