🏡 index : quine-global-labs/bazaar.git

using Gtk 4.0;
using Adw 1;

template $BzTransactionListDialog: Adw.AlertDialog {
  extra-child: ScrolledWindow {
    width-request: 300;
    propagate-natural-height: true;
    overflow: hidden;
    vexpand: true;
    hscrollbar-policy: never;

    child: Box {
      orientation: vertical;
      spacing: 5;

      ListView list_view {
        styles [
          "navigation-sidebar",
        ]

        model: NoSelection selection_model {};

        factory: BuilderListItemFactory {
          template ListItem {
            activatable: false;

            child: Box {
              orientation: horizontal;
              margin-top: 5;
              margin-bottom: 5;
              spacing: 6;

              Image {
                icon-size: large;
                paintable: bind template.item as <$BzEntry>.icon-paintable;
                visible: bind $invert_boolean($is_null(template.item as <$BzEntry>.icon-paintable) as <bool>) as <bool>;
              }

              Image {
                icon-size: large;
                icon-name: "application-x-executable";
                visible: bind $is_null(template.item as <$BzEntry>.icon-paintable) as <bool>;
              }

              Box {
                orientation: vertical;
                spacing: 3;

                Label {
                  styles [
                    "heading",
                  ]

                  hexpand: true;
                  xalign: 0.0;
                  ellipsize: end;
                  single-line-mode: true;
                  label: bind template.item as <$BzEntry>.title;
                }

                Label {
                  styles [
                    "dimmed",
                  ]

                  hexpand: true;
                  xalign: 0.0;
                  wrap: true;
                  wrap-mode: word_char;
                  single-line-mode: true;
                  selectable: true;
                  label: bind template.item as <$BzEntry>.id;
                }
              }
            };
          }
        };
      }

      Label secondary_label {
        styles [
          "dimmed",
        ]

        visible: false;
        wrap: true;
        justify: center;
      }
    };
  };
}