File: simple-example.vala

package info (click to toggle)
gtk4-layer-shell 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 616 kB
  • sloc: ansic: 3,537; xml: 417; python: 333; makefile: 9
file content (25 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
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);
}