GNOME Bugzilla – Bug 130748
Auto save settings are not reflecting immediately
Last modified: 2004-12-22 21:47:04 UTC
Steps to reproduce: 1. Open gedit. 2. Make changes in auto save settings. (auto save / auto save interval) 3. Change are not reflected. For Example, if the auto save option is disabled, make it true.It is observed that file is not saved after the specified time.
When auto save options are changed, the application should be notified , so that it will react accordingly. Adding a notify function and callbacks for that,fixes the bug. Attaching a patch.
Created attachment 23055 [details] [review] Patch which fixes the bug.
Thanks for the patch. I will review it ASAP.
In gedit_document_set_auto_save_timer you need to remove the timer if doc->priv->auto_save_timeout + g_return_if_fail (doc != NULL); + g_return_if_fail (doc->priv != NULL); Use g_return_if_fail (GEDIT_IS_DOCUMENT (doc)); Note that if you call gedit_document_set_auto_save_interval_timer and then gedit_document_set_auto_save_timer, the timer is restored to the default interval. Probably we should use per-view variables: auto_save_enabled, auto_save_interval
Thanks Paolo, I will fix that assertion. And for the other comment, > Note that if you call gedit_document_set_auto_save_interval_timer > and then gedit_document_set_auto_save_timer, the timer is restored > to the default interval. Probably we should use per-view variables: > auto_save_enabled, auto_save_interval Please see my observation of how things work in gedit with this patch:- Started gedit ... 1. Settings are : Auto_save interval is 2, Auto_save option is enabled. 2. Settings are : Auto_save interval changed to 1, Auto_save option is enabled. gedit_document_set_auto_save_changed is called. gedit_document_set_auto_save_interval_timer is called. Result: Saves a copy after every 1 minute. 3. Settings are : Auto_save interval is 1, Auto_save option is changed to disabled. gedit_document_set_auto_save_interval_timer is called. gedit_document_set_auto_save_timer is called. Result: Does not save . 4. Settings are : Auto_save interval is 1, Auto_save option is again enabled. gedit_document_set_auto_save_interval_timer is called. gedit_document_set_auto_save_interval_timer Result: Saves a copy after every 1 minute. 5. Settings are : Auto_save interval is changed to 2, Auto_save option is enabled. gedit_document_set_auto_save_interval_timer is called. gedit_document_set_auto_save_interval_timer is called. Result: Saves a copy after every 2 minutes. At any point in time, I do not see the default timer value for autosave getting used. i.e I have inferred this based on the above test cases that I narrowed down to. Please let know if this observation is right or am missing some testcases.
Paolo: weren't you going to commit this (or a slightly modified) patch?
Paolo, Sorry for not responding earlier Attaching a patch created with the latest sources and with the suggested changes. Please review it.
Created attachment 34655 [details] [review] Patch with the suggested changes
Created attachment 34802 [details] [review] Patch against CVS HEAD This patch should solve the problem related to this bug. Sorry Archana for not using your patch, but I preferred to rewrite them from scratch since the problem was not so easy to solve. pbor: could you please give a look at my patch and lemme know if it looks good for you too?
from reading it (not tested it yet) the patch looks really good to me. The only really minor nitpick I have is: can the following boolean normalizations + document->priv->auto_save = gedit_prefs_manager_get_auto_save (); + document->priv->auto_save = (document->priv->auto_save != FALSE); ... + enable = (enable != FALSE); be moved the callee (gedit_prefs_manager_get_auto_save ())
pbor: thanks for the review. Committed to CVS HEAD.