init

Function init 

Source
pub fn init() -> Result<(), BoolError>
Examples found in repository?
examples/hello-world.rs (line 13)
7fn main() {
8    let application = Application::builder()
9        .application_id("com.example.FirstAdwaitaApp")
10        .build();
11
12    application.connect_startup(|_| {
13        adw::init().unwrap();
14    });
15
16    application.connect_activate(|app| {
17        // ActionRows are only available in Adwaita
18        let row = ActionRow::builder()
19            .activatable(true)
20            .selectable(false)
21            .title("Click me")
22            .build();
23        row.connect_activated(|_| {
24            eprintln!("Clicked!");
25        });
26
27        let list = ListBox::builder()
28            .margin_top(32)
29            .margin_end(32)
30            .margin_bottom(32)
31            .margin_start(32)
32            // the content class makes the list look nicer
33            .css_classes(vec![String::from("content")])
34            .build();
35        list.append(&row);
36
37        // Combine the content in a box
38        let content = Box::new(Orientation::Vertical, 0);
39        // Adwaitas' ApplicationWindow does not include a HeaderBar
40        content.append(
41            &HeaderBar::builder()
42                .title_widget(&adw::WindowTitle::new("First App", ""))
43                .build(),
44        );
45        content.append(&list);
46
47        let window = ApplicationWindow::builder()
48            .application(app)
49            .default_width(350)
50            // add content to window
51            .content(&content)
52            .build();
53        window.show();
54    });
55
56    application.run();
57}