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 357472 - Open/View a Copy of current document
Open/View a Copy of current document
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
0.6.x
Other All
: Normal minor
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 413427 587940 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-09-24 15:42 UTC by Mathias Hasselmann (IRC: tbf)
Modified: 2009-07-07 14:57 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
The patch promised. (2.30 KB, patch)
2006-11-14 23:00 UTC, Mathias Hasselmann (IRC: tbf)
committed Details | Review

Description Mathias Hasselmann (IRC: tbf) 2006-09-24 15:42:01 UTC
Occasionally when working with large documents you frequently revisit the same page after some reading. Jumping arround by remembering page numbers is quite inconvenient. I good improvement would be some kind of bookmark system - which is worked on, as I hear. But in a multi-head setup it might be preferable to open multiple views of the same document: On one screen you hold your reference page on the other screen you jump arround in the document and read. Unfortunatly this workflow is not supported by Evince yet due its spatial model of operation.

A quite workarround for this issue would be adding some "Open a Copy" entry to the file menu - right over the "Save a Copy" entry. This entry would create a symlink of the current file located in the /tmp folder, instruct the shell to show this file (without polluting the recent files list). As soon as the new view is created the symlink would be removed again. This should work as it appears like Evince keeps a file descriptor for this file it currently views and would have the advantage of minimal code alteration. But maybe there are better solutions for this operation.

What are the chances to get this feature into Epiphany. Once an implementation model is choosen I'd take the burden to create the patch.

Other information:
Comment 1 Mathias Hasselmann (IRC: tbf) 2006-09-24 15:43:36 UTC
Adding CC as suggested by Nickolay: "add bclark@redhat.com to cc probably bryan will suggest something else"
Comment 2 Nickolay V. Shmyrev 2006-10-01 09:29:06 UTC
Yes, for my opinion it's a reasonable request.
Comment 3 Carlos Garcia Campos 2006-11-14 19:02:18 UTC
I've just committed to cvs head a fix for this issue. Thanks for the so useful report. 
Comment 4 Mathias Hasselmann (IRC: tbf) 2006-11-14 22:53:15 UTC
@Carlos: Thanks for taking care, but reopening the bug as I found two issues in your implementation:

1) You forgot to increment "i", so if the file exists you get an infinite loop.
2) The patch introduces a classic race-condition: The file not existing, when g_file_test is invoked by ev_window_get_copy_tmp_name might show up, until the symlink really is created.

Working on a patch right now.
Comment 5 Mathias Hasselmann (IRC: tbf) 2006-11-14 23:00:57 UTC
Created attachment 76605 [details] [review]
The patch promised.

Here you find the promised patch:

 - incrementing i during the file-existance loop
 - avoiding the race condition by intermediatly creating the symlink and checking for file existance by inspecting the error code
 - avoid creating a malloced copy for the error message

 Btw: Why did you create a copy of msg before passing it to ev_window_error_dialog? A static copy of that string should be sufficient. Also changed that.
Comment 6 Nickolay V. Shmyrev 2006-11-14 23:04:03 UTC
And if someone'll create dogtail script for tests it would be just amazing
Comment 7 Carlos Garcia Campos 2006-11-15 09:49:12 UTC
oh! sorry :-( I didn't test it enough. 
Mathias, thanks a lot, your patch looks good to me. 
Comment 8 Carlos Garcia Campos 2006-11-15 11:44:41 UTC
(In reply to comment #5)
>  Btw: Why did you create a copy of msg before passing it to
> ev_window_error_dialog? A static copy of that string should be sufficient. Also
> changed that.
> 

hehe, because I'm stupid :-D The msg was going to be something like: "Cannot open a copy of file %s", but then I realized that it was going to be redundant and I removed the %s.

Just another thing before you commit it, I've just added a ev_tmp_dir() function so that all temp files will be created in the same directory under /tmp. So, please use ev_tmp_dir() instead of g_get_tmp_dir().

Thanks again :-) 
Comment 9 Mathias Hasselmann (IRC: tbf) 2006-11-16 10:35:48 UTC
(In reply to comment #8)
> Just another thing before you commit it, ...

Just in case "you" refers to me: I never tried to acquire write permissions for GNOME CVS...
Comment 10 Carlos Garcia Campos 2006-11-16 10:45:33 UTC
oh! then I'll apply it.
Comment 11 Carlos Garcia Campos 2006-11-16 14:46:33 UTC
I've just committed a slightly modified version of the patch.
Comment 12 Carlos Garcia Campos 2007-03-01 13:39:48 UTC
*** Bug 413427 has been marked as a duplicate of this bug. ***
Comment 13 Nickolay V. Shmyrev 2009-07-07 14:57:10 UTC
*** Bug 587940 has been marked as a duplicate of this bug. ***