GNOME Bugzilla – Bug 444270
Wakes up too often
Last modified: 2007-06-05 14:44:10 UTC
+++ This bug was initially created as a clone of Bug #443851 +++ From: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=242397 ---8<--- evince wakes every 2 seconds up to see if ->modified is set, and if so, it saves the config file. ->modified gets only set in 2 places; and rarely so in practice. The patch attached just arms the timer only when things actually get modified, and the timer then only runs 1 time. ---8<---
Patch in the original bug.
Created attachment 89400 [details] [review] gedit-timeout-trunk.patch
I wonder if waiting 2 seconds beforewriting to disc does make sense anymore... batching up the changes in a timeout to avoid writing the file more than once when set_metadata is called makes sense, but I guess we could wait way less than 2 secs. That said, the patch looks good. please commit.
Comment on attachment 89400 [details] [review] gedit-timeout-trunk.patch Thanks for the patch. > > gedit_metadata_manager->modified = TRUE; >+ gedit_metadata_manager_arm_timeout (); > } > I suspect "modified" is no more needed. Could you please verify?
Comment on attachment 89400 [details] [review] gedit-timeout-trunk.patch If you remove "modified", please note that you should save on shutdown only if timeout_id != null.
Created attachment 89407 [details] [review] gedit-timeout-simple.patch Cleaned up patch (btw, mention whether to commit to trunk or to branches as well).
trunk, we have not branched
nitpick I missed + if (gedit_metadata_manager->timeout_id) { braces on a new line please :)
(In reply to comment #8) > nitpick I missed > > + if (gedit_metadata_manager->timeout_id) { > > braces on a new line please :) Fixed. And committed: 2007-06-05 Bastien Nocera <hadess@hadess.net> * gedit/gedit-metadata-manager.c: (gedit_metadata_manager_arm_timeout), (gedit_metadata_manager_init), (gedit_metadata_manager_shutdown), (gedit_metadata_manager_set), (gedit_metadata_manager_save): Avoid having an always-running timeout, uses power (Closes: #444270)