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 711177 - Print to file fails with default settings
Print to file fails with default settings
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
2.24.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 696312 710746 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-10-30 20:37 UTC by Mike Gorse
Modified: 2014-03-18 20:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (1.19 KB, patch)
2013-10-30 20:44 UTC, Mike Gorse
needs-work Details | Review
Revised patch. (1.26 KB, patch)
2014-03-17 20:14 UTC, Mike Gorse
committed Details | Review

Description Mike Gorse 2013-10-30 20:37:43 UTC
Print to file fails if no directory is selected.

To reproduce:
1. Open Firefox.
2. Press ctrl-p to open the print dialog.
3. Select print to file. The dialog will suggest a name for the file (ie, mozilla.pdf)
4. Click "Print," or press enter.

No file is created.

filesave_changed_cb is being called and clobbers the filename in the print options. Calling
g_build_path ("/", gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (combo)), file, NULL)
returns an empty string because the call to gtk_file_chooser_get_uri() returns NULL if a directory has not been set.

This reportedly also affects inkscape (see https://bugzilla.novell.com/show_bug.cgi?id=839089 for a downstream bug). Also https://bugzilla.redhat.com/show_bug.cgi?id=1003198

Gtk+ 3 is unaffected as far as I can tell (savefile_changed_cb is no longer present).
Comment 1 Mike Gorse 2013-10-30 20:44:53 UTC
Created attachment 258612 [details] [review]
Proposed patch.
Comment 2 Timothy Arceri 2013-10-31 20:49:32 UTC
*** Bug 710746 has been marked as a duplicate of this bug. ***
Comment 3 Marek Kašík 2014-03-17 13:59:26 UTC
Review of attachment 258612 [details] [review]:

Hi Mike,

thank you for the patch. I'll accept it as soon as you add freeing of the chooser_uri to it.

Regards

Marek

::: gtk/gtkprinteroptionwidget.c
@@ +523,3 @@
       else
+        {
+          const gchar *chooser_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->combo));

You have to free the returned uri with g_free().
Comment 4 Marek Kašík 2014-03-17 14:00:11 UTC
*** Bug 696312 has been marked as a duplicate of this bug. ***
Comment 5 Mike Gorse 2014-03-17 20:14:33 UTC
Created attachment 272203 [details] [review]
Revised patch.

Add freeing of the chooser_uri.
Comment 6 Marek Kašík 2014-03-18 12:32:04 UTC
Review of attachment 272203 [details] [review]:

Thank you for the patch. Push it to gtk-2-24 branch please.

Marek
Comment 7 Mike Gorse 2014-03-18 20:50:38 UTC
Comment on attachment 272203 [details] [review]
Revised patch.

Committed to gtk-2-24: 601891