1 /* Copyright (C) 2016-2017 Shengyu Zhang <i@silverrainz.me>
2  *
3  * This file is part of Srain.
4  *
5  * Srain is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __SUI_CONFIG_H
20 #define __SUI_CONFIG_H
21 
22 #ifndef __IN_SUI_H
23 	#error This file should not be included directly, include just sui.h
24 #endif
25 
26 #include "srain.h"
27 #include "ret.h"
28 
29 typedef struct _SuiApplicationConfig SuiApplicationConfig;
30 typedef struct _SuiApplicationOptions SuiApplicationOptions;
31 typedef struct _SuiWindowConfig SuiWindowConfig;
32 typedef struct _SuiBufferConfig SuiBufferConfig;
33 
34 struct _SuiWindowConfig {
35     bool csd;
36     bool send_on_ctrl_enter;
37     bool exit_on_close;
38 };
39 
40 struct _SuiApplicationConfig {
41     char *theme;
42 
43     SuiWindowConfig window;
44 };
45 
46 // NOTE: SuiApplicationOptions is different from SuiApplicationConfig,
47 // SuiApplicationOptions contains options which are specified via commandline.
48 struct _SuiApplicationOptions {
49     // Whether auto connect to servers
50     bool no_auto_connect;
51 };
52 
53 struct _SuiBufferConfig {
54     bool notify;
55     bool show_topic;
56     bool show_avatar;
57     bool show_user_list;
58     bool preview_url;
59     bool auto_preview_url;
60     char *nick_completion_suffix;
61 };
62 
63 SuiApplicationConfig *sui_application_config_new(void);
64 SrnRet sui_application_config_check(SuiApplicationConfig *cfg);
65 void sui_application_config_free(SuiApplicationConfig *cfg);
66 
67 SuiApplicationOptions *sui_application_options_new(void);
68 void sui_application_options_free(SuiApplicationOptions *opts);
69 
70 SuiWindowConfig *sui_window_config_new(void);
71 SrnRet sui_window_config_check(SuiWindowConfig *cfg);
72 void sui_window_config_free(SuiWindowConfig *cfg);
73 
74 SuiBufferConfig *sui_buffer_config_new(void);
75 SrnRet sui_buffer_config_check(SuiBufferConfig *cfg);
76 void sui_buffer_config_free(SuiBufferConfig *cfg);
77 
78 #endif /* __SUI_CONFIG_H */
79