using Gtk 4.0;

template $ExmSearchRow: Gtk.ListBoxRow {
  styles [
    "search-row"
  ]

  activatable: true;
  action-name: "win.show-detail";

  Gtk.Box header {
    styles [
      "header"
    ]

    hexpand: true;
    spacing: 10;

    Gtk.Grid {
      hexpand: true;
      column-spacing: 10;

      Gtk.Box {
        hexpand: true;
        orientation: vertical;
        valign: center;

        Gtk.Label title {
          styles [
            "title"
          ]

          ellipsize: end;
          xalign: 0;
          label: bind template.search-result as <$ExmSearchResult>.name;
        }

        Gtk.Label subtitle {
          styles [
            "subtitle"
          ]

          ellipsize: end;
          xalign: 0;
          label: bind template.search-result as <$ExmSearchResult>.creator;
        }

        layout {
          row: 0;
          column: 1;
        }
      }

      Gtk.Label description_label {
        styles [
          "dim-label"
        ]

        margin-top: 5;
        single-line-mode: true;
        xalign: 0;
        wrap: true;
        wrap-mode: word_char;
        ellipsize: end;
        lines: 2;
        label: bind template.search-result as <$ExmSearchResult>.description;

        layout {
          row: 1;
          column: 1;
        }
      }
    }

    $ExmInstallButton install_btn {
      valign: center;
      halign: end;
      clicked => $install_remote();
    }

    Gtk.Image {
      styles [
        "expander-row-arrow"
      ]

      valign: center;
      halign: end;
      icon-name: "go-next-symbolic";
    }
  }

  accessibility {
    described-by: description_label;
  }
}
