tootle-linux-client/src/API/StatusVisibility.vala

72 lines
2.0 KiB
Vala
Raw Normal View History

2019-03-11 15:14:37 +01:00
public enum Tootle.API.StatusVisibility {
2018-04-15 13:29:55 +02:00
PUBLIC,
UNLISTED,
PRIVATE,
DIRECT;
2018-10-23 12:05:24 +02:00
public string to_string () {
2018-04-15 13:29:55 +02:00
switch (this) {
case PUBLIC:
return "public";
case UNLISTED:
return "unlisted";
case PRIVATE:
return "private";
case DIRECT:
return "direct";
default:
assert_not_reached();
}
}
2019-03-09 14:06:40 +01:00
2018-05-11 13:28:49 +02:00
public static StatusVisibility from_string (string str) {
switch (str) {
case "public":
return StatusVisibility.PUBLIC;
case "unlisted":
return StatusVisibility.UNLISTED;
case "private":
return StatusVisibility.PRIVATE;
case "direct":
return StatusVisibility.DIRECT;
default:
assert_not_reached();
}
}
2019-03-09 14:06:40 +01:00
2018-10-23 12:05:24 +02:00
public string get_desc () {
2018-04-15 13:29:55 +02:00
switch (this) {
case PUBLIC:
return _("Post to public timelines");
case UNLISTED:
return _("Don\'t post to public timelines");
case PRIVATE:
return _("Post to followers only");
case DIRECT:
return _("Post to mentioned users only");
default:
assert_not_reached();
}
}
2019-03-09 14:06:40 +01:00
2018-10-23 12:05:24 +02:00
public string get_icon () {
2018-04-15 13:29:55 +02:00
switch (this) {
case PUBLIC:
return "network-workgroup-symbolic";
case UNLISTED:
2018-04-15 14:28:23 +02:00
return "view-private-symbolic";
2018-04-15 13:29:55 +02:00
case PRIVATE:
2018-04-15 14:28:23 +02:00
return "security-medium-symbolic";
2018-04-15 13:29:55 +02:00
case DIRECT:
2019-03-09 14:06:40 +01:00
return "user-available-symbolic";
2018-04-15 13:29:55 +02:00
default:
assert_not_reached();
}
}
2019-03-09 14:06:40 +01:00
2018-10-23 12:05:24 +02:00
public static StatusVisibility[] get_all () {
return {StatusVisibility.PUBLIC, StatusVisibility.UNLISTED, StatusVisibility.PRIVATE, StatusVisibility.DIRECT};
}
2019-03-09 14:06:40 +01:00
2018-04-15 13:29:55 +02:00
}