Allow default client settings to be configurable
authorJack Allnutt <m2ys4u@gmail.com>
Sat, 1 Jun 2013 19:43:04 +0000 (20:43 +0100)
committerJack Allnutt <m2ys4u@gmail.com>
Sat, 1 Jun 2013 19:43:04 +0000 (20:43 +0100)
Also, a few misc code style changes in the settings applet

client/assets/src/applets/settings.js
client/assets/src/models/application.js
config.example.js

index 4f4b385b6da9d64c774b07eb0122539839066e61..f1ac614c29a5de3c6a19fac8eab73573c08b2c59 100644 (file)
@@ -15,7 +15,6 @@
 \r
 \r
         },\r
-        \r
 \r
         loadSettings: function () {\r
             var settings = _kiwi.global.settings;\r
@@ -58,7 +57,7 @@
                 feedback;\r
 \r
             // Stop settings being updated while we're saving one by one\r
-            _kiwi.global.settings.off('change', this.loadSettings, this);\r
+            settings.off('change', this.loadSettings, this);\r
 \r
             settings.set('theme', $('.setting-theme', this.$el).val());\r
             settings.set('channel_list_style', $('.setting-channel_list_style', this.$el).val());\r
             feedback = $('.feedback', this.$el);\r
             feedback.fadeIn('slow', function () {\r
                 feedback.fadeOut('slow');\r
-            })\r
+            });\r
 \r
             // Continue listening for setting changes\r
-            _kiwi.global.settings.on('change', this.loadSettings, this);\r
+            settings.on('change', this.loadSettings, this);\r
         }\r
     });\r
 \r
index 28c09172b0bcea44e55ead87951468ffe19356d0..84d8c80211e9ce6e135f51d706adf7acb0f53615 100644 (file)
@@ -48,6 +48,7 @@ _kiwi.model.Application = function () {
 \r
             this.initializeClient();\r
             this.initializeGlobals();\r
+            this.applyDefaultClientSettings(this.server_settings.client.settings);\r
 \r
             this.view.barsHide(true);\r
 \r
@@ -138,6 +139,16 @@ _kiwi.model.Application = function () {
         };\r
 \r
 \r
+        this.applyDefaultClientSettings = function (settings) {\r
+            _.each(settings, function (value, setting) {\r
+                if (typeof _kiwi.global.settings.get(setting) === 'undefined') {\r
+                    _kiwi.global.settings.set(setting, value);\r
+                }\r
+            });\r
+            _kiwi.global.settings.save();\r
+        };\r
+\r
+\r
         this.populateDefaultServerSettings = function (new_connection_dialog) {\r
             var parts;\r
             var defaults = {\r
index 674f8f999712fc4bb5142fae44f35fa87c499ce1..9732497638973b4b6108ed5a35681ce75ce3b884 100644 (file)
@@ -170,7 +170,15 @@ conf.client = {
     port:    6697,
     ssl:     true,
     channel: '#kiwiirc',
-    nick:    'kiwi_?'
+    nick:    'kiwi_?',
+    settings: {
+        theme: 'relaxed',
+        channel_list_style: 'tabs',
+        scrollback: 250,
+        show_joins_parts: true,
+        show_timestamps: false,
+        mute_sounds: false
+    }
 };