-
Notifications
You must be signed in to change notification settings - Fork 3.3k
LibConfig: Write default read items always back to fill out config files #26170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
8b65864
to
dacd8c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LibConfig change seems nice. I'm not really knowledgeable IPC and GUI stuff though, so I'd grateful if someone else could perhaps also take a look at this.
write_string_value(ByteString domain, ByteString group, ByteString key, ByteString value, bool notify) => () | ||
write_i32_value(ByteString domain, ByteString group, ByteString key, i32 value, bool notify) => () | ||
write_u32_value(ByteString domain, ByteString group, ByteString key, u32 value, bool notify) => () | ||
write_bool_value(ByteString domain, ByteString group, ByteString key, bool value, bool notify) => () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We generally prefer enum class
es over bool
s as function parameters if callers are likely to pass constants (see https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md). Though I don't know if this is possible or clean to do with IPC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible, but it results in a lot of extra code for just a Yes
, No
enum. So my preference is to let is a bool
, maybe it needs a better name though.
dacd8c3
to
f828738
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the 72 columns line wrapping mentioned in the documentation rather than the smaller value you are using in the second commit?
The section_label prop is used as config key. But sometimes it contains spaces. Spaces in config keys are quite ugly and not following the .ini spec I think, so this commit filters them out.
f828738
to
7e2e7e4
Compare
As discussed in #26164 to have better multiple user desktop support we have to remove all prefilled config files from anon. But it is a nice feature to view all the available options in a text file and to edit them directly. But currently default config items are not synced to disk, because of the fallback value in code.
This pr update
LibConfig
to always write back reads with defaults when the keys don't exist yet. This results in that the complete default config from code is written back to the disk to be viewed and edited. I've changed the ipc interface a bit to suppress notifications of those writes to prevent a read write infinite loop.I also found that
DynamicWidgetContainer
used a visual text string as config key which resulted in config keys with spaces so I now filter them out.CC @spholz