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 444270 - Wakes up too often
Wakes up too often
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2007-06-05 08:58 UTC by Bastien Nocera
Modified: 2007-06-05 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gedit-timeout-trunk.patch (1.57 KB, patch)
2007-06-05 09:37 UTC, Bastien Nocera
accepted-commit_now Details | Review
gedit-timeout-simple.patch (2.29 KB, patch)
2007-06-05 13:22 UTC, Bastien Nocera
accepted-commit_now Details | Review

Description Bastien Nocera 2007-06-05 08:58:38 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<---
Comment 1 Bastien Nocera 2007-06-05 08:58:51 UTC
Patch in the original bug.
Comment 2 Bastien Nocera 2007-06-05 09:37:28 UTC
Created attachment 89400 [details] [review]
gedit-timeout-trunk.patch
Comment 3 Paolo Borelli 2007-06-05 12:17:36 UTC
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 4 Paolo Maggi 2007-06-05 12:32:45 UTC
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 5 Paolo Maggi 2007-06-05 12:35:17 UTC
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.
Comment 6 Bastien Nocera 2007-06-05 13:22:55 UTC
Created attachment 89407 [details] [review]
gedit-timeout-simple.patch

Cleaned up patch (btw, mention whether to commit to trunk or to branches as well).
Comment 7 Paolo Borelli 2007-06-05 14:38:12 UTC
trunk, we have not branched
Comment 8 Paolo Borelli 2007-06-05 14:39:00 UTC
nitpick I missed

+	if (gedit_metadata_manager->timeout_id) {

braces on a new line please :)
Comment 9 Bastien Nocera 2007-06-05 14:44:10 UTC
(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)