Crates.io | glade-bindgen |
lib.rs | glade-bindgen |
version | 1.2.1 |
source | src |
created_at | 2020-12-06 19:01:52.439486 |
updated_at | 2022-01-04 00:00:29.626385 |
description | library to generate gtk glade bind |
homepage | |
repository | https://github.com/djdisodo/glade-bindgen |
max_upload_size | |
id | 320192 |
size | 13,113 |
You can generate glade bind with build script
#Cargo.toml
[build-dependencies]
glade-bindgen = "1.2"
#build.rs
fn main() {
glade_bindgen::generate_bind_build_script("src/path_to_glade_files", true);
//disable generating get() method if false===========================^^^^
}
For example, if you have example.glade
at src/path_to_glade_files
,
it will generate struct path_to_glade_files::Example
#src/main.rs
pub mod path_to_glade_files; //you need to include module
use path_to_glade_files::Example;
fn main() {
let button: >k::Button = &Example::get().your_button_id;
//you can use editor's autocompletion here ^^^^^^^^^^^^
}
You can also use it as owned value
let example = Example::new();
let button: >k::Button = &example.your_button_id;
//you can use editor's autocompletion here ^^^^^^