gui: Save positions of windows only when they are closed. 20100227040506/pspp 20100228040509/pspp 20100301040511/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Feb 2010 05:40:52 +0000 (21:40 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Feb 2010 05:40:52 +0000 (21:40 -0800)
commit61e32cd84c226f5e5c20f407da139dbb7cf5170b
tree5f75bdf0b81a67b9b017aeca18ac54c805ae18ed
parenta7884b27895f52f54bea4d43022fce1175b65635
gui: Save positions of windows only when they are closed.

When windows in the GUI are moved around the desktop or resized, the
machine's disk can thrash madly in some setups.  This is because each
change in a window's position or size triggers a write to the PSPPIRE
preferences file noting the new position as a default for the next
PSPPIRE run.  It wasn't always a problem, but newer Glib versions call
fsync() from g_file_set_contents(), the function used to write the
preferences file, which bypasses the OS cache and forces a synchronous
disk write.

This commit makes PSPPIRE update the preferences file only when a window
is closed, which fixes the problem.  Avoiding g_file_set_contents() would
be another reasonable solution.

Reported by Grzegorz Artur Daszuta <crefff@gmail.com>.
src/ui/gui/psppire-conf.c
src/ui/gui/psppire-conf.h
src/ui/gui/psppire-dialog.c
src/ui/gui/psppire-window.c