using Gtk 4.0;

menu popover_menu {
  item {
    label: _("Remove");
    action: "history.remove";
  }
}

template $HistoryItem: Button {
  margin-start: 2;
  margin-end: 2;
  margin-top: 2;
  margin-bottom: 2;
  tooltip-text: bind $tooltip(template.color) as <string>;
  action-name: "history.clicked";

  styles [
    "shadow"
  ]

  child: Gtk.Box {
    Gtk.GestureClick right_click_gesture {
      button: 3;
      pressed => $show_popover() swapped;
    }

    Gtk.GestureLongPress press_gesture {
      touch-only: true;
      pressed => $show_popover() swapped;
    }

    Gtk.PopoverMenu popover {
      halign: start;
      has-arrow: false;
      menu-model: popover_menu;
    }
  };
}
