app: make sure name references to GimpData objects are serialized correctly

Desktop / GNOME / GIMP - Michael Natterer [gimp.org] - 26 February 2015 15:31 UTC

They were also serialized correctly before, but only because many GimpData objects were (bogusly) always dirty after loading, which caused them to always be written do disk on exit. This commit fixes this problem and updates by-name references explicitly as things are renamed, instead of relying on bugs.

Add gimp_data_factory_data_clean() which clears the dirty flags from all a factory's objects. Call the new function on all factories at the end of gimp_restore(), when all data has been loaded. This might be total overkill, but ensures that everything is clean in the beginning.

Add new signal GimpContext::prop_name_changed() which is emitted when any of the context's object properties (brush, gradient etc) is renamed.

In GimpToolPreset, connect to the new signal and dirty the preset if a relevant object propery was renamed, making sure the preset is saved to disk later. Also optmize updates quite a bit by ignoring notifications on tool option properties that are irrelevant to the preset.

This might or might not address the issues discussed in bug #739487.

9be16e0 app: make sure name references to GimpData objects are serialized correctly
app/core/gimp.c | 11 +++++++
app/core/gimpcontext.c | 48 +++++++++++++++++++++++++++++
app/core/gimpcontext.h | 3 ++
app/core/gimpdatafactory.c | 73 +++++++++++++++++++++++++++++---------------
app/core/gimpdatafactory.h | 1 +
app/core/gimptoolpreset.c | 44 +++++++++++++++++++++++++-
6 files changed, 154 insertions(+), 26 deletions(-)

Upstream: git.gnome.org


  • Share