Implement widgets for settings that use basic types
Review Request #2150 — Created Dec. 23, 2022 and submitted
This implements enums, integral types, double, and string. I have not yet implemented flags, and I'm not sure if we need those. The numeric types use spin buttons, though I suppose they could be sliders. The rates/digits/increments are somewhat arbitrary and could probably be adjusted, but seem good enough for now.
I think this should be sufficient for all libpurple plugins. The GTK plugins may or may not be possible. For example,
spellchkhas a full table of replacements. This may work as a
dict[str, str]in a table widget, but this is so far not implemented here. We should probably think about whether that makes sense to handle
dictsemi-generically or whether to expose some kind of GTK extension point as in the old API.
Also note that there are no
GSettingstypes for things like directories or files, so those don't get any special treatment other than a string input. If we do want special handling, we may have to come up with some setting conventions (e.g., a setting name ending in
-dirgets a directory chooser widget instead of an entry automatically, or similar).
gplugin-gtk4-viewer -p gplugin/native-settings-pluginand checked that all the settings had widgets with expected limits, and that setting them then going to another plugin and back preserved the settings. (Note that it does warn once for the unimplemented
Also checked that plugins set up in /r/2131 had some settings.
Re-factor and comment to improve clarity.
Note that after adding the ranged settings to the plugin, I've realized that
doubleare broken in
GtkSpinButton. This is because 64-bit is too large to be represented in a
double, so we'll likely have to move to
GtkEntrywith manual binding. That is not yet implemented here.
And as noted before, the
flagstype is still not implemented.
Revision 2 (+798 -28)