-
-
Notifications
You must be signed in to change notification settings - Fork 61
Add ParamSpec bindings #352
Conversation
src/gobject/auto/param_spec.rs
Outdated
pub struct ParamSpec(Object<ffi::GParamSpec, ffi::GParamSpecClass>); | ||
|
||
match fn { | ||
get_type => || ffi::intern(), |
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 need a way to override the get_type functions. This one here has a constant, G_TYPE_PARAMSPEC
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.
Agree
For some reason things like Also how would we best override the |
Gir_GObject.toml
Outdated
status = "generate" | ||
[[object.function]] | ||
name = "sink" | ||
ignore = true # memory management |
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.
Please move comment to previous line
IMHO config string |
While at it, I would add the same for ref/copy/unref/free functions the same way. That allows me to get rid of some more manual bindings |
Thanks in advance |
src/gobject/auto/param_spec.rs
Outdated
use translate::*; | ||
|
||
glib_wrapper! { | ||
pub struct ParamSpec(Object<ffi::GParamSpec, ffi::GParamSpecClass>); |
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.
This is actually not a GObject
but another fundamental type. So I guess we don't really get around manually binding this one after all...
Will update the PR accordingly
Updated accordingly and made use of it in |
src/object.rs
Outdated
return Err(BoolError("property not found")); | ||
} | ||
}, |
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.
comma unneeded
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.
done
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.
Strange, I still see it, and in other match self.find_property
down too.
Seems you forgot to push 😉
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.
I indeed forgot to push it, yes :) Thanks
src/object.rs
Outdated
if !writeable { | ||
return Err(BoolError("property is not writeable")); | ||
} | ||
if !pspec.get_flags().contains(::ParamFlags::WRITABLE) { |
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.
Maybe flags need check for CONSTRUCT_xxx
, some properties have WRITABLE and CONSTRUCT_ONLY, so actually not writable
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.
Thanks, good idea :) Will change in a few minutes
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.
done
All green :) |
👍 then |
src/param_spec.rs
Outdated
} | ||
} | ||
|
||
|
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.
Extra empty line.
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.
fixed
src/param_spec.rs
Outdated
from_glib_none(ffi::g_param_spec_variant(name.to_glib_none().0, nick.to_glib_none().0, blurb.to_glib_none().0, type_.to_glib_none().0, default_value.to_glib_none().0, flags.to_glib())) | ||
} | ||
} | ||
|
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.
Extra empty line.
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.
fixed
And implement some existing functions based on this and ParamSpec to get rid of some unsafe code
And green again :) |
Thanks! |
No description provided.