diff --git a/src/API/Status.vala b/src/API/Status.vala index 8a1e767..208c9da 100644 --- a/src/API/Status.vala +++ b/src/API/Status.vala @@ -119,5 +119,15 @@ public class Tootle.Status { }); Tootle.network.queue (msg); } + + public void poof (){ + var msg = new Soup.Message("DELETE", "%s/api/v1/statuses/%lld".printf (Tootle.settings.instance_url, id)); + msg.priority = Soup.MessagePriority.HIGH; + msg.finished.connect (() => { + Tootle.app.toast (_("Poof!")); + Tootle.network.status_removed (this.id); + }); + Tootle.network.queue (msg); + } } diff --git a/src/Widgets/StatusWidget.vala b/src/Widgets/StatusWidget.vala index 7e9aedb..836afcc 100644 --- a/src/Widgets/StatusWidget.vala +++ b/src/Widgets/StatusWidget.vala @@ -261,6 +261,8 @@ public class Tootle.StatusWidget : Gtk.EventBox { menu.destroy (); }); + var item_delete = new Gtk.MenuItem.with_label (_("Delete")); + item_delete.activate.connect (() => status.poof ()); var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser")); item_open_link.activate.connect (() => Utils.open_url (status.url)); var item_copy_link = new Gtk.MenuItem.with_label (_("Copy Link")); @@ -270,6 +272,12 @@ public class Tootle.StatusWidget : Gtk.EventBox { var sanitized = Utils.escape_html (status.content); Utils.copy (sanitized); }); + + if (this.status.is_owned ()) { + menu.add (item_delete); + menu.add (new Gtk.SeparatorMenuItem ()); + } + menu.add (item_open_link); menu.add (new Gtk.SeparatorMenuItem ()); menu.add (item_copy_link);