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