Newer
Older
// SPDX-FileCopyrightText: 2022-2024 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: GPL-3.0-or-later
using Gtk 4.0;
using Adw 1;
Adw.HeaderBar {
SpinButton scorespin {
adjustment: Adjustment {
step-increment: 1;
upper: 200;
};
focusable: true;
tooltip-text: "Score";
}
content: Box {
orientation: vertical;
Stack stack {
StackPage {
name: "empty_page";
child: Adw.StatusPage {
icon-name: "list";
title: "No possibilities";
};
}
StackPage {
name: "list_page";
child: ScrolledWindow {
vexpand: true;
Adw.Clamp {
maximum-size: 600;
tightening-threshold: 400;
ListView listview {
factory: BuilderListItemFactory {
template ListItem {
child: $RugbyPossibilityWidget {
possibility: bind template.item;
tooltip-text: bind $item_tooltip_cb(template.item) as <string>;
};
}
header-factory: BuilderListItemFactory {
template ListHeader {
child: Label {
label: bind $header_label_cb(template.item) as <string>;
halign: start;
}
};
model: NoSelection {
model: $RugbyListStore list_store {
score: bind scorespin.value;
items-changed => $list_store_items_changed_cb();
styles ["rich-list", "card"]
ShortcutController {
scope: local;
Shortcut {
action: "action(win.score-changed)";
arguments: "'up'";
trigger: "<Ctrl>Up|<Ctrl>Right";
}
Shortcut {
action: "action(win.score-changed)";
arguments: "'down'";
trigger: "<Ctrl>Down|<Ctrl>Left";
}
}
}
menu app_menu {
section {
item ("_Preferences", "app.prefs")
item ("_Keyboard Shortcuts", "win.show-help-overlay")