Skip to content
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

[HELP] Book: Ch. 5.4 Properties - #[derived_properties] Requires glib-macros #1438

Closed
cornmonger opened this issue Jul 26, 2023 · 2 comments
Closed

Comments

@cornmonger
Copy link

In Chapter 5.4: Adding Properties to Custom GObjects, the example makes use of the derived_properties macro:

// [...]
use glib::Properties;
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;

// [...]

#[glib::derived_properties]
impl ObjectImpl for CustomButton {

The macro call doesn't resolve for me if I simply follow the instructions in Chapter 2: Project Setup. I have to manually cargo add glib-macros and then alter the example with:

// [...]
use glib_macros;

// [...]

// Trait shared by all GObjects
#[glib_macros::derived_properties]
impl ObjectImpl for CustomButton {

After that everything compiles and runs properly.

I'm I doing something wrong or is this a documentation problem?
Thanks!

@cornmonger cornmonger changed the title [HELP] Book: Ch. 5.4 Properties - #[derive_properties] Requires glib-macros [HELP] Book: Ch. 5.4 Properties - #[derived_properties] Requires glib-macros Jul 26, 2023
@bilelmoussaoui
Copy link
Member

See #1435

@cornmonger
Copy link
Author

Thanks. That answers another problem I ran into later as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants