Testing Done: |
|
---|
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,
spellchk
has a full table of replacements. This may work as adict[str, str]
in a table widget, but this is so far not implemented here. We should probably think about whether that makes sense to handledict
semi-generically or whether to expose some kind of GTK extension point as in the old API.Also note that there are no
GSettings
types 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-dir
gets a directory chooser widget instead of an entry automatically, or similar).
Ran
gplugin-gtk4-viewer -p gplugin/native-settings-plugin
and 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 unimplementedflags
type.)Also checked that plugins set up in /r/2131 had some settings.
-
-
gplugin-gtk4/gplugin-gtk-plugin-settings-list.c (Diff revision 1) are these guaranted to be non-null?
-
gplugin-gtk4/gplugin-gtk-plugin-settings-list.c (Diff revision 1) What happens if there is no description set? Do we get an empty tooltip?
-
gplugin-gtk4/gplugin-gtk-plugin-settings-list.c (Diff revision 1) might be useful to put the type name in the label
Change Summary:
Re-factor and comment to improve clarity.
Note that after adding the ranged settings to the plugin, I've realized that
(u)int64
anddouble
are broken inGtkSpinButton
. This is because 64-bit is too large to be represented in adouble
, so we'll likely have to move toGtkEntry
with manual binding. That is not yet implemented here.And as noted before, the
flags
type is still not implemented.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+798 -28) |