using Gtk 4.0;
using Adw 1;
template $BzTransactionTile: $BzListTile {
child: Adw.Bin {
child: Box {
orientation: vertical;
Box {
orientation: horizontal;
spacing: 10;
margin-top: 10;
margin-bottom: 10;
margin-start: 10;
margin-end: 4;
Image {
paintable: bind $get_main_icon(template.tracker) as <$GdkPaintable>;
pixel-size: 64;
valign: start;
halign: start;
styles [
"icon-dropshadow",
]
}
Box {
valign: center;
orientation: vertical;
Label {
styles [
"transaction-tile-title",
]
hexpand: true;
ellipsize: end;
xalign: 0.0;
label: bind template.tracker as <$BzTransactionEntryTracker>.entry as <$BzEntry>.title as <string>;
}
Revealer progress_bars_revealer {
reveal-child: bind $list_has_items(template.tracker as <$BzTransactionEntryTracker>.current-ops) as <bool>;
transition-type: slide_down;
styles [
"no-min-height",
]
child: ListView {
styles [
"navigation-sidebar",
"installed-list-view",
"user-data-list-view"
]
visible: bind $invert_boolean($is_transaction_tracker_removal(template.tracker) as <bool>) as <bool>;
model: NoSelection {
model: bind template.tracker as <$BzTransactionEntryTracker>.current-ops;
};
factory: BuilderListItemFactory {
template ListItem {
activatable: false;
child: Box {
orientation: vertical;
spacing: 3;
$BzProgressBar {
hexpand: "true";
fraction: bind template.item as <$BzTransactionTask>.last-progress as <$BzBackendTransactionOpProgressPayload>.progress;
}
Label {
styles [
"dimmed",
"caption-heading",
"numeric",
]
hexpand: true;
xalign: 0;
ellipsize: end;
single-line-mode: true;
label: bind $format_download_progress(template.item as <$BzTransactionTask>.last-progress as <$BzBackendTransactionOpProgressPayload>.bytes-transferred, template.item as <$BzTransactionTask>.op as <$BzBackendTransactionOpPayload>.download-size) as <string>;
}
};
}
};
};
}
Revealer {
reveal-child: bind progress_bars_revealer.reveal-child inverted;
child: Box {
orientation: horizontal;
layout-manager: Adw.WrapLayout {
child-spacing: 4;
line-spacing: 0;
};
Box {
visible: bind $is_entry_addon(template.tracker) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"green",
"colored",
"small-pill",
"download-size-pill",
]
Image {
icon-name: "puzzle-piece-symbolic";
pixel-size: 12;
}
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("App Add-On");
}
}
Box {
visible: bind $is_both($is_entry_runtime(template.tracker) as <bool>, $invert_boolean($is_entry_addon(template.tracker) as <bool>) as <bool>) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"blue",
"colored",
"small-pill",
"download-size-pill",
]
Image {
icon-name: "application-x-sharedlib-symbolic";
pixel-size: 12;
}
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("Runtime");
}
}
Box {
visible: bind $is_queued(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"grey",
"colored",
"small-pill",
"download-size-pill",
]
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("In Queue");
}
}
Box {
visible: bind $is_completed(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"grey",
"colored",
"small-pill",
"download-size-pill",
]
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("Done");
}
}
Box {
visible: bind $is_cancelled(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"grey",
"colored",
"small-pill",
"download-size-pill",
]
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("Cancelled");
}
}
Box {
visible: bind $is_transaction_tracker_errored(template.tracker as <$BzTransactionEntryTracker>.finished-ops) as <bool>;
halign: start;
spacing: 4;
margin-top: 8;
styles [
"error",
"colored",
"small-pill",
"download-size-pill",
]
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: _("Error");
}
}
Box {
halign: start;
spacing: 4;
margin-top: 8;
styles [
"installed-pill",
"small-pill",
"download-size-pill",
]
visible: bind $logical_and($is_transaction_tracker_removal(template.tracker) as <bool>, $is_completed(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>) as <bool>;
Label {
styles [
"caption-heading",
]
valign: center;
xalign: 0.0;
label: bind $format_removal_size(template.tracker as <$BzTransactionEntryTracker>.entry as <$BzEntry>.installed-size) as <string>;
}
}
};
}
}
Box {
orientation: horizontal;
spacing: 5;
Button {
visible: bind $is_both(
$is_both(
$is_both($is_entry_application(template.tracker as <$BzTransactionEntryTracker>) as <bool>, $is_completed(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>) as <bool>,
$is_transaction_tracker_install(template.tracker as <$BzTransactionEntryTracker>) as <bool>
) as <bool>, template.tracker as <$BzTransactionEntryTracker>.entry as <$BzEntry>.installed as <bool>
) as <bool>;
valign: center;
label: _("Open");
clicked => $run_cb(template);
styles [
"medium-pill",
]
}
Button {
visible: bind $is_ongoing(template.tracker as <$BzTransactionEntryTracker>.status as <$BzTransactionEntryStatus>) as <bool>;
icon-name: "media-playback-stop-symbolic";
valign: center;
tooltip-text: _("Cancel Transaction");
clicked => $cancel_cb(template);
styles [
"flat",
]
}
ToggleButton toggle {
sensitive: bind $invert_boolean($is_empty(template.tracker as <$BzTransactionEntryTracker>.finished-ops) as <bool>) as <bool>;
tooltip-text: _("Show Details");
child: Image {
pixel-size: 14;
icon-name: "go-next-symbolic";
styles [
"accent",
]
};
valign: center;
styles [
"flat",
"circular",
"ops-toggle",
]
}
}
}
Revealer {
reveal-child: bind toggle.active;
child: Box {
orientation: vertical;
styles [
"operations",
]
Separator {}
ListView {
styles [
"navigation-sidebar",
"installed-list-view",
]
model: NoSelection {
model: bind template.tracker as <$BzTransactionEntryTracker>.finished-ops;
};
factory: BuilderListItemFactory {
template ListItem {
activatable: false;
child: Box {
orientation: horizontal;
spacing: 10;
margin-start: 7;
margin-end: 7;
Image {
styles [
"success",
]
valign: center;
icon-name: "check-plain-symbolic";
visible: bind $is_null(template.item as <$BzTransactionTask>.error) as <bool>;
}
Image {
styles [
"error",
]
valign: center;
icon-name: "cross-large-circle-filled-symbolic";
visible: bind $invert_boolean($is_null(template.item as <$BzTransactionTask>.error) as <bool>) as <bool>;
}
Box {
valign: center;
orientation: horizontal;
spacing: 5;
hexpand: true;
Label {
styles [
"dimmed",
]
valign: center;
hexpand: true;
xalign: 0.0;
ellipsize: end;
single-line-mode: true;
label: bind template.item as <$BzTransactionTask>.op as <$BzBackendTransactionOpPayload>.name;
visible: bind $is_null(template.item as <$BzTransactionTask>.error) as <bool>;
}
Label {
styles [
"error",
]
valign: center;
hexpand: true;
xalign: 0.0;
ellipsize: end;
single-line-mode: true;
label: bind template.item as <$BzTransactionTask>.op as <$BzBackendTransactionOpPayload>.name;
visible: bind $invert_boolean($is_null(template.item as <$BzTransactionTask>.error) as <bool>) as <bool>;
tooltip-text: bind template.item as <$BzTransactionTask>.error as <string>;
}
Button {
icon-name: "info-outline-symbolic";
clicked => $error_clicked_cb(template);
visible: bind $invert_boolean($is_null(template.item as <$BzTransactionTask>.error) as <bool>) as <bool>;
tooltip-text: _("Show Error Info");
styles [
"error",
"flat",
]
}
}
};
}
};
}
};
}
};
};
}