about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-31 20:17:20 +0000
committerJames Booth <boothj5@gmail.com>2016-01-31 20:17:20 +0000
commita00095c8a98b04c5c625d07f3ea4dfeb0e0f64c6 (patch)
tree7639d43dbf8b50358dd59bb87c16edc117c21076 /src/config
parentdd250c679960b60a5cee86c4cafd6c9855401117 (diff)
downloadprofani-tty-a00095c8a98b04c5c625d07f3ea4dfeb0e0f64c6.tar.gz
Added roster.rooms.private.char setting
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c32
-rw-r--r--src/config/preferences.h3
-rw-r--r--src/config/theme.c10
3 files changed, 43 insertions, 2 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 8a15cccd..0a2ae3cc 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -784,8 +784,6 @@ prefs_clear_roster_private_char(void)
     _save_prefs();
 }
 
-
-
 char
 prefs_get_roster_room_char(void)
 {
@@ -820,9 +818,39 @@ prefs_clear_roster_room_char(void)
     _save_prefs();
 }
 
+char
+prefs_get_roster_room_private_char(void)
+{
+    char result = 0;
+
+    char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", NULL);
+    if (!resultstr) {
+        result =  0;
+    } else {
+        result = resultstr[0];
+    }
+    free(resultstr);
+
+    return result;
+}
 
+void
+prefs_set_roster_room_private_char(char ch)
+{
+    char str[2];
+    str[0] = ch;
+    str[1] = '\0';
 
+    g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.rooms.private.char", str);
+    _save_prefs();
+}
 
+void
+prefs_clear_roster_room_private_char(void)
+{
+    g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.rooms.pruvate.char", NULL);
+    _save_prefs();
+}
 
 gint
 prefs_get_roster_contact_indent(void)
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 32a924ba..ff8b687d 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -199,6 +199,9 @@ void prefs_clear_roster_private_char(void);
 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);
+void prefs_clear_roster_room_private_char(void);
 
 gint prefs_get_roster_contact_indent(void);
 void prefs_set_roster_contact_indent(gint value);
diff --git a/src/config/theme.c b/src/config/theme.c
index b886f9e2..40bf3539 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -470,6 +470,16 @@ _load_preferences(void)
         prefs_clear_roster_room_char();
     }
 
+    if (g_key_file_has_key(theme, "ui", "roster.rooms.private.char", NULL)) {
+        gchar *ch = g_key_file_get_string(theme, "ui", "roster.rooms.private.char", NULL);
+        if (ch && strlen(ch) > 0) {
+            prefs_set_roster_room_private_char(ch[0]);
+            g_free(ch);
+        }
+    } else {
+        prefs_clear_roster_room_private_char();
+    }
+
     if (g_key_file_has_key(theme, "ui", "roster.private.char", NULL)) {
         gchar *ch = g_key_file_get_string(theme, "ui", "roster.private.char", NULL);
         if (ch && strlen(ch) > 0) {