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(); 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 () { public string get_icon () {
switch (this) { switch (this) {

View File

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