GNOME Bugzilla – Bug 639003
Save Settings as default doesn't work
Last modified: 2012-06-27 09:41:56 UTC
- Open a PDF document, - set the zoom level to 100%, - select "Save Settings as Default" - Exit evince, open a brand-new PDF document that hasn't been opened with evince before - Zoom level is at 70% ProblemType: Bug DistroRelease: Ubuntu 10.10 Package: evince 2.32.0-0ubuntu1 ProcVersionSignature: Ubuntu 2.6.35-23.40-generic 2.6.35.7 Uname: Linux 2.6.35-23-generic i686 Architecture: i386 Date: Sun Nov 28 16:56:29 2010 EcryptfsInUse: Yes ExecutablePath: /usr/bin/evince ProcEnviron: PATH=(custom, no user) LANG=en_US.utf8 SHELL=/bin/bash SourcePackage: evince Downstream link: https://bugs.launchpad.net/ubuntu/+source/evince/+bug/682492
I can confirm this is happening to me as well, running Ubuntu 10.10 64bit. - open PDF - hit F9 to close Side Pane - select "Save Settings as Default" - close, reopen PDF - Side Pane is back on Settings are not getting saved.
Same here for both zoom-level and side pane problems. Kubuntu 10.10 (Maverick) 64bit.
Same bug with Fedora 14, evince-2.32.0-3.fc14.i686. I can't disable the thumbnails panel and the zoom setting isn't saved either. It's pretty annoying, so I switch to xpdf until this is fixed.
PS. Even if I set options with dconf-editor under org/gnome/evince/default, those are respected only for the first time a pdf is opened, then evince saves completely different gvfs-metadata for the file. C'mon, how stupid behavior this is! That metadata saving (and overriding) itself should be configurable.
This seems to be fixed in parts in evince 3.0.2, what happens here is this: 1. Open a pdf document, set to "Best Fit", select "Save as default settings" 2. Open a brand new pdf document, not seen by evince before. The setting is still set to "Best Fit", so that works 3. Close the document, without changing anything 4. Reopen the same document again: it is set to "Fit Page Width" <= THIS IS THE PROBLEM 5. Set it again to "Best Fit" 6. Close the document 7. Reopen the same document again: it is still set to "Best Fit" <= THIS TIME IT WORKS So the only step that doesn't work is step 4. However, setting the side pane to "index" seems to work all the way through for the seven steps above... somehow inconsistent
In fact this should have been fixed in evince 3.0.2. Probably the error is in the gio metadata code, which saves the per file settings
(In reply to comment #5) > This seems to be fixed in parts in evince 3.0.2, what happens here is this: > > 1. Open a pdf document, set to "Best Fit", select "Save as default settings" > 2. Open a brand new pdf document, not seen by evince before. The setting is > still set to "Best Fit", so that works > 3. Close the document, without changing anything > 4. Reopen the same document again: it is set to "Fit Page Width" <= THIS IS THE > PROBLEM Could you try to reproduce the problem but in step 4, instead of opening the file, do: gvfs-info path_to_testfile.pdf and paste the metadata related to evince (i.e. the entries with metadata::evince::*) > > 5. Set it again to "Best Fit" > 6. Close the document > 7. Reopen the same document again: it is still set to "Best Fit" <= THIS TIME > IT WORKS > > So the only step that doesn't work is step 4. > > However, setting the side pane to "index" seems to work all the way through for > the seven steps above... somehow inconsistent
Step 4 gives me: metadata::evince::page: 0 metadata::evince::window_height: 696 metadata::evince::window_width: 1278 metadata::evince::sidebar_size: 300 metadata::evince::window_x: 1 metadata::evince::window_y: 89 metadata::evince::window_maximized: 0 metadata::evince::sidebar_visibility: 1 When I open it again, set it to Best Fit, and do the gvfs-info, I get: metadata::evince::page: 0 metadata::evince::sidebar_size: 300 metadata::evince::sidebar_visibility: 1 metadata::evince::window_height: 696 metadata::evince::window_maximized: 0 metadata::evince::window_width: 1278 metadata::evince::window_x: 1 metadata::evince::window_y: 89 metadata::evince::sizing_mode: best-fit So the first time, the sizing_mode doesn't seem to be saved...
Jan, thanks for the feedback. it confirms my understanding of things. I expect to post a patch shortly
I think this bug has been present ever since "Save Current Settings as Default" was implemented. Here's what I think is happening, in detail, along with a possible fix. When you select the menu item "Edit > Save Current Settings as Default", Evince stores 11 settings in the GSettings schema "org.gnome.Evince.Default". Here are the default values for the saved settings: $ gsettings reset-recursively org.gnome.Evince.Default $ gsettings list-recursively org.gnome.Evince.Default org.gnome.Evince.Default continuous true org.gnome.Evince.Default dual-page false org.gnome.Evince.Default fullscreen false org.gnome.Evince.Default inverted-colors false org.gnome.Evince.Default show-sidebar true org.gnome.Evince.Default show-toolbar true org.gnome.Evince.Default sidebar-page 'links' org.gnome.Evince.Default sidebar-size 132 org.gnome.Evince.Default sizing-mode 'fit-width' org.gnome.Evince.Default window-ratio (0.0, 0.0) org.gnome.Evince.Default zoom 1.0 After selecting the menu items "View > Continuous" (unchecked), "View > Side Pane" (unchecked), "View > Best Fit" (checked), and "Edit > Save Current Settings as Default", Evince saves my personal preferences as follows: $ gsettings list-recursively org.gnome.Evince.Default --> org.gnome.Evince.Default continuous false org.gnome.Evince.Default dual-page false org.gnome.Evince.Default fullscreen false org.gnome.Evince.Default inverted-colors false --> org.gnome.Evince.Default show-sidebar false org.gnome.Evince.Default show-toolbar true --> org.gnome.Evince.Default sidebar-page 'thumbnails' --> org.gnome.Evince.Default sidebar-size 170 --> org.gnome.Evince.Default sizing-mode 'best-fit' org.gnome.Evince.Default window-ratio (0.0, 0.0) org.gnome.Evince.Default zoom 1.0 Initially, a document called "file.pdf" has no metadata attributes: $ gvfs-info --attributes metadata file.pdf | sort attributes: If I launch "file.pdf" for the first time, Evince sets 4 attributes specific to this file: $ gvfs-info --attributes metadata file.pdf | sort attributes: metadata::evince::page: 0 metadata::evince::sidebar_page: thumbnails metadata::evince::sidebar_size: 170 metadata::evince::window_maximized: 0 If I close the window and launch "file.pdf" again, Evince sets one more attribute specific to this file: $ gvfs-info --attributes metadata file.pdf | sort attributes: metadata::evince::page: 0 metadata::evince::sidebar_page: thumbnails metadata::evince::sidebar_size: 170 --> metadata::evince::sidebar_visibility: 1 metadata::evince::window_maximized: 0 But because some per-file metadata attributes existed when opening the file a second time, Evince ignores the globally-saved settings and uses internal defaults for any undefined metadata attributes. Furthermore, these internal defaults happen to be the opposite of what I want. That's the problem, and it has existed ever since "Save Current Settings as Default" was implemented with this bug report: Bug 620325, "evince forgets view preferences." https://bugzilla.gnome.org/show_bug.cgi?id=620325 The problem occurs because the global preferences saved in the GSettings schema are used only in the following two cases: (1) when no per-file metadata can be stored for the file, as when the file system is read-only, or (2) when the file has never before been opened by Evince, as indicated by not finding any metadata attributes for the file. It seems that was the intention: "Default settings will be used only for new documents that don't have metadata. Fixes bug #620325." http://mail.gnome.org/archives/commits-list/2010-July/msg09708.html Yet these global settings should always be loaded when there are no corresponding per-file attributes that override them. Evince should load the saved settings as defaults for all files, not just new files. I think that removing all references to the variable "is_new_doc" in the file "shell/ev-window.c" could fix the problem. They are: $ grep -n is_new_doc ev-window.c 204: gboolean is_new_doc; 1070: if (window->priv->is_new_doc) 1095: if (window->priv->is_new_doc) 1117: } else if (window->priv->is_new_doc) { 1127: } else if (window->priv->is_new_doc) { 1184: } else if (window->priv->is_new_doc) { 1194: } else if (window->priv->is_new_doc) { 1223: } else if (window->priv->is_new_doc) { 1231: } else if (window->priv->is_new_doc) { 1239: } else if (window->priv->is_new_doc) { 1246: if (window->priv->is_new_doc) 2097: ev_window->priv->is_new_doc = ev_metadata_is_empty (ev_window->priv->metadata); I'll see whether I can do a quick test of this naive fix locally by setting "is_new_doc" to always be TRUE. Note that some users report other settings that are not taking effect when saved, such as the window maximized state. That's a different problem, though. The window maximized state, and others, are simply not among the 11 settings saved.
The following one-line change to "shell/ev-window.c" solved this bug for me: $ diff shell/ev-window.c.save shell/ev-window.c 2097c2097 < ev_window->priv->is_new_doc = ev_metadata_is_empty (ev_window->priv->metadata); --- > ev_window->priv->is_new_doc = TRUE; That's a hack, of course, so the real fix might be to remove the variable "is_new_doc" entirely, along with all references to it. I don't know Evince well enough to know whether this change would cause other bugs, though. For others who may want to try this change on Ubuntu, I had to install the following development libraries to get through the "./configure" step without warnings: Required: $ sudo apt-get install libglib2.0-dev $ sudo apt-get install libgtk-3-dev $ sudo apt-get install libgtk-3-dev $ sudo apt-get install libgail-3-dev $ sudo apt-get install libxml2-dev $ sudo apt-get install libgnome-keyring-dev $ sudo apt-get install libnautilus-extension-dev $ sudo apt-get install libpoppler-glib-dev $ sudo apt-get install liblaunchpad-integration-3.0-dev Optional: $ sudo apt-get install libspectre-dev $ sudo apt-get install libtiff4-dev $ sudo apt-get install libdjvulibre-dev $ sudo apt-get install libkpathsea-dev Remaining warning: configure: WARNING: "XPS support is disabled since libgxps (version >= 0.0.1) is needed
I'm learning how to build, test, and submit a proper patch with the latest Evince code. I hope to post it this week. Unless I find problems in testing, I expect to make the following change: Use saved settings as defaults for all documents, not just new ones Before this change, Evince used the saved settings as defaults only for new documents that did not have metadata. With this change, Evince uses a saved setting as the default for all documents that don't have the corresponding metadata attribute. The change removes the variable "is_new_doc" and all its references from "shell/ev-window.c".
I think that removing the new_doc var make sense as otherwise you don't use the gsettings default. Feel free to ping me on Irc (gimp.net channel #evince) for guidance about building patching etc.
I finally have Evince 3.3.2 building and running without errors, so I can create the patch and test against the latest code now (moduleset = 'gnome-suites-core-3.4'). JHBuild is a marvel, by the way.
Created attachment 202775 [details] Bash script test case for Evince Bug 639003 Attached is the Bash shell script I used to reproduce the bug and to test the fix. It runs a series of 10 tests and prompts the user to verify whether the saved setting being tested was used as the default for the document. Modify the variable called "evince" at the top of the script to define which Evince executable to test. Invoke the script with a simple PDF file as a parameter: $ test-639003.sh file.pdf The following is the test output before I applied the fix: BEFORE $ ~/bin/test-639003.sh file.pdf Testing View > Continuous. Continuous should be un-checked (show page at a time) ... Continuous should be checked (show entire document) ... Is Continuous checked or un-checked ...? 1) checked 2) un-checked #? 1 === TEST FAILED === Testing View > Dual. Dual should be checked (show two pages at once) ... Dual should be un-checked (show one page at a time) ... Is Dual checked or un-checked ...? 1) checked 2) un-checked #? 2 === TEST FAILED === Testing View > Fullscreen. The document should be fullscreen (window fills screen) ... The document should not be fullscreen (normal window) ... Is the document fullscreen or not ...? 1) fullscreen 2) not #? 2 === TEST FAILED === Testing View > Inverted Colors. Inverted Colors should be checked (colors inverted) ... Inverted Colors should be un-checked (normal colors) ... Are the colors inverted or not ...? 1) inverted 2) not #? 2 === TEST FAILED === Testing View > Side Pane. Side Pane should be un-checked (no side pane) ... Side Pane should be checked (side pane visible) ... Is the Side Pane visible or not ...? 1) visible 2) not #? 1 === TEST FAILED === Testing View > Toolbar. Toolbar should be un-checked (no toolbar) ... Toolbar should be checked (toolbar visible) ... Is the toolbar visible or not ...? 1) visible 2) not #? 1 === TEST FAILED === Testing Side Pane page. Side Pane page should be set to Bookmarks ... Side Pane page should be set to Thumbnails ... Is the Side Pane page set to Bookmarks or Thumbnails ...? 1) Thumbnails 2) Bookmarks #? 1 === TEST FAILED === Testing Side Pane size. The Side Pane size should be big (500 px) ... The Side Pane size should be small (170 px) ... Is the Side Pane size big or small ...? 1) big 2) small #? 2 === TEST FAILED === Testing View > (sizing mode). Best Fit should be checked (document fills window) ... No sizing mode should be checked (document at zoom level) ... Is Best Fit checked or un-checked ...? 1) checked 2) un-checked #? 2 === TEST FAILED === Testing zoom level. The zoom level should be 400 percent ... The zoom level should be 50 percent ... Is the zoom level 400 percent or some other value ...? 1) 400 2) other #? 2 === TEST FAILED === The following is the test output after I applied the fix: AFTER $ ~/bin/test-639003.sh file.pdf Testing View > Continuous. Continuous should be un-checked (show page at a time) ... Continuous should be checked (show entire document) ... Is Continuous checked or un-checked ...? 1) checked 2) un-checked #? 2 Test passed. Testing View > Dual. Dual should be checked (show two pages at once) ... Dual should be un-checked (show one page at a time) ... Is Dual checked or un-checked ...? 1) checked 2) un-checked #? 1 Test passed. Testing View > Fullscreen. The document should be fullscreen (window fills screen) ... The document should not be fullscreen (normal window) ... Is the document fullscreen or not ...? 1) fullscreen 2) not #? 1 Test passed. Testing View > Inverted Colors. Inverted Colors should be checked (colors inverted) ... Inverted Colors should be un-checked (normal colors) ... Are the colors inverted or not ...? 1) inverted 2) not #? 1 Test passed. Testing View > Side Pane. Side Pane should be un-checked (no side pane) ... Side Pane should be checked (side pane visible) ... Is the Side Pane visible or not ...? 1) visible 2) not #? 2 Test passed. Testing View > Toolbar. Toolbar should be un-checked (no toolbar) ... Toolbar should be checked (toolbar visible) ... Is the toolbar visible or not ...? 1) visible 2) not #? 2 Test passed. Testing Side Pane page. Side Pane page should be set to Bookmarks ... Side Pane page should be set to Thumbnails ... Is the Side Pane page set to Bookmarks or Thumbnails ...? 1) Thumbnails 2) Bookmarks #? 2 Test passed. Testing Side Pane size. The Side Pane size should be big (500 px) ... The Side Pane size should be small (170 px) ... Is the Side Pane size big or small ...? 1) big 2) small #? 1 Test passed. Testing View > (sizing mode). Best Fit should be checked (document fills window) ... No sizing mode should be checked (document at zoom level) ... Is Best Fit checked or un-checked ...? 1) checked 2) un-checked #? 1 Test passed. Testing zoom level. The zoom level should be 400 percent ... The zoom level should be 50 percent ... Is the zoom level 400 percent or some other value ...? 1) 400 2) other #? 1 Test passed.
Created attachment 202776 [details] [review] Proposed fix for Evince Bug 639003 Attached is my proposed fix. Please let me know if you find any problems or spot any errors.
Created attachment 202898 [details] A temporary solution using a bash shell script invoked as evince Meanwhile, you can work around the problem with the attached script. It was adapted from a solution posted by "clerville6" on Forum Ubuntu-it: [Risolto] Modifica visualizzazione di default con Evince http://forum.ubuntu-it.org/index.php?topic=480233#msg3761239 Make sure ~/bin is in your PATH environment variable. Then save the script as ~/bin/evince and make it executable (chmod +x ~/bin/evince). To limit the number of unnecessary attributes added, modify the script to set only those attributes that you want to be different from the internal defaults.
John, I thought a little bit about your patch. I think the original idea was that if you have opened a file, then evince should save all the metadata in the file even if it is not overriding any default setting. The rationale for this is that if you change your defaults and then reopen a file you already have opened, it will open exactly as before. Which I think is right. Your patch would actually prevent this from happening, and then it is not a real solution to the problem. I guess I would want to see a patch that actually fixes the issue in the same way you are working around the issue in the script, i.e., to ensure that evince saves all the settings into the metadata of the file, so next time, you open the file, the correct metadata will be read.
(In reply to comment #18) > John, I thought a little bit about your patch. I think the original idea was > that if you have opened a file, then evince should save all the metadata in the > file even if it is not overriding any default setting. The rationale for this > is that if you change your defaults and then reopen a file you already have > opened, it will open exactly as before. exactly. > Which I think is right. Your patch > would actually prevent this from happening, and then it is not a real solution > to the problem. > > I guess I would want to see a patch that actually fixes the issue in the same > way you are working around the issue in the script, i.e., to ensure that evince > saves all the settings into the metadata of the file, so next time, you open > the file, the correct metadata will be read. Yes, default values should only be used for documents that don't have previous metadata.
Created attachment 204808 [details] [review] Patch Could someone try this patch to confirm whether it fixes the bug or not?
Created attachment 205032 [details] Output of 'test-639003.sh' test case with patch 204808 It works for me! Thank you, Carlos. The attached file is the output of my Bash test case (attachment 202775 [details]) running with the latest Evince, including your patch. All of the tests passed. For a specific test in detail, suppose that while viewing some document using Evince without the patch, you decide you want it to show a page at a time (not continuous), to hide the side pane (no sidebar), and to have the document fill the window ("best fit" sizing mode). You save these settings as the default. Saved default settings: $ gsettings list-recursively org.gnome.Evince.Default --> org.gnome.Evince.Default continuous false org.gnome.Evince.Default dual-page false org.gnome.Evince.Default fullscreen false org.gnome.Evince.Default inverted-colors false --> org.gnome.Evince.Default show-sidebar false org.gnome.Evince.Default show-toolbar true org.gnome.Evince.Default sidebar-page 'thumbnails' org.gnome.Evince.Default sidebar-size 170 --> org.gnome.Evince.Default sizing-mode 'best-fit' org.gnome.Evince.Default window-ratio (0.0, 0.0) org.gnome.Evince.Default zoom 1.0 Later, using the same Evince with the bug, you open a new document called "file.pdf" for the first time. Evince displays the document as you wanted, and sets the following attributes for the file. First time with broken Evince: $ gvfs-info -a metadata file.pdf | sort attributes: metadata::evince::page: 0 metadata::evince::sidebar_page: thumbnails metadata::evince::sidebar_size: 170 metadata::evince::window_maximized: 0 Without the fix, when you open the "file.pdf" document a second time, Evince displays it the opposite of how you want (in continuous mode, showing the sidebar, and with "fit width" sizing mode), and adds one more attribute to the file: Second time with broken Evince: $ gvfs-info -a metadata file.pdf | sort attributes: metadata::evince::page: 0 metadata::evince::sidebar_page: thumbnails metadata::evince::sidebar_size: 170 --> metadata::evince::sidebar_visibility: 1 metadata::evince::window_maximized: 0 With the fix, when you open the "file.pdf" document the second time, Evince picks up your saved settings, displays the document as you wanted, and adds any missing defaults to the list of attributes for the file: Second time with fixed Evince: $ gvfs-info -a metadata file.pdf | sort attributes: --> metadata::evince::continuous: 0 --> metadata::evince::dual-page: 0 --> metadata::evince::fullscreen: 0 --> metadata::evince::inverted-colors: 0 metadata::evince::page: 0 --> metadata::evince::show_toolbar: 1 metadata::evince::sidebar_page: thumbnails metadata::evince::sidebar_size: 170 --> metadata::evince::sidebar_visibility: 0 --> metadata::evince::sizing_mode: best-fit metadata::evince::window_maximized: 0 --> metadata::evince::zoom: 1 Note that there is one minor glitch. If you opened the "file.pdf" document two or more times with the broken Evince and didn't bother to correct the side pane visibility, you'll still have to correct that manually, as it got added with the wrong value the second time the broken Evince opened the document. I don't see any way for the fixed Evince to know to correct the setting, though.
Comment on attachment 204808 [details] [review] Patch Pushed to git master. Thanks for testing it.
Saving settings as default works now fine for me, except when the document is stored in /tmp (e.g. pdfs opened from firefox). In this case only some settings are applied (like sizing_mode) and some not (like window-ratio, show-sidebar). Especially that the window ratio is not restored bugs me, since all temporary pdfs from firefox need to be resized to get them in a readable condition. This is on evince 3.4.0 with $ gsettings list-recursively org.gnome.Evince.Default org.gnome.Evince.Default continuous true org.gnome.Evince.Default dual-page false org.gnome.Evince.Default dual-page-odd-left false org.gnome.Evince.Default fullscreen false org.gnome.Evince.Default inverted-colors false org.gnome.Evince.Default show-sidebar true org.gnome.Evince.Default show-toolbar true org.gnome.Evince.Default sidebar-page 'thumbnails' org.gnome.Evince.Default sidebar-size 257 org.gnome.Evince.Default sizing-mode 'best-fit' org.gnome.Evince.Default window-ratio (1.6218487394957983, 1.2244655581947743)