mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
Merge pull request #19255 from poettering/glyph-love
some SpecialGlyph tweaks
This commit is contained in:
commit
33ea9e9c97
@ -427,8 +427,10 @@ const char *special_glyph(SpecialGlyph code) {
|
||||
},
|
||||
};
|
||||
|
||||
assert(code < _SPECIAL_GLYPH_MAX);
|
||||
if (code < 0)
|
||||
return NULL;
|
||||
|
||||
assert(code < _SPECIAL_GLYPH_MAX);
|
||||
return draw_table[code >= _SPECIAL_GLYPH_FIRST_EMOJI ? emoji_enabled() : is_locale_utf8()][code];
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ void init_gettext(void);
|
||||
|
||||
bool is_locale_utf8(void);
|
||||
|
||||
typedef enum {
|
||||
typedef enum SpecialGlyph {
|
||||
SPECIAL_GLYPH_TREE_VERTICAL,
|
||||
SPECIAL_GLYPH_TREE_BRANCH,
|
||||
SPECIAL_GLYPH_TREE_RIGHT,
|
||||
@ -70,6 +70,7 @@ typedef enum {
|
||||
SPECIAL_GLYPH_LOCK_AND_KEY,
|
||||
SPECIAL_GLYPH_TOUCH,
|
||||
_SPECIAL_GLYPH_MAX,
|
||||
_SPECIAL_GLYPH_INVALID = -EINVAL,
|
||||
} SpecialGlyph;
|
||||
|
||||
const char *special_glyph(SpecialGlyph code) _const_;
|
||||
|
@ -296,22 +296,19 @@ 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;
|
||||
static const SpecialGlyph map[_UNIT_ACTIVE_STATE_MAX] = {
|
||||
[UNIT_ACTIVE] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
[UNIT_RELOADING] = SPECIAL_GLYPH_CIRCLE_ARROW,
|
||||
[UNIT_INACTIVE] = SPECIAL_GLYPH_WHITE_CIRCLE,
|
||||
[UNIT_FAILED] = SPECIAL_GLYPH_MULTIPLICATION_SIGN,
|
||||
[UNIT_ACTIVATING] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
[UNIT_DEACTIVATING] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
[UNIT_MAINTENANCE] = SPECIAL_GLYPH_WHITE_CIRCLE,
|
||||
};
|
||||
|
||||
default:
|
||||
return SPECIAL_GLYPH_BLACK_CIRCLE;
|
||||
}
|
||||
if (state < 0)
|
||||
return _SPECIAL_GLYPH_INVALID;
|
||||
|
||||
assert(state < _UNIT_ACTIVE_STATE_MAX);
|
||||
return map[state];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user