summaryrefslogtreecommitdiff
path: root/src/basic/unit-def.c
diff options
context:
space:
mode:
authorJiehong <email@majiehong.com>2021-01-20 15:52:35 +0100
committerLennart Poettering <lennart@poettering.net>2021-01-22 20:45:43 +0100
commit9ae5fed64ec1647d1c8a8e21528c1d2f08b3ebac (patch)
treefd338be311196f7769f911b85880e0cfe8a5af13 /src/basic/unit-def.c
parent95457dc13cc5fba332c44cbe3aa35e2fa129588f (diff)
downloadsystemd-9ae5fed64ec1647d1c8a8e21528c1d2f08b3ebac.tar.gz
feature: display status with a different shape depending on the status (#17728)
Diffstat (limited to 'src/basic/unit-def.c')
-rw-r--r--src/basic/unit-def.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/basic/unit-def.c b/src/basic/unit-def.c
index 145399c963..bb4fa1ec6b 100644
--- a/src/basic/unit-def.c
+++ b/src/basic/unit-def.c
@@ -287,3 +287,24 @@ static const char* const notify_access_table[_NOTIFY_ACCESS_MAX] = {
};
DEFINE_STRING_TABLE_LOOKUP(notify_access, NotifyAccess);
+
+SpecialGlyph unit_active_state_to_glyph(UnitActiveState state) {
+ switch (state) {
+ case UNIT_ACTIVE:
+ return SPECIAL_GLYPH_BLACK_CIRCLE;
+ case UNIT_RELOADING:
+ return SPECIAL_GLYPH_CIRCLE_ARROW;
+ case UNIT_INACTIVE:
+ return SPECIAL_GLYPH_WHITE_CIRCLE;
+ case UNIT_FAILED:
+ return SPECIAL_GLYPH_MULTIPLICATION_SIGN;
+ case UNIT_ACTIVATING:
+ case UNIT_DEACTIVATING:
+ return SPECIAL_GLYPH_BLACK_CIRCLE;
+ case UNIT_MAINTENANCE:
+ return SPECIAL_GLYPH_WHITE_CIRCLE;
+
+ default:
+ return SPECIAL_GLYPH_BLACK_CIRCLE;
+ }
+}