diff options
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/preferences.c | 24 | ||||
-rw-r--r-- | src/config/preferences.h | 4 | ||||
-rw-r--r-- | src/config/theme.c | 4 |
3 files changed, 12 insertions, 20 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index 6af779db..edbf6f63 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -1182,30 +1182,22 @@ prefs_clear_roster_private_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.private.char", NULL); } -char +char* prefs_get_roster_room_char(void) { - char result = 0; - - char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); - if (!resultstr) { - result = 0; - } else { - result = resultstr[0]; - } - free(resultstr); + char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.char", NULL); return result; } void -prefs_set_roster_room_char(char ch) +prefs_set_roster_room_char(char* ch) { - char str[2]; - str[0] = ch; - str[1] = '\0'; - - g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", str); + if (g_utf8_strlen(ch, 4) == 1) { + g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.char", ch); + } else { + log_error("Could not set roster resource char: %s", ch); + } } void diff --git a/src/config/preferences.h b/src/config/preferences.h index e26deeaf..972dfa8a 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -266,8 +266,8 @@ void prefs_clear_roster_resource_char(void); char* prefs_get_roster_private_char(void); void prefs_set_roster_private_char(char* ch); void prefs_clear_roster_private_char(void); -char prefs_get_roster_room_char(void); -void prefs_set_roster_room_char(char ch); +char* prefs_get_roster_room_char(void); +void prefs_set_roster_room_char(char* ch); void prefs_clear_roster_room_char(void); char prefs_get_roster_room_private_char(void); void prefs_set_roster_room_private_char(char ch); diff --git a/src/config/theme.c b/src/config/theme.c index 868601be..407fb82e 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -448,8 +448,8 @@ _load_preferences(void) if (g_key_file_has_key(theme, "ui", "roster.rooms.char", NULL)) { gchar* ch = g_key_file_get_string(theme, "ui", "roster.rooms.char", NULL); - if (ch && strlen(ch) > 0) { - prefs_set_roster_room_char(ch[0]); + if (ch && g_utf8_strlen(ch, 4) == 1) { + prefs_set_roster_room_char(ch); g_free(ch); } } |