~l-admin-3/evnc/automatic-cleanup-branch

« back to all changes in this revision

Viewing changes to src/SettingsManager.vala

  • Committer: Marcus Wichelmann
  • Date: 2015-07-09 18:17:05 UTC
  • Revision ID: marcus.wichelmann@hotmail.de-20150709181705-aliu5vv3gvha1p0a
Automatic code cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
namespace evnc {
2
 
        public class SettingsManager : Object {
3
 
                // Path
4
 
                static const string SETTINGS_PATH = "org.pantheon.evnc";
5
 
 
6
 
                // Keys
7
 
                static const string BOOKMARK_LIST_KEY = "bookmark-list";
8
 
                static const string SAVE_NEW_SERVERS_KEY = "save-new-servers";
9
 
                static const string POINTER_LOCAL_KEY = "pointer-local";
10
 
                static const string USE_DARK_THEME_KEY = "use-dark-theme";
11
 
                static const string DISPLAY_MODE_KEY = "display-mode";
12
 
                static const string READONLY_KEY = "readonly";
13
 
                static const string LOSSY_ENCODING_KEY = "lossy-encoding";
14
 
                static const string COLOR_DEPTH_KEY = "color-depth";
15
 
 
16
 
                // Fields
17
 
                public string[] bookmark_list { get; set; }
18
 
                public bool save_new_servers { get; set; default = false; }
19
 
                public bool pointer_local { get; set; default = true; }
20
 
                public bool use_dark_theme { get; set; default = false; }
21
 
                public int display_mode { get; set; default = 0; }
22
 
                public bool readonly { get; set; default = false; }
23
 
                public bool lossy_encoding { get; set; default = false; }
24
 
                public string color_depth { get; set; default = "default"; }
25
 
 
26
 
                // Events
27
 
                public signal void on_pointer_local_changed (bool new_value);
28
 
                public signal void on_use_dark_theme_changed (bool new_value);
29
 
                public signal void on_display_mode_changed (int new_value);
30
 
 
31
 
                // Settings object
32
 
                public Settings? settings = null;
33
 
 
34
 
                public SettingsManager () {
35
 
                        // Connect
36
 
                        this.settings = new Settings (SETTINGS_PATH);
37
 
 
38
 
 
39
 
                        this.settings.bind (BOOKMARK_LIST_KEY, this, "bookmark-list", SettingsBindFlags.DEFAULT);
40
 
                        this.settings.bind (SAVE_NEW_SERVERS_KEY, this, "save-new-servers", SettingsBindFlags.DEFAULT);
41
 
                        this.settings.bind (POINTER_LOCAL_KEY, this, "pointer-local", SettingsBindFlags.DEFAULT);
42
 
                        this.settings.bind (USE_DARK_THEME_KEY, this, "use-dark-theme", SettingsBindFlags.DEFAULT);
43
 
                        this.settings.bind (DISPLAY_MODE_KEY, this, "display-mode", SettingsBindFlags.DEFAULT);
44
 
                        this.settings.bind (READONLY_KEY, this, "readonly", SettingsBindFlags.DEFAULT);
45
 
                        this.settings.bind (LOSSY_ENCODING_KEY, this, "lossy-encoding", SettingsBindFlags.DEFAULT);
46
 
                        this.settings.bind (COLOR_DEPTH_KEY, this, "color-depth", SettingsBindFlags.DEFAULT);
47
 
 
48
 
                        // Connect events
49
 
                        this.settings.changed[POINTER_LOCAL_KEY].connect (() => {
50
 
                                this.on_pointer_local_changed (pointer_local);
51
 
                        });
52
 
                        this.settings.changed[USE_DARK_THEME_KEY].connect (() => {
53
 
                                this.on_use_dark_theme_changed (use_dark_theme);
54
 
                        });
55
 
                        this.settings.changed[DISPLAY_MODE_KEY].connect (() => {
56
 
                                this.on_display_mode_changed (display_mode);
57
 
                        });
58
 
                }
59
 
        }
 
2
    public class SettingsManager : Object {
 
3
        // Path
 
4
        static const string SETTINGS_PATH = "org.pantheon.evnc";
 
5
 
 
6
        // Keys
 
7
        static const string BOOKMARK_LIST_KEY = "bookmark-list";
 
8
        static const string SAVE_NEW_SERVERS_KEY = "save-new-servers";
 
9
        static const string POINTER_LOCAL_KEY = "pointer-local";
 
10
        static const string USE_DARK_THEME_KEY = "use-dark-theme";
 
11
        static const string DISPLAY_MODE_KEY = "display-mode";
 
12
        static const string READONLY_KEY = "readonly";
 
13
        static const string LOSSY_ENCODING_KEY = "lossy-encoding";
 
14
        static const string COLOR_DEPTH_KEY = "color-depth";
 
15
 
 
16
        // Fields
 
17
        public string[] bookmark_list { get; set; }
 
18
        public bool save_new_servers { get; set; default = false; }
 
19
        public bool pointer_local { get; set; default = true; }
 
20
        public bool use_dark_theme { get; set; default = false; }
 
21
        public int display_mode { get; set; default = 0; }
 
22
        public bool readonly { get; set; default = false; }
 
23
        public bool lossy_encoding { get; set; default = false; }
 
24
        public string color_depth { get; set; default = "default"; }
 
25
 
 
26
        // Events
 
27
        public signal void on_pointer_local_changed (bool new_value);
 
28
        public signal void on_use_dark_theme_changed (bool new_value);
 
29
        public signal void on_display_mode_changed (int new_value);
 
30
 
 
31
        // Settings object
 
32
        public Settings ? settings = null;
 
33
 
 
34
        public SettingsManager () {
 
35
            // Connect
 
36
            this.settings = new Settings (SETTINGS_PATH);
 
37
 
 
38
 
 
39
            this.settings.bind (BOOKMARK_LIST_KEY, this, "bookmark-list", SettingsBindFlags.DEFAULT);
 
40
            this.settings.bind (SAVE_NEW_SERVERS_KEY, this, "save-new-servers", SettingsBindFlags.DEFAULT);
 
41
            this.settings.bind (POINTER_LOCAL_KEY, this, "pointer-local", SettingsBindFlags.DEFAULT);
 
42
            this.settings.bind (USE_DARK_THEME_KEY, this, "use-dark-theme", SettingsBindFlags.DEFAULT);
 
43
            this.settings.bind (DISPLAY_MODE_KEY, this, "display-mode", SettingsBindFlags.DEFAULT);
 
44
            this.settings.bind (READONLY_KEY, this, "readonly", SettingsBindFlags.DEFAULT);
 
45
            this.settings.bind (LOSSY_ENCODING_KEY, this, "lossy-encoding", SettingsBindFlags.DEFAULT);
 
46
            this.settings.bind (COLOR_DEPTH_KEY, this, "color-depth", SettingsBindFlags.DEFAULT);
 
47
 
 
48
            // Connect events
 
49
            this.settings.changed[POINTER_LOCAL_KEY].connect (() => {
 
50
                this.on_pointer_local_changed (pointer_local);
 
51
            });
 
52
            this.settings.changed[USE_DARK_THEME_KEY].connect (() => {
 
53
                this.on_use_dark_theme_changed (use_dark_theme);
 
54
            });
 
55
            this.settings.changed[DISPLAY_MODE_KEY].connect (() => {
 
56
                this.on_display_mode_changed (display_mode);
 
57
            });
 
58
        }
 
59
    }
60
60
}
 
 
b'\\ No newline at end of file'