2018-04-17 14:01:55 +02:00
|
|
|
public enum Tootle.NotificationType {
|
|
|
|
MENTION,
|
|
|
|
REBLOG,
|
|
|
|
FAVORITE,
|
2018-05-09 17:32:53 +02:00
|
|
|
FOLLOW,
|
2018-10-23 12:05:24 +02:00
|
|
|
FOLLOW_REQUEST, // Internal
|
|
|
|
WATCHLIST; // Internal
|
2018-04-17 14:01:55 +02:00
|
|
|
|
|
|
|
public string to_string() {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
|
|
|
return "mention";
|
|
|
|
case REBLOG:
|
|
|
|
return "reblog";
|
|
|
|
case FAVORITE:
|
|
|
|
return "favourite";
|
|
|
|
case FOLLOW:
|
|
|
|
return "follow";
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
|
|
|
return "follow_request";
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
|
|
|
return "watchlist";
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static NotificationType from_string (string str) {
|
|
|
|
switch (str) {
|
|
|
|
case "mention":
|
|
|
|
return MENTION;
|
|
|
|
case "reblog":
|
|
|
|
return REBLOG;
|
|
|
|
case "favourite":
|
|
|
|
return FAVORITE;
|
|
|
|
case "follow":
|
|
|
|
return FOLLOW;
|
2018-05-09 17:32:53 +02:00
|
|
|
case "follow_request":
|
|
|
|
return FOLLOW_REQUEST;
|
2018-07-14 10:37:41 +02:00
|
|
|
case "watchlist":
|
|
|
|
return WATCHLIST;
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string get_desc (Account? account) {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> mentioned you").printf (account.url, account.display_name);
|
|
|
|
case REBLOG:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> boosted your toot").printf (account.url, account.display_name);
|
|
|
|
case FAVORITE:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> favorited your toot").printf (account.url, account.display_name);
|
|
|
|
case FOLLOW:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> now follows you").printf (account.url, account.display_name);
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> wants to follow you").printf (account.url, account.display_name);
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
|
|
|
return _("<a href=\"%s\"><b>%s</b></a> posted a toot").printf (account.url, account.display_name);
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string get_icon () {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
2018-04-17 14:01:55 +02:00
|
|
|
return "user-available-symbolic";
|
|
|
|
case REBLOG:
|
2018-06-03 18:44:36 +02:00
|
|
|
return "media-playlist-repeat-symbolic";
|
2018-04-17 14:01:55 +02:00
|
|
|
case FAVORITE:
|
|
|
|
return "help-about-symbolic";
|
|
|
|
case FOLLOW:
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
2018-04-17 14:01:55 +02:00
|
|
|
return "contact-new-symbolic";
|
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|