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 694143 - Command line option --find does not update the searchbox contents if document already open
Command line option --find does not update the searchbox contents if document...
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-19 06:52 UTC by Florian Moretz
Modified: 2013-05-08 19:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch to do updation of find bar string in case of reload (2.28 KB, patch)
2013-05-03 05:49 UTC, aakash
none Details | Review
Proposed patch to do updation of find bar string in case of reload (2.29 KB, patch)
2013-05-03 06:35 UTC, aakash
committed Details | Review
Patch to enable automatic search when --find is used (221.32 KB, patch)
2013-05-08 19:30 UTC, aakash
none Details | Review

Description Florian Moretz 2013-02-19 06:52:20 UTC
_Summary_: 

The command line switch --find can be used to trigger a search on opening the document (or currently on manually engaging a search therafter, as described here: https://bugzilla.gnome.org/show_bug.cgi?id=694056 and https://bugzilla.gnome.org/show_bug.cgi?id=604327). However, if a document is open already the search string is not passed to evince.

_Steps to reproduce_:

1. open a sample pdf file from the CLI with the --find switch set to a common expression, e.g.: evince sample.pdf --find=the

(1.5. As of the writing of this post the search function is not automatically activated on opening the document (see the reports above for more information). To trigger the search you will have to hit CTRL+F after the document opens up)

2. leave the document open and perform the same command again, this time replacing the search string with a different common expression, e.g.: evince sample.pdf --find=and

(2.5. Again, you will have to activate the search via CTRL+F)

_Expected behaviour_:

Search string in search field is replaced by newly set string

_Actual behaviour_:

Search string in search field remains unchanged or unset if no previous string was entered.

_Importance_:

The CLI interface is crucial for the integration of evince into other applications suites such as recoll (see here for an example of how the --find switch can be utilized to immediately jump to seach hits with Recoll: https://www.youtube.com/watch?v=GeeIBP8PbGE)
Comment 1 aakash 2013-05-03 05:49:18 UTC
Created attachment 243138 [details] [review]
Proposed patch to do updation of find bar string in case of reload

The problem is occurring because when an already open document is loaded, the windows is 'reloaded'. Now, when the window is reloaded, the new search string is not being passed to it. Also, the reload function is not even updating the search string if it has changed.

I have made a patch for this. It's working on my machine. However, the issue where the search functionality needs to be invoked manually, is still there. I hope somebody can review and comment on it.
Comment 2 aakash 2013-05-03 06:35:30 UTC
Created attachment 243142 [details] [review]
Proposed patch to do updation of find bar string in case of reload

Based on gpoo's recommendation on #evince, I have updated the commit message and made sure it does not go beyond column 72.
Comment 3 Carlos Garcia Campos 2013-05-07 16:59:22 UTC
Review of attachment 243142 [details] [review]:

Thanks!, I've pushed a slightly different patch (without the code duplication and using g_clear_pointer) to git master and gnome-3-8 branch.

::: shell/ev-window.c
@@ +1726,3 @@
+
+	g_free (ev_window->priv->search_string);
+	ev_window->priv->search_string = NULL;

This is not needed that I've fixed bug #604327.
Comment 4 aakash 2013-05-08 19:30:48 UTC
Created attachment 243614 [details] [review]
Patch to enable automatic search when --find is used

I have made another patch. This patch fixes the issue where the search needs to be triggered manually.

The find bar was not appearing because on loading, focus was being transferred to the view. When this happened, the find bar was getting hidden. I have rectified the problem by making sure that on load, focus is transferred to the view only if the search was invisible. If the search bar is visible, then focus is not given to the view.
Comment 5 aakash 2013-05-08 19:52:15 UTC
Sorry for the redundant patch, I didn't know that this problem was already solved. Just somehow missed Carlos' comment.