def METHOD_NAME(self, entry):
    text = entry.get_text().strip()
    if self._required and len(text) == 0:
        entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY,
                                      "gtk-cancel")
    else:
        entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY,
                                      "gtk-apply")