gla
gladis
cargo install gladis
gla

gladis

[Deprecated] Easily import Glade-generated UI files into Rust code.

by Agathe Porte

2.1.2 (see all)License:MIT OR Apache-2.0
cargo install gladis
Readme

gladis

Maintenance status is "deprecated" Build Latest version Documentation License REUSE status

Easily import Glade-generated UI files into Rust code.

This crate is DEPRECATED.
Use CompositeTemplate from gtk3-macros or gtk4-macros official GTK crates.

Usage

In order to use Gladis, you have to add the following dependencies into your project's Cargo.toml file:

[dependencies]
gladis = "2.1.2"

After this is done, you can enjoy the Gladis derive!

#[derive(Gladis, Clone)]
pub struct Window {
    pub window: gtk::ApplicationWindow,
    pub label: gtk::Label,
}


impl Window {
pub fn new() -> Self {
Self::from_resource("/dev/null/hello_builder/window.ui").unwrap()
}
}

impl Window { pub fn new() -> Self { Self::from_resource("/dev/null/hello_builder/window.ui").unwrap() } }

Without Gladis, you would have to manually parse each of the Glade entries.

pub struct Window {
    pub window: gtk::ApplicationWindow,
    pub label: gtk::Label,
}


impl Window {
pub fn new() -> Self {
let builder = gtk::Builder::from_resource("/dev/null/hello_builder/window.ui");
let window: gtk::ApplicationWindow = builder
.object("window")
.expect("Failed to find the window object");



    let label: gtk::Label = builder
        .object("label")
        .expect("Failed to find the label object");

    Self { window, label }
}




}

}

Relm support

This crate is compatible with Relm, a popular framework for writing UIs with GTK+. See the examples/relm directory, and give it a shot!

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

GitHub Stars

27

LAST COMMIT

2mos ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
2.1.2
2mos ago
2.1.1
2mos ago
2.1.0
2mos ago
2.0.0
4mos ago
No alternatives found
No tutorials found
Add a tutorial