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 591152 - Option to preview current PDF state in a viewer like Evince
Option to preview current PDF state in a viewer like Evince
Status: RESOLVED FIXED
Product: pdfmod
Classification: Other
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: pdfmod-maint
pdfmod-maint
Depends on:
Blocks:
 
 
Reported: 2009-08-08 14:32 UTC by Sandy Armstrong
Modified: 2009-08-10 17:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add 'Open In Viewer' action to toolbar and menus (BGO #591152) (3.05 KB, patch)
2009-08-09 16:10 UTC, Sandy Armstrong
none Details | Review
Add 'Open In Viewer' action to toolbar and menus (BGO #591152) (3.04 KB, patch)
2009-08-09 16:14 UTC, Sandy Armstrong
none Details | Review
Add 'Open In Viewer' action to toolbar and menus (BGO #591152) (2.97 KB, patch)
2009-08-09 19:01 UTC, Sandy Armstrong
none Details | Review
Add 'Open In Viewer' action to toolbar and menus (BGO #591152) (2.97 KB, patch)
2009-08-09 19:04 UTC, Sandy Armstrong
committed Details | Review

Description Sandy Armstrong 2009-08-08 14:32:34 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.
Comment 1 Sandy Armstrong 2009-08-08 16:19:19 UTC
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.
Comment 2 Gabriel Burt 2009-08-08 17:39:04 UTC
System.Diagnostics.Process.Start could work too.
Comment 3 Sandy Armstrong 2009-08-09 16:10:20 UTC
Created attachment 140269 [details] [review]
Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Comment 4 Sandy Armstrong 2009-08-09 16:12:13 UTC
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.
Comment 5 Sandy Armstrong 2009-08-09 16:13:05 UTC
Please ignore, changing keybinding from random ctrl+J to something sensible...
Comment 6 Sandy Armstrong 2009-08-09 16:14:47 UTC
Created attachment 140270 [details] [review]
Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Comment 7 Gabriel Burt 2009-08-09 16:40:19 UTC
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.
Comment 8 Sandy Armstrong 2009-08-09 18:58:58 UTC
(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.
Comment 9 Sandy Armstrong 2009-08-09 19:01:01 UTC
Created attachment 140277 [details] [review]
Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Comment 10 Sandy Armstrong 2009-08-09 19:04:09 UTC
Created attachment 140278 [details] [review]
Add 'Open In Viewer' action to toolbar and menus (BGO #591152)
Comment 11 Gabriel Burt 2009-08-09 19:40:02 UTC
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 :)
Comment 12 Sandy Armstrong 2009-08-09 23:51:26 UTC
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.
Comment 13 Gabriel Burt 2009-08-10 17:12:54 UTC
Ok, I committed the last one but with the toolbar addition commented out.  Thanks, Sandy!