After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668529 - print to file defaults to output.pdf
print to file defaults to output.pdf
Status: RESOLVED DUPLICATE of bug 686927
Product: gtk+
Classification: Platform
Component: Printing
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-01-23 18:49 UTC by William Jon McCann
Modified: 2013-05-29 05:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk-print-to-file-mockup_1 (30.97 KB, image/png)
2012-08-16 09:32 UTC, Luca Cavalli
  Details
gtk-print-to-file-mockup_2 (46.60 KB, image/png)
2012-08-16 09:33 UTC, Luca Cavalli
  Details
Change text in print button to save (2.37 KB, patch)
2012-08-19 21:48 UTC, Sebastian
none Details | Review
Change text in "print"-button to "save" (2.36 KB, patch)
2012-08-20 07:27 UTC, Sebastian
none Details | Review
Screenshot with the save button. (40.14 KB, image/png)
2012-08-20 07:50 UTC, Sebastian
  Details
Display the file chooser dialog with filter (14.66 KB, patch)
2012-08-20 12:56 UTC, Sebastian
none Details | Review
This is how the print dialog looks now. (29.07 KB, image/png)
2012-08-20 13:00 UTC, Sebastian
  Details
This is the file chooser dialog with the filter set to pdf (62.58 KB, image/png)
2012-08-20 13:02 UTC, Sebastian
  Details
Presets the file name and appends the file type extension (2.53 KB, patch)
2012-08-20 14:08 UTC, Sebastian
none Details | Review
Presets the file name and appends the file type extension (3.36 KB, patch)
2012-08-22 08:35 UTC, Sebastian
none Details | Review

Description William Jon McCann 2012-01-23 18:49:29 UTC
When I print to a file it defaults to ~/output.pdf apparently. This isn't very nice because it makes me do a lot more work than is needed in most cases. The home directory is not a good place to save documents and defaulting to output.pdf means that either I'll never find that file again, I'll end up overwriting it, or I have to do work to come up with a name for it.

I think we should default to save:

~/Documents/$TITLE_OF_PAGE.pdf
Comment 1 André Klapper 2012-01-24 11:34:35 UTC
I don't see how this is an Epiphany issue as gedit has the same behavior.
Moving to gtk+/printing.
Comment 2 Luca Cavalli 2012-08-16 09:32:52 UTC
Created attachment 221353 [details]
gtk-print-to-file-mockup_1

What about making the "print-to-file" more similar to a standard printer removing the extra options from the print dialog and add a second "Save as..." standard dialog after the click on the "Print" button with a file format combobox (or anything similar, like retrieving the file format from file extension)?

See attached mockups.
Comment 3 Luca Cavalli 2012-08-16 09:33:16 UTC
Created attachment 221354 [details]
gtk-print-to-file-mockup_2
Comment 4 Diego Escalante Urrelo (not reading bugmail) 2012-08-18 18:28:11 UTC
For the record, OSX does something like that. When selecting Save as PDF you get a Save As dialog.

I think it makes sense that you are not "printing" but "saving a file".
Comment 5 Sebastian 2012-08-19 21:47:52 UTC
So in order to solve this bug, we would need to:

1. Change the print button from "Print" to "Save". [PATCH AVAILABLE]
2. When save is clicked display the Save dialog (which also offers the type selection) 
3. Remove the overwrite confirmation dialog and let the save dialog handle this
4. Remove the print to file specific option

I'm not really sure which function handles the callback when Print is clicked right now, could someone point me to it? Anyway it should be possible to adjust my patch for bug #682129 (which adds the browse button).

For three: The "error_dialogs" callback needs to be changed and the error confirmation stuff removed.

For four: I would guess this needs to be changed in the printer backend at:
    modules/printbackends/file/gtkprintbackendfile.c

I have already prepared a patch for 1., its not much but something to get started with. If I would get a pointer to the callback function that needs changing, then I could also provide more patches.

Best Regards
Sebastian
Comment 6 Sebastian 2012-08-19 21:48:42 UTC
Created attachment 221763 [details] [review]
Change text in print button to save

