GNOME Bugzilla – Bug 591152
Option to preview current PDF state in a viewer like Evince
Last modified: 2009-08-10 17:12:54 UTC
As discussed a bit in Evince bug #589661, it would be nice to be able to preview the PDF you are working on in pdfmod via a viewer app like Evince. This could be a toolbar button or a menu item. Ideally, this would be achieved by pdfmod saving a temp file of the current state, and having Evince (or whatever the default app associated with PDF files is?) open said temp file. In most situations, this would alleviate the desire many have to add viewer capabilities to pdfmod.
BTW, the choices for opening a doc with the default app are: Gnome.Url.Show: * Obsolete API in latest GNOME * Requires instantiation of Gnome.Program object on pdfmod startup Gtk.Uri.Show: * API available in GTK+ 2.14, but not in any released version of GTK#, so a DllImport from the gtk-sharp-beans project is required (one small file bundled in PdfMod) * Requires PdfMod.exe.config to actually be installed (and updated a bit, too) Might have a patch later today.
System.Diagnostics.Process.Start could work too.
Created attachment 140269 [details] [review] Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Since I'm lazy, I went with Process.Start (thanks Gabriel). Of course, 'Open In Viewer' could be considered a misnomer if your default PDF app is OO.o or even pdfmod. But that seems a bit unlikely. Also, Stock.MediaPlay may or may not be the best icon to use. Suggestions welcome.
Please ignore, changing keybinding from random ctrl+J to something sensible...
Created attachment 140270 [details] [review] Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Looks pretty good. I think instead of var path = PdfMod.GetTmpFilename (); app.Document.Save (path); Process.Start (path); we could just do Process.Start (app.Document.CurrentStateUri); This is because we already save the document to a tmp file on every change (though...I guess this may change at some point and your way would then be needed). If it hasn't yet been changed, then CurrentStateUri will just point to the original file. I'd also say let's go w/ no icon until we find a more suitable one.
(In reply to comment #7) > we could just do > > Process.Start (app.Document.CurrentStateUri); > > This is because we already save the document to a tmp file on every change > (though...I guess this may change at some point and your way would then be > needed). If it hasn't yet been changed, then CurrentStateUri will just point > to the original file. Perfect. Will fix. > I'd also say let's go w/ no icon until we find a more suitable one. Without an icon, the text "Open in viewer" appears in the toolbar. Shall I remove it from the toolbar for now, or leave it as-is, as a reminder to find a better icon? I feel like it's a pretty useful option, and should have a place on the toolbar.
Created attachment 140277 [details] [review] Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Created attachment 140278 [details] [review] Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Well...ideally we could use the app icon itself, but that'd require knowing which app we'd be starting. We could get that info from gio#...or we could cheat for now and just try to load the evince icon :)
Yeah, we could use Evince by adding a line like this["OpenInViewerAction"].IconName = "evince"; But if Evince isn't installed (KDE, Windows, or other non-GNOME environment), it uses an unhelpful generic icon. Digging a bit more, it appears that there are other icons like "gnome-pdf" and "x-pdf" that also bring up the Evince icon on my system. I don't know if this is just an artifact of my icon theme or if it is part of a standard we can use. Unless a user is familiar with Evince's icon, I'm still not sure that this properly conveys the idea of "open in viewer", or more accurately, "open in default PDF app". I don't have any particularly good ideas, though, so just let me know what you want and I'll update the patch. :-) The current version just doesn't set an icon at all.
Ok, I committed the last one but with the toolbar addition commented out. Thanks, Sandy!