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 6539fc0c..3bc5800f 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -1110,30 +1110,22 @@ prefs_clear_roster_header_char(void) g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.header.char", NULL); } -char +char* prefs_get_roster_contact_char(void) { - char result = 0; - - char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); - if (!resultstr) { - result = 0; - } else { - result = resultstr[0]; - } - free(resultstr); + char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.contact.char", NULL); return result; } void -prefs_set_roster_contact_char(char ch) +prefs_set_roster_contact_char(char* ch) { - char str[2]; - str[0] = ch; - str[1] = '\0'; - - g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.contact.char", str); + if (g_utf8_strlen(ch, 4) == 1) { + g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.contact.char", ch); + } else { + log_error("Could not set roster contact char: %s", ch); + } } void diff --git a/src/config/preferences.h b/src/config/preferences.h index 1eddceca..2fb5b9b1 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -257,8 +257,8 @@ gboolean prefs_set_ox_char(char* ch); char* prefs_get_roster_header_char(void); void prefs_set_roster_header_char(char* ch); void prefs_clear_roster_header_char(void); -char prefs_get_roster_contact_char(void); -void prefs_set_roster_contact_char(char ch); +char* prefs_get_roster_contact_char(void); +void prefs_set_roster_contact_char(char* ch); void prefs_clear_roster_contact_char(void); char prefs_get_roster_resource_char(void); void prefs_set_roster_resource_char(char ch); diff --git a/src/config/theme.c b/src/config/theme.c index 61346167..26c3c669 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -430,8 +430,8 @@ _load_preferences(void) if (g_key_file_has_key(theme, "ui", "roster.contact.char", NULL)) { gchar* ch = g_key_file_get_string(theme, "ui", "roster.contact.char", NULL); - if (ch && strlen(ch) > 0) { - prefs_set_roster_contact_char(ch[0]); + if (ch && g_utf8_strlen(ch, 4) == 1) { + prefs_set_roster_contact_char(ch); g_free(ch); } } |