See my last comment
Comment 7 André Klapper 2012-08-20 05:50:31 UTC
Review of attachment 221763 [details] [review]:

::: gtk/gtkprintunixdialog.c
@@ +1447,3 @@
+  if (option != NULL &&
+      option->type == GTK_PRINTER_OPTION_TYPE_FILESAVE)
+  {

Coding style: Oneliner if and else do not use brakets in the surrounding code. See e.g. line 341. If they had more than one line the brakets would have a line of their one, see e.g. 868. See the surrounding code.

@@ +1448,3 @@
+      option->type == GTK_PRINTER_OPTION_TYPE_FILESAVE)
+  {
+    gtk_button_set_label(GTK_BUTTON(priv->print_button), GTK_STOCK_SAVE);

Coding style (twice): No space between function name and braket for arguments. See the surrounding code.
Comment 8 Sebastian 2012-08-20 07:27:37 UTC
Created attachment 221788 [details] [review]
Change text in "print"-button to "save"

Fixed the formating issues that Andre mentioned.
Comment 9 Sebastian 2012-08-20 07:50:06 UTC
Created attachment 221790 [details]
Screenshot with the save button.
Comment 10 Sebastian 2012-08-20 12:56:05 UTC
Created attachment 221830 [details] [review]
Display the file chooser dialog with filter

This is the second patch.

* It removes the entry and file chooser widgets.
* It displays the file chooser dialog when save is clicked
* The file chooser dialog automatically uses a correct filter according to the currently selected output format.

The reason I have not removed the output format options as well is as follows. The output format options are created by the printerbackendfile.c according to the supported output formats. If these would be moved to the file chooser dialog, then the dialog would need to knwo about the supported formats, but that seems not like such a good design, so I have left the options in place and added a filter to the file chooser dialog instead.

Known issues: The file type extension is currently not appended automatically. So this could probably be improved by checking if the user added the file type extension, and then add the extension if its not there. See also commit 8d1f32aaafedce6326b0dbd837dc5503e889a60e for this.
Comment 11 Sebastian 2012-08-20 13:00:53 UTC
Created attachment 221831 [details]
This is how the print dialog looks now.
Comment 12 Sebastian 2012-08-20 13:02:46 UTC
Created attachment 221832 [details]
This is the file chooser dialog with the filter set to pdf
Comment 13 Sebastian 2012-08-20 14:08:27 UTC
Created attachment 221850 [details] [review]
Presets the file name and appends the file type extension

This is the third patch. It gets the file name according to the GTK_PRINT_SETTINGS_OUTPUT_URI from the print settings and sets it in the file chooser dialog.

After the dialog returns it checks if the extension matches the currently selected output format and appends the extension if this is not the case.
Comment 14 Sebastian 2012-08-20 14:49:07 UTC
*** Bug 682129 has been marked as a duplicate of this bug. ***
Comment 15 Luca Cavalli 2012-08-20 14:56:00 UTC
(In reply to comment #5)
> So in order to solve this bug, we would need to:
> 
> 1. Change the print button from "Print" to "Save". [PATCH AVAILABLE]
> 2. When save is clicked display the Save dialog (which also offers the type
> selection) 
> 3. Remove the overwrite confirmation dialog and let the save dialog handle this
> 4. Remove the print to file specific option
> 

I'm not a big fan of dynamically changed UI, so I would skip step 1, keeping the "Print" label on the button (indeed we are still printing :).
Comment 16 Sebastian 2012-08-22 08:35:05 UTC
Created attachment 222111 [details] [review]
Presets the file name and appends the file type extension

Update the the third patch which sets the filename in the file chooser and appends the extension.

Now the basename of the file will now be correctly displayed in the file chooser dialog, even if the file does not exist yet.
Comment 17 Matthias Clasen 2012-08-22 14:02:49 UTC
The general opinion I got from our designers is that bringing up a second dialog when you click 'Save' is really not a good direction to go in. What I'd like to focus on in the short term is to make our default filename better than 'output.pdf'. Can we get a patch to change it to '<appname> <date>.<format>' ?

Longer-term, the direction we want to go with the print dialog is outlined in https://live.gnome.org/GnomeOS/Design/Whiteboards/Printing
Comment 18 Sebastian 2012-08-22 15:07:25 UTC
From what I can see in the mockups in this and other bugs, this is just what people requested, and I dont see the problem with having a file chooser dialog, after all that is already specialized for choosing files, why should we come up with another solution? Also the output.pdf thing is already changed, to provide a more reasonable default name [1] and bug #657322:

* If GTK_PRINT_SETTINGS_OUTPUT_BASENAME is set then the destination will default to ~/Documents/<basename>.pdf
* If its not set, then we default to ~/Documents/output.pdf

The application can also change the folder by specifying GTK_PRINT_SETTINGS_OUTPUT_URI.

> Can we get a patch to change it to '<appname> <date>.<format>' ?
Yes, that would need to got to around gtkprintbackendfile.c:251. This would not be too complicated.

But just making the default file name better is not the ultimate solution, but just a small step forward. Very often people will want to put the file into a different folder or rename it or both, and in that case the current implementation is just not enough, so I would rather like to see this fixed in 3.6 than to wait till 3.(add a high number here) until someone rewrites the whole print dialog, after all this bug is already half a year old.

Personally I really don't like the folder chooser widget, because I almost ALWAYS have to click on "Other..." to choose the right folder. For example I have folders like Documents or Code or Pictures in the Bookmarks, but normally when I want to save a picture or a text file, it won't save it directly into the Pictures folder but into some subfolder, and therefore I need to click "Other...", everytime that happens I miss the comfort of the file chooser dialog.

And anyway, we can fix this for 3.6 and then go and rewrite the print dialog later.

[1] https://live.gnome.org/GnomeGoals/PrintToFile
Comment 19 Matthias Clasen 2012-08-24 21:40:53 UTC
> And anyway, we can fix this for 3.6 and then go and rewrite the print dialog
> later.

But we don't have agreement that the 'fix' proposed here is an improvement.
Comment 20 Marek Kašík 2012-08-29 16:07:28 UTC
Since there was no agreement on the solution I'm not going to propose the patch for commit.
Comment 21 Sebastian 2012-09-02 13:16:23 UTC
To get back to the original point made by William in the description. GTK+ already defaults to:
~/Documents/$TITLE_OF_PAGE.pdf if GTK_PRINT_SETTINGS_OUTPUT_BASENAME is set by the application, and ~/Documents/output.pdf if its not set. Therefore I think this is fixed in the GTK+ printing part, and we should open another bug to track the progress of individual applications (see the PrintToFile GnomeGoal [1]).

[1] https://live.gnome.org/GnomeGoals/PrintToFile
Comment 22 Timothy Arceri 2012-10-25 21:59:52 UTC
This bug should be closed. Or marked as a duplicate of https://bugzilla.gnome.org/show_bug.cgi?id=657322 

In the above bug report I made improvements to GTK printing so that its much easier from applications to set the name/base directory for the output file.

Also from comment 2 "I don't see how this is an Epiphany issue as gedit has the same behavior."
This is no longer true Gedit uses the updates I made to the printing API see: https://bugzilla.gnome.org/show_bug.cgi?id=587053. 

Maybe this bug should be reassigned back to Epiphany.
Comment 23 Sebastian 2012-10-26 09:41:02 UTC
I agree this bug should be closed as fixed. There is a PrintToFile [1] gnome goal for the printing changes . I have just created a tracker bug [2] for the PrintToFile GnomeGoal. I suggest we create a new bug for each affected application and register it to the tracker bug.

[1] https://live.gnome.org/GnomeGoals/PrintToFile
[2] https://bugzilla.gnome.org/show_bug.cgi?id=686927
Comment 24 Timothy Arceri 2013-05-29 05:04:39 UTC

*** This bug has been marked as a duplicate of bug 686927 ***