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 700466 - Set a document title or filename(?) as default basename when printing to a file
Set a document title or filename(?) as default basename when printing to a file
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: printing
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks: 686927
 
 
Reported: 2013-05-16 15:17 UTC by Jonas Danielsson
Modified: 2013-05-28 18:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set document title as basename when priting to file (1.21 KB, patch)
2013-05-16 15:17 UTC, Jonas Danielsson
none Details | Review
Set output basename to title if possible, otherwise filename (1.86 KB, patch)
2013-05-16 20:16 UTC, Jonas Danielsson
none Details | Review
Set output basename to document filename (1.62 KB, patch)
2013-05-16 20:17 UTC, Jonas Danielsson
reviewed Details | Review
Updated after review (1.58 KB, patch)
2013-05-22 08:51 UTC, Jonas Danielsson
committed Details | Review

Description Jonas Danielsson 2013-05-16 15:17:30 UTC
Created attachment 244425 [details] [review]
Set document title as basename when priting to file

Trying my hand on GNOME hacking and looking at some GnomeGoals and I found:
https://live.gnome.org/GnomeGoals/PrintToFile

And evince was on the todo list.

Patch attached!
Comment 1 Jonas Danielsson 2013-05-16 15:57:50 UTC
New patch in the works, this one will not work :)

Not all documents have titles is one of the problems.  Stay tuned!
Comment 2 Jonas Danielsson 2013-05-16 20:16:36 UTC
Created attachment 244461 [details] [review]
Set output basename to title if possible, otherwise filename

This patch checks if the document has a title, and uses it to set the output basename. Otherwise it uses the document filename.
Comment 3 Jonas Danielsson 2013-05-16 20:17:20 UTC
Created attachment 244462 [details] [review]
Set output basename to document filename

This patch does not look at title and always sets the output basename to the document filename.
Comment 4 José Aliste 2013-05-17 00:27:13 UTC
Review of attachment 244462 [details] [review]:

the patch looks good. I prefer this patch to the other since unfortunately, most Pdf files out-there don't have a proper title :(
Comment 5 Jonas Danielsson 2013-05-17 05:43:43 UTC
Thanks for review!

I noticed in has some minor whitespace damage, so if the locgic seems acceptable for inclusion I could send an updated patch.
Comment 6 Carlos Garcia Campos 2013-05-21 17:14:14 UTC
(In reply to comment #4)
> Review of attachment 244462 [details] [review]:
> 
> the patch looks good. I prefer this patch to the other since unfortunately,
> most Pdf files out-there don't have a proper title :(

We could use ev-window-title that already has some heuristics to sanitize the title.
Comment 7 Carlos Garcia Campos 2013-05-21 17:15:33 UTC
Review of attachment 244462 [details] [review]:

::: shell/ev-window.c
@@ +3486,3 @@
+	dot = g_strrstr (output_basename, ".");
+	if (dot)
+		output_basename[dot - output_basename] = '\0';

dot already points to the '.' if it's not NULL, I think t would be simpler to do dot[0] = '\0';
Comment 8 Jonas Danielsson 2013-05-22 08:50:50 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Review of attachment 244462 [details] [review] [details]:
> > 
> > the patch looks good. I prefer this patch to the other since unfortunately,
> > most Pdf files out-there don't have a proper title :(
> 
> We could use ev-window-title that already has some heuristics to sanitize the
> title.

Yes we could, but thhe title will be filename - title, if there is a title, right?

For an example pdf, the printing name would be (using gtk_window_get_title()):

"Aftonbladet_UnitedMinds_Väljarbarometer_Sept_120917_.pdf — (Microsoft Word - Aftonbladet_UnitedMinds_V\344ljarbarometer_Sept_120917_SLUTVERSION).pdf"

And using just filename would give:
"Aftonbladet_UnitedMinds_V%C3%A4ljarbarometer_Sept_120917_.pdf"

The title one looks a bit cluttered.
The second one doesn't do the characters correctly. Any tips on that?
Which approach to you prefer?


Posting updated patch with dot[0] = '\0', below.
Comment 9 Jonas Danielsson 2013-05-22 08:51:47 UTC
Created attachment 245020 [details] [review]
Updated after review
Comment 10 Carlos Garcia Campos 2013-05-28 18:00:53 UTC
Comment on attachment 245020 [details] [review]
Updated after review

Pushed to git master with some minor style modifications, thanks!