-
Notifications
You must be signed in to change notification settings - Fork 33
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
Missing bindings for GLib.Variant #843
Comments
@cameronwhite: I wonder if there should be more Or if they should be static methods instead to avoid unnecessary memory allocation. |
I think at least some sort of constant is useful so that it's more discoverable - otherwise you have to look up the GTK docs to find the right string to use and might make a typo |
With constant you mean a string constant? So you write: We could have a static method instead: Or a static property: I think I would avoid caching a lot of instances. As new instances are created in all 3 scenarios I would probably not use the static property as it is not obvious that a new instance is created on every call. What do you think of implementing a custom equality so that two This should probably be a separate PR and not be part of #942. Edit: the more i think about it the more I think having helper for the types is not useful as it is possible to create arbitrary complex types and the helpers would never cover all cases. This is probably the reason why there are no helpers in c, too. It is probably best to add extensive documentation to the class. I think I would prefer a builder class (see #954). |
I think a separate build class is probably fine too, that also makes it more clearly separated as a convenience on top of the actual GTK API |
A boolean variant can now be created:
In regard to |
A full sweep is probably needed to make sure there are bindings for all the variant types, but the ones I found porting Pinta were:
Variant.Create(bool)
andbool GetBool()
VariantType
constants would be convenient, currently only"s"
and"v"
have named constants"a{sv}"
variant type mapping strings to variants. It's only possible currently to construct an empty one viaVariant.CreateEmptyDictionary()
The text was updated successfully, but these errors were encountered: