about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c23
-rw-r--r--src/config/preferences.h4
-rw-r--r--src/config/theme.c4
3 files changed, 12 insertions, 19 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index b1686424..fae150c8 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -902,30 +902,23 @@ prefs_get_occupants_size(void)
     }
 }
 
-char
+char*
 prefs_get_occupants_char(void)
 {
-    char result = 0;
 
-    char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
-    if (!resultstr) {
-        result = 0;
-    } else {
-        result = resultstr[0];
-    }
-    free(resultstr);
+    char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
 
     return result;
 }
 
 void
-prefs_set_occupants_char(char ch)
+prefs_set_occupants_char(char* ch)
 {
-    char str[2];
-    str[0] = ch;
-    str[1] = '\0';
-
-    g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", str);
+    if (g_utf8_strlen(ch, 4) == 1) {
+        g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.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 aec27094..1f8df60d 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -272,8 +272,8 @@ void prefs_clear_roster_room_char(void);
 char* prefs_get_roster_room_private_char(void);
 void prefs_set_roster_room_private_char(char* ch);
 void prefs_clear_roster_room_private_char(void);
-char prefs_get_occupants_char(void);
-void prefs_set_occupants_char(char ch);
+char* prefs_get_occupants_char(void);
+void prefs_set_occupants_char(char* ch);
 void prefs_clear_occupants_char(void);
 char prefs_get_occupants_header_char(void);
 void prefs_set_occupants_header_char(char ch);
diff --git a/src/config/theme.c b/src/config/theme.c
index 118cbaa2..1af68afd 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -406,8 +406,8 @@ _load_preferences(void)
     // with custom set functions
     if (g_key_file_has_key(theme, "ui", "occupants.char", NULL)) {
         gchar* ch = g_key_file_get_string(theme, "ui", "occupants.char", NULL);
-        if (ch && strlen(ch) > 0) {
-            prefs_set_occupants_char(ch[0]);
+        if (ch && g_utf8_strlen(ch, 4) == 1) {
+            prefs_set_occupants_char(ch);
             g_free(ch);
         }
     }