axum-server: Serve whole directory
[learn-rust.git] / gtk4-hello-world / src / main.rs
1 use gtk::prelude::*;
2 use gtk::{
3     Application, ApplicationWindow,
4     Button
5 };
6
7 fn build_ui(app: &Application) {
8     let button = Button::builder()
9         .label("Click me!")
10         .margin_top(12)
11         .margin_bottom(12)
12         .margin_start(12)
13         .margin_end(12)
14         .build();
15
16     button.connect_clicked(|button| {
17         button.set_label("Hello world!");
18     });
19
20     let window = ApplicationWindow::builder()
21         .application(app)
22         .title("Hello GTK")
23         .child(&button)
24         .build();
25
26     window.present();
27 }
28
29 fn main() {
30     let app = Application::builder()
31         .application_id("ork.gtk-rs.example")
32         .build();
33
34     app.connect_activate(build_ui);
35     app.run();
36 }