about summary refs log tree commit diff stats
path: root/src/config/preferences.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/preferences.c')
-rw-r--r--src/config/preferences.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 22e80874..5b683426 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -52,6 +52,7 @@
 #include "preferences.h"
 #include "tools/autocomplete.h"
 
+// preference groups refer to the sections in .profrc, for example [ui]
 #define PREF_GROUP_LOGGING "logging"
 #define PREF_GROUP_CHATSTATES "chatstates"
 #define PREF_GROUP_UI "ui"
@@ -127,6 +128,16 @@ prefs_load(void)
         g_error_free(err);
     }
 
+    // move pre 0.4.6 titlebar preference
+    err = NULL;
+    gchar *old_titlebar = g_key_file_get_string(prefs, PREF_GROUP_UI, "titlebar", &err);
+    if (err == NULL) {
+        g_key_file_set_string(prefs, PREF_GROUP_UI, _get_key(PREF_TITLEBAR_SHOW), old_titlebar);
+        g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar", NULL);
+    } else {
+        g_error_free(err);
+    }
+
     _save_prefs();
 
     boolean_choice_ac = autocomplete_new();
@@ -487,6 +498,9 @@ _get_preferences_file(void)
     return result;
 }
 
+// get the preference group for a specific preference
+// for example the PREF_BEEP setting ("beep" in .profrc, see _get_key) belongs
+// to the [ui] section.
 static const char *
 _get_group(preference_t pref)
 {
@@ -496,7 +510,8 @@ _get_group(preference_t pref)
         case PREF_BEEP:
         case PREF_THEME:
         case PREF_VERCHECK:
-        case PREF_TITLEBAR:
+        case PREF_TITLEBAR_SHOW:
+        case PREF_TITLEBAR_GOODBYE:
         case PREF_FLASH:
         case PREF_INTYPE:
         case PREF_HISTORY:
@@ -514,6 +529,9 @@ _get_group(preference_t pref)
         case PREF_ROSTER_OFFLINE:
         case PREF_ROSTER_RESOURCE:
         case PREF_ROSTER_BY:
+        case PREF_RESOURCE_TITLE:
+        case PREF_RESOURCE_MESSAGE:
+        case PREF_INPBLOCK_DYNAMIC:
             return PREF_GROUP_UI;
         case PREF_STATES:
         case PREF_OUTTYPE:
@@ -550,6 +568,8 @@ _get_group(preference_t pref)
     }
 }
 
+// get the key used in .profrc for the preference
+// for example the PREF_AUTOAWAY_MODE maps to "autoaway.mode" in .profrc
 static const char *
 _get_key(preference_t pref)
 {
@@ -563,8 +583,10 @@ _get_key(preference_t pref)
             return "theme";
         case PREF_VERCHECK:
             return "vercheck";
-        case PREF_TITLEBAR:
-            return "titlebar";
+        case PREF_TITLEBAR_SHOW:
+            return "titlebar.show";
+        case PREF_TITLEBAR_GOODBYE:
+            return "titlebar.goodbye";
         case PREF_FLASH:
             return "flash";
         case PREF_INTYPE:
@@ -647,11 +669,19 @@ _get_key(preference_t pref)
             return "roster.resource";
         case PREF_ROSTER_BY:
             return "roster.by";
+        case PREF_RESOURCE_TITLE:
+            return "resource.title";
+        case PREF_RESOURCE_MESSAGE:
+            return "resource.message";
+        case PREF_INPBLOCK_DYNAMIC:
+            return "inpblock.dynamic";
         default:
             return NULL;
     }
 }
 
+// the default setting for a boolean type preference
+// if it is not specified in .profrc
 static gboolean
 _get_default_boolean(preference_t pref)
 {
@@ -669,12 +699,15 @@ _get_default_boolean(preference_t pref)
         case PREF_MUC_PRIVILEGES:
         case PREF_PRESENCE:
         case PREF_WRAP:
+        case PREF_INPBLOCK_DYNAMIC:
             return TRUE;
         default:
             return FALSE;
     }
 }
 
+// the default setting for a string type preference
+// if it is not specified in .profrc
 static char *
 _get_default_string(preference_t pref)
 {