GNOME Bugzilla – Bug 742321
"don't ask me again this session" remembers answer forever
Last modified: 2018-06-29 23:37:20 UTC
The "warnings.permanent" and "warnings.temporary" preferences are both backed by gsettings, and "warnings.temporary" is never cleared. Steps to Reproduce: 1.Select a transaction in an account 2.Transaction->Delete Transaction 3.Select 'Remember the answer and don't ask me again this session.' 4.Click Delete Transaction 5.Close application and open it again 6.Select another transaction 7.Transaction->Delete Transaction Actual results: 2: dialog appears: Delete the current transaction? [] Remember the answer and don't ask me again. [] Remember the answer and don't ask me again this session. [Cancel] [Delete Transaction] 7: no dialog is shown, transaction deleted Expected results: 7: the dialog should appear again Original report: https://bugzilla.redhat.com/show_bug.cgi?id=1178516
Absolutely, positively, completely untested patch. (Not even compile-tested!) diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 0328d99..c1c74d5 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -613,6 +613,8 @@ inner_main (void *closure, int argc, char **argv) gnc_destroy_splash_screen(); gnc_ui_new_user_dialog(); } + /* Ensure temporary preferences are temporary */ + gnc_prefs_reset_group (GNC_PREFS_GROUP_WARNINGS_TEMP); gnc_destroy_splash_screen(); gnc_main_window_show_all_windows(); (I suspect you could do some work around ensuring that saving the temporary prefs only saves to memory. But this is a much shorter patch.)
<poke> Does the attached patch seem reasonable? I can include it in Fedora for smoke testing if people want.
Bill, if you put a patch in a comment like that it's invisible in the tracker. Make a patch (instructions at http://wiki.gnucash.org/wiki/Git#Patches if you're not familiar with Git) and attach it to the bug. Make sure to check the "patch" checkbox so that it shows up on the open patches status page. Whether this is the correct patch depends on what you think of as a session. In GnuCash code a session is a connection to a particular file or database, so one could argue that the reset belongs in qof_session_end(). Users might think otherwise, though, and prefer your choice, to reset it at the next startup of GnuCash.
Created attachment 314935 [details] [review] Reset temporary prefs on application startup Patch from above comment.
Thanks. No response to whether it's better in inner_main or qof_session_end?
From a user perspective, might defer to Tim who filed the original bug. It could go in either place... if it's in qof_session_end, then it won't get reset on any abnormal exit/kill of GnuCash, but that may not be a big need. From a code standpoint, putting it in inner_main where the prefs themselves were initialized made sense to me in knowing that it's in the right context of the app where the prefs engine was initialized and working. I didn't look deeper at the control flow to find qof_session_end, and would defer to those more familiar with the code as to if the change would need to be any different if called from qof_session_end.
I understood it to mean that my answer would stand until I closed the application. It didn't occur to me it could mean anything else.
I'm fine with the interpretation of session as "until the next start of gnucash". For most users that will be the same as "as long as the current book is open" as most users only have one book anyway. Tested the patch and found it to work as advertised. I have applied it to the maint branch, so the fix will appear in upcoming 2.6.10. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=742321. Please update any external references or bookmarks.