GNOME Bugzilla – Bug 700466
Set a document title or filename(?) as default basename when printing to a file
Last modified: 2013-05-28 18:01:05 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!
New patch in the works, this one will not work :) Not all documents have titles is one of the problems. Stay tuned!
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.
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.
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 :(
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.
(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.
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';
(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.
Created attachment 245020 [details] [review] Updated after review
Comment on attachment 245020 [details] [review] Updated after review Pushed to git master with some minor style modifications, thanks!