Fix play time column if no playtime, hide game column if single game #3570
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
#3543 introduced play time tracking and tries to conditionally display it in the "Manage game instances" dialog only if any instance has a playtime > 0.
This is broken, because the
0,0
string for the playtime is added to theListViewItem
contents array all the time, and if the column is removed it shows underPath
:Changes
Now the string array for the column contents is factored out into a separate function. It includes the play time string only if the column (header) will actually be present in the end.
The same is applied to the "Game" column now as well, for those that only have instances of a single type of game registered with CKAN (currently the case all the time for everyone as we don't support another game yet).
The auto-resizing needs to be done after removing columns as it applies it to the incorrect columns otherwise.
(Ignore the Factorio instance being present, it is detected as KSP as this current branch doesn't have Factorio support)
I've also added the German localization for the play time strings.