178 lines
4.1 KiB
Plaintext
178 lines
4.1 KiB
Plaintext
using Gtk 4.0;
|
|
using Adw 1;
|
|
|
|
template $Window: Adw.ApplicationWindow {
|
|
title: _("Cartridges");
|
|
default-width: 920;
|
|
default-height: 700;
|
|
|
|
ShortcutController {
|
|
Shortcut {
|
|
trigger: "<Control>f";
|
|
action: "action(win.search)";
|
|
}
|
|
|
|
Shortcut {
|
|
trigger: "<Control>h";
|
|
action: "action(win.show-hidden)";
|
|
}
|
|
|
|
Shortcut {
|
|
trigger: "<Control>w";
|
|
action: "action(window.close)";
|
|
}
|
|
}
|
|
|
|
content: Adw.ToolbarView {
|
|
[top]
|
|
Adw.HeaderBar {
|
|
title-widget: Adw.Clamp clamp {
|
|
tightening-threshold: bind clamp.maximum-size;
|
|
|
|
child: CenterBox {
|
|
hexpand: true;
|
|
|
|
center-widget: SearchEntry search_entry {
|
|
hexpand: true;
|
|
placeholder-text: _("Search games");
|
|
search-started => $_search_started();
|
|
search-changed => $_search_changed();
|
|
stop-search => $_stop_search();
|
|
};
|
|
|
|
end-widget: MenuButton {
|
|
icon-name: "filter-symbolic";
|
|
tooltip-text: _("Sort & Filter");
|
|
margin-start: 6;
|
|
|
|
menu-model: menu {
|
|
section {
|
|
label: _("Sort");
|
|
|
|
item {
|
|
label: _("Last Played");
|
|
action: "win.sort";
|
|
target: "last_played";
|
|
}
|
|
|
|
item {
|
|
label: _("A-Z");
|
|
action: "win.sort";
|
|
target: "a-z";
|
|
}
|
|
|
|
item {
|
|
label: _("Z-A");
|
|
action: "win.sort";
|
|
target: "z-a";
|
|
}
|
|
|
|
item {
|
|
label: _("Newest");
|
|
action: "win.sort";
|
|
target: "newest";
|
|
}
|
|
|
|
item {
|
|
label: _("Oldest");
|
|
action: "win.sort";
|
|
target: "oldest";
|
|
}
|
|
}
|
|
|
|
section {
|
|
item (_("Show Hidden Games"), "win.show-hidden")
|
|
}
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
[end]
|
|
MenuButton {
|
|
icon-name: "open-menu-symbolic";
|
|
tooltip-text: _("Main Menu");
|
|
primary: true;
|
|
|
|
menu-model: menu {
|
|
item (_("About Cartridges"), "app.about")
|
|
};
|
|
}
|
|
}
|
|
|
|
content: ScrolledWindow {
|
|
child: GridView grid {
|
|
name: "grid";
|
|
|
|
model: NoSelection {
|
|
model: SortListModel {
|
|
sorter: CustomSorter sorter {};
|
|
|
|
model: FilterListModel {
|
|
filter: EveryFilter {
|
|
AnyFilter {
|
|
StringFilter {
|
|
expression: expr item as <$Game>.name;
|
|
search: bind template.search-text;
|
|
}
|
|
|
|
StringFilter {
|
|
expression: expr item as <$Game>.developer;
|
|
search: bind template.search-text;
|
|
}
|
|
}
|
|
|
|
BoolFilter {
|
|
expression: expr item as <$Game>.hidden;
|
|
invert: bind template.show-hidden inverted;
|
|
}
|
|
|
|
BoolFilter {
|
|
expression: expr item as <$Game>.removed;
|
|
invert: true;
|
|
}
|
|
|
|
BoolFilter {
|
|
expression: expr item as <$Game>.blacklisted;
|
|
invert: true;
|
|
}
|
|
};
|
|
|
|
model: bind template.games;
|
|
};
|
|
};
|
|
};
|
|
|
|
factory: BuilderListItemFactory {
|
|
template ListItem {
|
|
child: Box {
|
|
orientation: vertical;
|
|
spacing: 12;
|
|
|
|
Picture {
|
|
paintable: bind template.item as <$Game>.cover;
|
|
width-request: 200;
|
|
height-request: 300;
|
|
halign: center;
|
|
|
|
styles [
|
|
"card",
|
|
]
|
|
}
|
|
|
|
Label {
|
|
label: bind template.item as <$Game>.name;
|
|
ellipsize: middle;
|
|
}
|
|
};
|
|
}
|
|
};
|
|
};
|
|
};
|
|
|
|
styles [
|
|
"view",
|
|
]
|
|
};
|
|
}
|