Skip to content

session: Make IdeSession handle plumbing so addins only handle content

Vanadiae requested to merge Vanadiae/gnome-builder:ide_session_easier_api into master

See commit message for details.


I'm quite pleased as of how it went, both API wise and code-wise.

Things that don't work: - it seems that Builder loops forever when closing a project (which it didn't before) in a poll() (as of gdb), but the callstack with the debugger doesn't show super useful information here :/

TODO once the current code is reviewed/fixed:

  • handle migration of the session.gvariant from the previous format (which is an a{sv} where the key of the {sv} is GbpEditorSessionAddin and where v is an a(siiiv) where iii are the frame column/row/depth)
  • cleanup all FIXMEs
  • add some documentation under doc/help for the IdeSessionAddin. I wonder though if it makes sense, since there's no doc for adding an IdePage either (but it could still be useful for existing IdePage types maybe?) Well it seems there's already plugins/session.rst so I'll edit this one to reflect the new API.
  • find out why when Builder crashes the session is saved without any elements (at least, it did that with the previous code, but I didn't reproduce a crash yet to know if it's still the case).
  • going with the previous item, find out when to occasionnally save the state to disk to avoid loosing the latest session state, as in you start with session state A (just after opening back the project), do some work and open some pages (state B), then crash. Here the session state stays to A, not B, where it would be better to at least have the session saved some minutes before the crash so not all recent opened pages are closed.

NOTE WHEN TESTING: don't try it in a project you work on, but create a dedicated testing project (or at least a folder where it doesn't matter loosing the session state), because the saved session format isn't compatible between both versions (as in this MR's builder will erase the previous state so you won't be able to have your session back with the normal Builder, at least until a migration is done).

Edited by Vanadiae

Merge request reports