using Gtk 4.0;
using Adw 1;
template $BzBundleInstallDialog: Adw.Dialog {
content-width: 500;
width-request: 360;
height-request: 294;
Adw.Breakpoint {
condition ("max-width: 400px")
setters {
install_label.visible: false;
install_icon.visible: true;
}
}
child: Adw.NavigationView nav_view {
Adw.NavigationPage {
tag: "main";
title: _("Bundle Installation");
child: Adw.ToolbarView {
[top]
Adw.HeaderBar {
title-widget: Label {
label: _("Bundle Installation");
};
show-title: false;
}
content: Stack main_stack {
StackPage {
name: "carousel";
child: Adw.Carousel carousel {
interactive: false;
spacing: 64;
ScrolledWindow {
hscrollbar-policy: never;
propagate-natural-height: true;
hexpand: true;
valign: fill;
Box {
orientation: vertical;
spacing: 16;
valign: start;
halign: fill;
hexpand: true;
margin-top: 12;
margin-bottom: 24;
margin-start: 24;
margin-end: 24;
Box {
orientation: bind $get_header_orientation(template.runtime-repo) as <Gtk.Orientation>;
spacing: 16;
halign: fill;
valign: start;
Image icon {
paintable: bind template.entry as <$BzEntry>.icon-paintable;
visible: bind $invert_boolean(
$is_null(template.entry as <$BzEntry>.icon-paintable) as <bool>
) as <bool>;
use-fallback: true;
pixel-size: 96;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
valign: center;
styles [
"icon-dropshadow",
]
}
Image {
icon-name: "application-x-executable";
pixel-size: 96;
visible: bind $invert_boolean(icon.visible) as <bool>;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
valign: center;
styles [
"icon-dropshadow",
]
}
Box {
orientation: vertical;
spacing: 2;
valign: center;
hexpand: true;
Label {
label: bind template.entry as <$BzEntry>.title;
selectable: true;
wrap: true;
wrap-mode: word_char;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
xalign: 0;
styles [
"title-3",
]
}
Label {
label: bind template.entry as <$BzEntry>.developer;
selectable: true;
wrap: true;
wrap-mode: word_char;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
xalign: 0;
visible: bind $not($is_empty_string(template.entry as <$BzEntry>.developer) as <bool>) as <bool>;
styles [
"dim-label",
]
}
Label {
label: bind $get_version(template.entry as <$BzEntry>.version-history);
selectable: true;
visible: bind $not(
$is_empty_string($get_version(template.entry as <$BzEntry>.version-history) as <string>) as <bool>
) as <bool>;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
xalign: 0;
styles [
"dim-label",
"caption",
]
}
}
Button {
styles [
"suggested-action",
"pill",
]
valign: center;
halign: center;
visible: bind $is_null(template.runtime-repo) as <bool>;
label: C_("Install Controls", "Install");
clicked => $install_cb(template);
}
Box {
visible: bind $not($is_null(template.runtime-repo) as <bool>) as <bool>;
Button install_label {
styles [
"suggested-action",
"pill",
]
valign: center;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
label: C_("Install Controls", "Install");
clicked => $install_cb(template);
}
Button install_icon {
styles [
"suggested-action",
"circular",
"circular-download-pill",
]
valign: center;
visible: false;
halign: bind $get_header_halign(template.runtime-repo) as <Gtk.Align>;
icon-name: "folder-download-symbolic";
clicked => $install_cb(template);
}
}
}
Adw.PreferencesGroup {
margin-top: 12;
Adw.ActionRow {
[prefix]
Image {
icon-name: "drive-harddisk-symbolic";
valign: center;
styles [
"circular-lozenge",
"grey",
]
}
title: bind $get_disk_title(template.entry as <$BzEntry>.installed-size);
subtitle: _("Additional dependencies may take extra space");
}
Adw.ActionRow {
[prefix]
Image safety_icon {
icon-name: bind $get_safety_icon_name(template.entry as <$BzEntry>);
valign: center;
styles [
"circular-lozenge",
]
}
[suffix]
Image {
icon-name: "go-next-symbolic";
}
title: bind $get_safety_rating_label(template.entry);
subtitle: bind $get_safety_subtitle(template.entry);
subtitle-lines: 1;
activatable: true;
activated => $permission_cb();
}
}
Box {
orientation: vertical;
spacing: 4;
visible: bind $not($is_null(template.runtime-repo) as <bool>) as <bool>;
Label {
label: _(
"Installing this app may require adding a new software source. Other apps from this source will show up in Bazaar.\n\nOnly add this source if you're sure you trust it."
);
wrap: true;
wrap-mode: word_char;
selectable: true;
halign: start;
margin-bottom: 6;
styles [
"body",
]
}
Adw.PreferencesGroup {
Adw.ActionRow {
activatable: bind $not(
$is_null(template.runtime-repo as <$BzFlatpakRepo>.homepage) as <bool>
) as <bool>;
activated => $repo_cb();
child: Box {
margin-top: 8;
margin-bottom: 8;
margin-start: 8;
margin-end: 16;
spacing: 8;
Image bundle_image {
pixel-size: 64;
}
Box {
orientation: vertical;
spacing: 2;
hexpand: true;
Label {
label: bind template.runtime-repo as <$BzFlatpakRepo>.title;
halign: start;
ellipsize: end;
styles [
"heading",
]
}
Label description {
label: bind $get_repo_blurb(template.runtime-repo as <$BzFlatpakRepo>.description, template.runtime-repo as <$BzFlatpakRepo>.comment) as <string>;
visible: bind $not($is_empty_string(description.label) as <bool>) as <bool>;
wrap: true;
halign: start;
wrap-mode: word_char;
lines: 2;
ellipsize: end;
margin-top: 2;
}
Label {
halign: start;
label: bind $format_url(template.runtime-repo as <$BzFlatpakRepo>.url);
ellipsize: end;
styles [
"accent",
"caption",
]
}
}
Image {
icon-name: "external-link-symbolic";
margin-start: 8;
visible: bind $not(
$is_null(template.runtime-repo as <$BzFlatpakRepo>.homepage) as <bool>
) as <bool>;
}
};
}
}
}
}
}
Box page_progress {
orientation: vertical;
spacing: 12;
valign: center;
halign: fill;
margin-top: 24;
margin-bottom: 24;
margin-start: 48;
margin-end: 48;
Image loading_icon {
paintable: bind template.entry as <$BzEntry>.icon-paintable;
visible: bind $invert_boolean(
$is_null(template.entry as <$BzEntry>.icon-paintable) as <bool>
) as <bool>;
pixel-size: 128;
margin-bottom: 12;
styles [
"icon-dropshadow",
]
}
Image {
icon-name: "application-x-executable";
pixel-size: 128;
visible: bind $invert_boolean(loading_icon.visible) as <bool>;
margin-bottom: 12;
styles [
"icon-dropshadow",
]
}
Label {
label: bind template.entry as <$BzEntry>.title;
selectable: true;
wrap: true;
wrap-mode: word_char;
halign: center;
styles [
"title-3",
]
}
ProgressBar progress_bar {
margin-top: 16;
pulse-step: 0.05;
width-request: 250;
}
}
ScrolledWindow page_finish {
Box {
orientation: vertical;
spacing: 8;
valign: center;
halign: fill;
margin-top: 24;
margin-bottom: 24;
margin-start: 24;
margin-end: 24;
Image end_icon {
paintable: bind template.entry as <$BzEntry>.icon-paintable;
visible: bind $invert_boolean(
$is_null(template.entry as <$BzEntry>.icon-paintable) as <bool>
) as <bool>;
pixel-size: 128;
margin-bottom: 12;
styles [
"icon-dropshadow",
]
}
Image {
icon-name: "application-x-executable";
pixel-size: 128;
visible: bind $invert_boolean(end_icon.visible) as <bool>;
margin-bottom: 12;
styles [
"icon-dropshadow",
]
}
Label {
label: bind template.entry as <$BzEntry>.title;
selectable: true;
wrap: true;
wrap-mode: word_char;
halign: center;
styles [
"title-3",
]
}
Label {
label: _("Successfully Installed!");
selectable: true;
halign: center;
margin-bottom: 16;
margin-top: 8;
styles [
"dim-label",
]
}
Box {
width-request: 40;
orientation: vertical;
spacing: 8;
margin-top: 8;
halign: center;
Button open_btn {
styles [
"suggested-action",
"pill",
]
halign: fill;
label: _("Open");
clicked => $run_cb(template);
}
Button show_in_store_btn {
styles [
"pill",
]
halign: fill;
label: _("Show App Details");
clicked => $show_cb(template);
}
}
}
}
};
}
StackPage {
name: "installed";
child: Box {
orientation: vertical;
spacing: 8;
valign: center;
halign: fill;
margin-top: 24;
margin-bottom: 24;
margin-start: 24;
margin-end: 24;
Image installed_icon {
paintable: bind template.entry as <$BzEntry>.icon-paintable;
visible: bind $invert_boolean(
$is_null(template.entry as <$BzEntry>.icon-paintable) as <bool>
) as <bool>;
pixel-size: 128;
margin-bottom: 12;
}
Image {
icon-name: "application-x-executable";
pixel-size: 128;
visible: bind $invert_boolean(installed_icon.visible) as <bool>;
margin-bottom: 12;
}
Label {
label: bind template.entry as <$BzEntry>.title;
selectable: true;
wrap: true;
wrap-mode: word_char;
halign: center;
styles [
"title-3",
]
}
Label {
label: _("Already Installed");
selectable: true;
styles [
"dim-label",
"caption",
]
halign: center;
}
Box {
orientation: vertical;
spacing: 8;
margin-top: 24;
halign: center;
Button {
styles [
"suggested-action",
"pill",
]
halign: fill;
label: _("Open");
clicked => $run_cb(template);
}
Button {
styles [
"pill",
]
halign: fill;
label: _("Show App Details");
clicked => $show_cb(template);
}
}
};
}
StackPage {
name: "error";
child: Adw.StatusPage error_status {
icon-name: "sad-computer-symbolic";
title: _("Installation Failed");
};
}
};
};
}
};
}