Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Conversation

sdroege
Copy link
Member

@sdroege sdroege commented Jul 6, 2018

No description provided.

pub struct ParamSpec(Object<ffi::GParamSpec, ffi::GParamSpecClass>);

match fn {
get_type => || ffi::intern(),
Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@sdroege
Copy link
Member Author

sdroege commented Jul 6, 2018

For some reason things like g_param_spec_bool, g_param_spec_int, etc (all the constructors) are not generated by GIR. Not sure yet why, @EPashkin do you have an idea? If not, I'll look later, don't spend time on it unless you want to :)

Also how would we best override the get_type function? Configuration that takes a string, and that is just put there instead of whatever the GIR says?

Gir_GObject.toml Outdated
status = "generate"
[[object.function]]
name = "sink"
ignore = true # memory management
Copy link
Member

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

@EPashkin
Copy link
Member

EPashkin commented Jul 6, 2018

IMHO config string get_type: Option<String> is enough

@sdroege
Copy link
Member Author

sdroege commented Jul 6, 2018

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

@EPashkin
Copy link
Member

EPashkin commented Jul 6, 2018

Thanks in advance

use translate::*;

glib_wrapper! {
pub struct ParamSpec(Object<ffi::GParamSpec, ffi::GParamSpecClass>);
Copy link
Member Author

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

@sdroege
Copy link
Member Author

sdroege commented Jul 9, 2018

Updated accordingly and made use of it in object.rs a bit

src/object.rs Outdated
return Err(BoolError("property not found"));
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma unneeded

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

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 😉

Copy link
Member Author

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) {
Copy link
Member

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

Copy link
Member Author

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sdroege
Copy link
Member Author

sdroege commented Jul 9, 2018

All green :)

@EPashkin
Copy link
Member

EPashkin commented Jul 9, 2018

👍 then

}
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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()))
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@sdroege
Copy link
Member Author

sdroege commented Jul 9, 2018

And green again :)

@GuillaumeGomez
Copy link
Member

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit b8b98c9 into gtk-rs:master Jul 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants