File: simple-example.vala

package info (click to toggle)
gtk4-layer-shell 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 832 kB
  • sloc: ansic: 5,618; xml: 417; python: 407; makefile: 9
file content (26 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Gtk;
using GtkLayerShell;

int main(string[] argv) {
    var app = new Gtk.Application(
        "com.github.wmww.gtk4-layer-shell.vala-example",
        GLib.ApplicationFlags.FLAGS_NONE
        );

    app.activate.connect(() => {
        var window = new Gtk.ApplicationWindow(app);
        GtkLayerShell.init_for_window(window);
        GtkLayerShell.auto_exclusive_zone_enable(window);
        GtkLayerShell.set_margin(window, GtkLayerShell.Edge.TOP, 10);
        GtkLayerShell.set_margin(window, GtkLayerShell.Edge.BOTTOM, 10);
        GtkLayerShell.set_anchor(window, GtkLayerShell.Edge.BOTTOM, true);
        var button = new Gtk.Button.with_label("Hello, World!");
        button.clicked.connect(() => {
            window.close();
        });
        window.set_child(button);
        window.present();
    });

    return app.run(argv);
}