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 130748 - Auto save settings are not reflecting immediately
Auto save settings are not reflecting immediately
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
unspecified
Other Linux
: High normal
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2004-01-07 04:59 UTC by Archana Shah
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch which fixes the bug. (7.30 KB, patch)
2004-01-07 05:04 UTC, Archana Shah
needs-work Details | Review
Patch with the suggested changes (7.68 KB, patch)
2004-12-09 12:28 UTC, Archana Shah
none Details | Review
Patch against CVS HEAD (15.37 KB, patch)
2004-12-13 18:57 UTC, Paolo Maggi
none Details | Review

Description Archana Shah 2004-01-07 04:59:50 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.
Comment 1 Archana Shah 2004-01-07 05:02:57 UTC
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.
Comment 2 Archana Shah 2004-01-07 05:04:17 UTC
Created attachment 23055 [details] [review]
Patch which fixes the bug.
Comment 3 Paolo Maggi 2004-01-08 10:31:28 UTC
Thanks for the patch. 
I will review it ASAP.

Comment 4 Paolo Maggi 2004-02-13 23:34:00 UTC
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
Comment 5 Archana Shah 2004-03-02 10:49:45 UTC
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.

Comment 6 Paolo Borelli 2004-12-09 10:32:44 UTC
Paolo: weren't you going to commit this (or a slightly modified) patch?
Comment 7 Archana Shah 2004-12-09 12:26:16 UTC
Paolo, Sorry for not responding earlier

Attaching a patch created with the latest sources and with the suggested
changes. Please review it.
Comment 8 Archana Shah 2004-12-09 12:28:49 UTC
Created attachment 34655 [details] [review]
Patch with the suggested changes
Comment 9 Paolo Maggi 2004-12-13 18:57:28 UTC
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?
Comment 10 Paolo Borelli 2004-12-13 19:38:43 UTC
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 ())
Comment 11 Paolo Maggi 2004-12-13 20:11:24 UTC
pbor: thanks for the review.

Committed to CVS HEAD.