This commit is contained in:
bleakgrey 2018-05-16 14:27:18 +03:00
parent 44aa22c06e
commit 2b268dac81
2 changed files with 5 additions and 23 deletions

View File

@ -55,23 +55,6 @@ public enum Tootle.NotificationType {
assert_not_reached();
}
}
public string get_desc_plain (Account? account) {
switch (this) {
case MENTION:
return _("%s mentioned you").printf (account.display_name);
case REBLOG:
return _("%s boosted your toot").printf (account.display_name);
case FAVORITE:
return _("%s favorited your toot").printf (account.display_name);
case FOLLOW:
return _("%s now follows you").printf (account.display_name);
case FOLLOW_REQUEST:
return _("%s wants to follow you").printf (account.display_name);
default:
assert_not_reached();
}
}
public string get_icon () {
switch (this) {

View File

@ -67,12 +67,11 @@ public class Tootle.Notificator : GLib.Object {
}
private void toast (Notification obj) {
var notification = new GLib.Notification (obj.type.get_desc_plain (obj.account));
if (obj.status != null) {
var desc = obj.status.content;
Regex tags = new Regex("<(.|\n)*?>", RegexCompileFlags.CASELESS);
notification.set_body (tags.replace(desc, -1, 0, ""));
}
var tags = new Regex("<(.|\n)*?>", RegexCompileFlags.CASELESS);
var title = tags.replace(obj.type.get_desc (obj.account), -1, 0, "");
var notification = new GLib.Notification (title);
if (obj.status != null)
notification.set_body (tags.replace(obj.status.content, -1, 0, ""));
Tootle.app.send_notification (Tootle.app.application_id + ":" + obj.id.to_string (), notification);
}