Add toot deletion
This commit is contained in:
parent
b6d265e6a8
commit
2e45aa825e
|
@ -120,4 +120,14 @@ public class Tootle.Status {
|
||||||
Tootle.network.queue (msg);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,6 +261,8 @@ public class Tootle.StatusWidget : Gtk.EventBox {
|
||||||
menu.destroy ();
|
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"));
|
var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser"));
|
||||||
item_open_link.activate.connect (() => Utils.open_url (status.url));
|
item_open_link.activate.connect (() => Utils.open_url (status.url));
|
||||||
var item_copy_link = new Gtk.MenuItem.with_label (_("Copy Link"));
|
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);
|
var sanitized = Utils.escape_html (status.content);
|
||||||
Utils.copy (sanitized);
|
Utils.copy (sanitized);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.status.is_owned ()) {
|
||||||
|
menu.add (item_delete);
|
||||||
|
menu.add (new Gtk.SeparatorMenuItem ());
|
||||||
|
}
|
||||||
|
|
||||||
menu.add (item_open_link);
|
menu.add (item_open_link);
|
||||||
menu.add (new Gtk.SeparatorMenuItem ());
|
menu.add (new Gtk.SeparatorMenuItem ());
|
||||||
menu.add (item_copy_link);
|
menu.add (item_copy_link);
|
||||||
|
|
Loading…
Reference in New Issue