Restore window position without default instance #3878
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If you don't have a default game instance, the GUI window will always appear in its default location as if you have never run CKAN before. This can be annoying if you have a strong preference for having appear in a particular spot on the screen or at a particular size.
Cause
The window geometry is saved per-instance, and as of #3829 and #3863, we display the GUI window as early as possible, and if there's no default instance, then the window appears before you choose an instance. There was no clearly best way to load the geometry without an instance.
Changes
Now if you have no default instance, we scan your (valid) instances to find the one with the most recently written
CKAN/GUIConfig.xml
file, and then we load that configuration. This way the window will appear wherever it was when you most recently closed CKAN, even with no default instance. If you have no instances at all (or if all of your instances are corrupted), we fall back to the baseline defaults.Fixes #3870.