1
2
3
4
5
6
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
9
10 #include <glib.h>
11
12 #if defined(HAVE_FUNC_ATTRIBUTE_WEAK) && defined(HAVE_TESTS)
13 #define MC_MOCKABLE __attribute__ ((weak))
14 #else
15 #define MC_MOCKABLE
16 #endif
17
18 #include "glibcompat.h"
19
20 #include "unixcompat.h"
21
22 #include "fs.h"
23 #include "shell.h"
24 #include "mcconfig.h"
25
26
27
28 #ifdef ENABLE_NLS
29 #include <libintl.h>
30 #define _(String) gettext (String)
31 #ifdef gettext_noop
32 #define N_(String) gettext_noop (String)
33 #else
34 #define N_(String) (String)
35 #endif
36 #else
37 #define textdomain(String) 1
38 #define gettext(String) (String)
39 #define ngettext(String1, String2, Num) (((Num) == 1) ? (String1) : (String2))
40 #define dgettext(Domain, Message) (Message)
41 #define dcgettext(Domain, Message, Type) (Message)
42 #define bindtextdomain(Domain, Directory) 1
43 #define _(String) (String)
44 #define N_(String) (String)
45 #endif
46
47 #ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
48 #define MC_FALLTHROUGH __attribute__ ((fallthrough))
49 #else
50 #define MC_FALLTHROUGH
51 #endif
52
53 #ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
54 #define MC_UNUSED __attribute__ ((unused))
55 #else
56 #define MC_UNUSED
57 #endif
58
59 #ifdef USE_MAINTAINER_MODE
60 #include "lib/logging.h"
61 #endif
62
63
64 #define BUF_10K 10240L
65 #define BUF_8K 8192L
66 #define BUF_4K 4096L
67 #define BUF_2K 2048L
68 #define BUF_1K 1024L
69
70 #define BUF_LARGE BUF_1K
71 #define BUF_MEDIUM 512
72 #define BUF_SMALL 128
73 #define BUF_TINY 64
74
75 #define UTF8_CHAR_LEN 6
76
77
78
79 #define SUBSHELL_EXIT 128
80
81 #define MC_ERROR g_quark_from_static_string (PACKAGE)
82
83 #define DEFAULT_CHARSET "ASCII"
84
85
86
87
88 typedef enum
89 {
90 MC_RUN_FULL = 0,
91 MC_RUN_EDITOR,
92 MC_RUN_VIEWER,
93 MC_RUN_DIFFVIEWER
94 } mc_run_mode_t;
95
96
97
98 typedef struct
99 {
100 const char *mc_version;
101
102 mc_run_mode_t mc_run_mode;
103 gboolean run_from_parent_mc;
104
105 gboolean midnight_shutdown;
106
107
108
109 char *sysconfig_dir;
110
111 char *share_data_dir;
112
113 char *profile_name;
114
115 mc_config_t *main_config;
116 mc_config_t *panels_config;
117
118
119 int source_codepage;
120 int display_codepage;
121
122
123
124
125 gboolean utf8_display;
126
127
128 gboolean message_visible;
129
130 gboolean keybar_visible;
131
132 #ifdef ENABLE_BACKGROUND
133
134 gboolean we_are_background;
135 #endif
136
137 struct
138 {
139
140 gboolean confirm_history_cleanup;
141
142
143 gboolean show_all_if_ambiguous;
144
145
146
147 gboolean is_right;
148 } widget;
149
150
151 mc_shell_t *shell;
152
153 struct
154 {
155
156 char *skin;
157
158 gboolean shadows;
159
160 char *setup_color_string;
161 char *term_color_string;
162 char *color_terminal_string;
163
164 char *command_line_colors;
165
166 #ifndef LINUX_CONS_SAVER_C
167
168 char console_flag;
169 #endif
170
171 gboolean use_subshell;
172
173 #ifdef ENABLE_SUBSHELL
174
175 int subshell_pty;
176 #endif
177
178
179
180 gboolean xterm_flag;
181
182
183 gboolean disable_x11;
184
185
186
187 gboolean slow_terminal;
188
189
190 gboolean disable_colors;
191
192
193 gboolean ugly_line_drawing;
194
195
196 gboolean old_mouse;
197
198
199
200 gboolean alternate_plus_minus;
201 } tty;
202
203 struct
204 {
205
206 gboolean cd_symlinks;
207
208
209 gboolean preallocate_space;
210
211 } vfs;
212 } mc_global_t;
213
214
215
216 extern mc_global_t mc_global;
217
218
219
220
221 #endif