1 #ifndef __RFM_CONSTANTS_H__
2 #define __RFM_CONSTANTS_H__
3 #include "errors.h"
4 #include "types.h"
5 //#define NO_THREADS
6 
7 #ifdef ENABLE_NLS
8 # include <libintl.h>
9 # define _(String) dgettext(GETTEXT_PACKAGE,String)
10 # define N_(String)  String
11 
12 #else
13 # define _(String) String
14 # define N_(String) String
15 # define ngettext(Format1,Format2,N) Format1
16 # define textdomain(String)
17 # define bindtextdomain(Domain,Directory)
18 #endif
19 
20 #include "debug.h"
21 #include "files.h"
22 
23 #define DEFAULT_WIDTH 540
24 #define DEFAULT_HEIGHT 450
25 
26 
27 #define FULL_LOAD_COUNT 104
28 
29 // this defines the maximum number of auto command elements in popup menu:
30 // and also the maximum number of up directories in the bookmarks submenu
31 #define DEEPEST_DIR_MENU_LEVELS 9
32 #define DEEPEST_HISTORY_MENU_LEVELS 6
33 // this defines the maximum number of bookmarks in the bookmarks submenu:
34 #define DEEPEST_BOOK_MENU_LEVELS 9
35 // This defines the maximun number of goto module elements in popup menu:
36 #define DEEPEST_MODULE_MENU_LEVELS 13
37 
38 // This specifies what the path count should be greater
39 // than or equal to, to default to tiny icons.
40 #define TINY_ICONS_PATHC 256
41 
42 #define STATUS_IDLE		0
43 #define STATUS_EXIT		0x01
44 #define STATUS_RELOAD		0x02
45 
46 #define MONITOR_THREAD_DONE 0x02
47 
48 
49 enum {
50     ICONVIEW_TYPE,
51     DESKVIEW_TYPE
52 };
53 enum {
54     TYPE_SORT,
55     NAME_SORT,
56     SIZE_SORT,
57     DATE_SORT,
58     OWNER_SORT,
59     GROUP_SORT,
60     MODE_SORT
61 };
62 enum {
63     TR_COPY,
64     TR_MOVE,
65     TR_LINK,
66     TR_COPY_REMOTE,
67     TR_MOVE_REMOTE,
68     TR_LINK_REMOTE
69 };
70 enum {
71     TARGET_URI_LIST,
72     TARGET_PLAIN,
73     TARGET_UTF8,
74     TARGET_STRING,
75     TARGET_ROOTWIN,
76     TARGET_MOZ_URL,
77     TARGET_XDS,
78     TARGET_RAW,
79     TARGETS
80 };
81 
82 // population_flags:
83 //
84 			// normal_tip
85 #define POPULATION_NORMAL_TIP	0x01 // ok
86 			// preview_done
87 #define POPULATION_PREVIEW_DONE	0x02 // not used yet
88 			// preview_busy
89 #define POPULATION_PREVIEW_BUSY	0x04 // ok
90 			// selected
91 #define POPULATION_SELECTED	0x08 // ok
92 			// saturated
93 #define POPULATION_SATURATED	0x10 // ok
94 			// label saturated
95 #define LABEL_SATURATED		0x20 // ok
96 			// thumbnailed
97 #define POPULATION_THUMBNAILED	0x40 // ok
98 			// cut
99 #define POPULATION_CUT		0x80 // ok
100 			// copied
101 #define POPULATION_COPIED	0x100 // ok
102 #define POPULATION_TIP_BUSY	0x200 // ok
103 #define POPULATION_PIXBUF_CLEAN	0x400 // ok
104 #define POPULATION_IS_IMAGE	0x800 // ok
105 #define POPULATION_ICON_CACHE	0x1000 // ok
106 #define POPULATION_THUMBNAIL_ON_EXPOSE	0x2000 // ok
107 
108 
109 #define PREVIEW_IMAGE_SIZE 400
110 #define MAX_PIXBUF_HASH_SIZE 128
111 
112 /* for preview threads, this limits the number of threads which are
113  * spawn concurrently. Increase this number with efective core count */
114 #define    PREVIEW_THREAD_LIMIT   4
115 
116 /* icon parameters: */
117 #define BIG_ICON_SIZE 		96
118 #define MEDIUM_ICON_SIZE 	72
119 #define SMALL_ICON_SIZE 	48
120 #define TINY_ICON_SIZE 		24
121 #define LIST_ICON_SIZE  	0
122 
123 #define SIZE_BUTTON	20
124 #define SIZE_DIALOG	36
125 #define SIZE_ICON	48
126 #define SIZE_PREVIEW	96
127 #define SIZE_TIP	128
128 
129 #define MAX_COMMAND_ARGS 2048
130 
131 #define TEXTSPACING 6
132 //#define TEXTSPACING 0
133 
134 #define MINIMUM_ICON_COLUMNS 1
135 #define MINIMUM_VISIBLE_ROWS 1
136 
137 #define PARENT_MODULE(x) ((x)->view_p->module)
138 #define CHILD_MODULE(x) ((x)->module)
139 #define POPULATION_MODULE(x) ((x)?((PARENT_MODULE(x))?\
140 			    PARENT_MODULE(x):\
141 			    CHILD_MODULE(x)):NULL)
142 
143 
144 #define CUT_BUFFER 0
145 
146 #define BACKGROUND_COLOR 0
147 #define TEXT_COLOR 1
148 #define SATURATE_TEXT_COLOR 2
149 #define SATURATE_LABEL_COLOR 3
150 #define SELECT_TEXT_COLOR 4
151 #define INVALID_UTF8_TEXT_COLOR 5
152 #define SHADOW_COLOR 7
153 
154 
155 /***** end mime ****/
156 
157 #define GETWD (g_get_home_dir()?g_get_home_dir():g_get_tmp_dir())
158 #define SETWD(x) \
159 if (chdir(GETWD)<0){ \
160     g_warning("chdir %s: %s",GETWD, strerror (errno));\
161 }
162 
163 
164 
165 #define COMM_IGNORE_RELEASE   0x01
166 
167 
168 
169 #define __MASK		0xffffffff  // 32bit only for compatibility with old processors
170 
171 // Ad hoc types (not determined by stat, mainly by fstab plugin)
172 // __DUMMY_TYPE
173 // __ROOT_TYPE
174 // __UP_TYPE
175 // __PROC_TYPE
176 // __CDFS_TYPE
177 // __USER_TYPE
178 // __NFS_TYPE
179 // __SMB_TYPE
180 // __FSTAB_TYPE
181 // __MTAB_TYPE
182 // __PARTITION_TYPE
183 // __DOTDESKTOP
184 
185 
186 #define __DTYPE (__SFIFO|__SCHR|__SDIR|__SBLK|__SREG|__SLNK|__SSOCK|__LOCAL_TYPE)
187 
188 #define KEEP_TYPE (__MONITOR_TYPE|__SBLK|__DUMMY_TYPE|__ROOT_TYPE|__UP_TYPE|__PROC_TYPE|__CDFS_TYPE|__USER_TYPE|__NFS_TYPE|__SMB_TYPE|__FSTAB_TYPE|__MTAB_TYPE|__PARTITION_TYPE|__DOTDESKTOP)
189 
190 // XXX: These are no longer in en->type and should be separated from this group to
191 //      free up the bit flags for other use.
192 // __SHOWS_HIDDEN (this is now a view preferences item)
193 // __SHOWS_IMAGES (this is now a view preferences item)
194 // __SHOWS_ASCENDING (this is now a view preferences item)
195 // __CASE_INSENSITIVE (this is now a view preferences item)
196 // __INVALIDATE_ICONS (this is now a view preferences item)
197 // __USER_PREFERENCES (this is now a view preferences item)
198 #define __INVALIDATE_ICONS 	(0x1)
199 
200 #define __SHOWS_BACKUP		(0x1<<24)
201 #define SHOWS_BACKUP(x)		((x) & __SHOWS_BACKUP)
202 #define SET_SHOWS_BACKUP(x)	(x) |= __SHOWS_BACKUP
203 #define UNSET_SHOWS_BACKUP(x)	(x) &= (__SHOWS_BACKUP ^ __MASK )
204 
205 #define __SHOWS_HIDDEN		(0x1<<25)
206 #define SHOWS_HIDDEN(x)		((x) & __SHOWS_HIDDEN)
207 #define SET_SHOWS_HIDDEN(x)	(x) |= __SHOWS_HIDDEN
208 #define UNSET_SHOWS_HIDDEN(x)	(x) &= (__SHOWS_HIDDEN ^ __MASK )
209 
210 #define __CASE_INSENSITIVE		(0x1<<26)
211 #define IS_CASE_INSENSITIVE(x)		((x) & __CASE_INSENSITIVE)
212 #define SET_CASE_INSENSITIVE(x)		(x) |= __CASE_INSENSITIVE
213 #define UNSET_CASE_INSENSITIVE(x)	(x) &= (__CASE_INSENSITIVE ^ __MASK )
214 
215 #define __SHOWS_IMAGES		(0x1<<27)
216 #define SHOWS_IMAGES(x)		((x) & __SHOWS_IMAGES)
217 #define SET_SHOWS_IMAGES(x)	(x) |= __SHOWS_IMAGES
218 #define UNSET_SHOWS_IMAGES(x)	(x) &= (__SHOWS_IMAGES ^ __MASK )
219 
220 #define __SHOWS_ASCENDING	(0x1<<28)
221 #define SHOWS_ASCENDING(x)	((x) & __SHOWS_ASCENDING)
222 #define SET_SHOWS_ASCENDING(x)	(x) |= __SHOWS_ASCENDING
223 #define UNSET_SHOWS_ASCENDING(x) (x) &= (__SHOWS_ASCENDING ^ __MASK )
224 
225 #define __USER_PREFERENCES	(0x1<<29)
226 #define IS_USER_PREFERENCES(x)	((x) & __USER_PREFERENCES)
227 #define SET_USER_PREFERENCES(x)	(x) |= __USER_PREFERENCES
228 #define UNSET_USER_PREFERENCES(x) (x) &= (__USER_PREFERENCES ^ __MASK )
229 
230 
231 /**  Basic stat types (not necesarily exclusive)  **/
232 // (0x1<<0) not used
233 
234 #define __SFIFO		(0x1<<1)
235 #define IS_SFIFO(x)	((x) & __SFIFO)
236 #define SET_SFIFO(x)	((x) |= __SFIFO)
237 #define UNSET_SFIFO(x)	(x) &= (__SFIFO ^ __MASK )
238 
239 #define __SCHR		(0x1<<2)
240 #define IS_SCHR(x)	((x) & __SCHR)
241 #define SET_SCHR(x)	((x) |= __SCHR)
242 #define UNSET_SCHR(x)	(x) &= (__SCHR ^ __MASK )
243 
244 #define __SDIR		(0x1<<3)
245 #define IS_SDIR(x)	((x) & __SDIR)
246 #define SET_SDIR(x)	((x) |= __SDIR)
247 #define UNSET_SDIR(x)	(x) &= (__SDIR ^ __MASK )
248 
249 #define __SBLK		(0x1<<4)
250 #define IS_SBLK(x)	((x) & __SBLK)
251 #define SET_SBLK(x)	((x) |= __SBLK)
252 #define UNSET_SBLK(x)	(x) &= (__SBLK ^ __MASK )
253 
254 #define __SREG		(0x1<<5)
255 #define IS_SREG(x)	((x) & __SREG)
256 #define SET_SREG(x)	((x) |= __SREG)
257 #define UNSET_SREG(x)	(x) &= (__SREG ^ __MASK )
258 
259 #define __SLNK		(0x1<<6)
260 #define IS_SLNK(x)	((x) & __SLNK)
261 #define SET_SLNK(x)	((x) |= __SLNK)
262 #define UNSET_SLNK(x)	(x) &= (__SLNK ^ __MASK )
263 
264 #define __SSOCK		(0x1<<7)
265 #define IS_SSOCK(x)	((x) & __SSOCK)
266 #define SET_SSOCK(x)	((x) |= __SSOCK)
267 #define UNSET_SSOCK(x)	(x) &= (__SSOCK ^ __MASK )
268 
269 /** higher level types **/
270 
271 #define __MONITOR_TYPE		(0x1<<8)
272 #define IS_MONITOR_TYPE(x)	((x) & __MONITOR_TYPE)
273 #define SET_MONITOR_TYPE(x)	(x) |=  __MONITOR_TYPE
274 #define UNSET_MONITOR_TYPE(x)	(x) &= (__MONITOR_TYPE ^ __MASK )
275 
276 #define __LOCAL_TYPE		(0x1<<9)
277 #define IS_LOCAL_TYPE(x)	((x) & __LOCAL_TYPE)
278 #define SET_LOCAL_TYPE(x)	(x) |=  __LOCAL_TYPE
279 #define UNSET_LOCAL_TYPE(x)	(x) &= (__LOCAL_TYPE ^ __MASK )
280 
281 #define __DUMMY_TYPE		(0x1<<10)
282 #define IS_DUMMY_TYPE(x)	((x) & __DUMMY_TYPE)
283 #define SET_DUMMY_TYPE(x)	(x) |= __DUMMY_TYPE
284 #define UNSET_DUMMY_TYPE(x)	(x) &= (__DUMMY_TYPE ^ __MASK )
285 
286 #define __ROOT_TYPE		(0x1<<11)
287 #define IS_ROOT_TYPE(x)		((x) & __ROOT_TYPE)
288 #define SET_ROOT_TYPE(x)	(x) |= __ROOT_TYPE
289 #define UNSET_ROOT_TYPE(x)	(x) &= (__ROOT_TYPE ^ __MASK )
290 
291 #define __UP_TYPE		(0x1<<12)
292 #define IS_UP_TYPE(x)		((x) & __UP_TYPE)
293 #define SET_UP_TYPE(x)		(x) |= __UP_TYPE
294 #define UNSET_UP_TYPE(x)	(x) &= (__UP_TYPE ^ __MASK )
295 
296 #define __PROC_TYPE		(0x1<<13)
297 #define IS_PROC_TYPE(x)		((x) & __PROC_TYPE)
298 #define SET_PROC_TYPE(x)	(x) |= __PROC_TYPE
299 #define UNSET_PROC_TYPE(x)	(x) &= (__PROC_TYPE ^ __MASK )
300 
301 #define __CDFS_TYPE		(0x1<<14)
302 #define IS_CDFS_TYPE(x)		((x) & __CDFS_TYPE)
303 #define SET_CDFS_TYPE(x)	(x) |= __CDFS_TYPE
304 #define UNSET_CDFS_TYPE(x)	(x) &= (__CDFS_TYPE ^ __MASK )
305 
306 #define __USER_TYPE		(0x1<<15)
307 #define IS_USER_TYPE(x)		((x) & __USER_TYPE)
308 #define SET_USER_TYPE(x)	(x) |= __USER_TYPE
309 #define UNSET_USER_TYPE(x)	(x) &= (__USER_TYPE ^ __MASK )
310 
311 #define __NFS_TYPE		(0x1<<16)
312 #define IS_NFS_TYPE(x)		((x) & __NFS_TYPE)
313 #define SET_NFS_TYPE(x)		(x) |= __NFS_TYPE
314 #define UNSET_NFS_TYPE(x)	(x) &= (__NFS_TYPE ^ __MASK )
315 
316 #define __SMB_TYPE		(0x1<<17)
317 #define IS_SMB_TYPE(x)		((x) & __SMB_TYPE)
318 #define SET_SMB_TYPE(x)		(x) |= __SMB_TYPE
319 #define UNSET_SMB_TYPE(x)	(x) &= (__SMB_TYPE ^ __MASK )
320 
321 #define __FSTAB_TYPE		(0x1<<18)
322 #define IS_FSTAB_TYPE(x)	((x) & __FSTAB_TYPE)
323 #define SET_FSTAB_TYPE(x)	(x) |= __FSTAB_TYPE
324 #define UNSET_FSTAB_TYPE(x)	(x) &= (__FSTAB_TYPE ^ __MASK )
325 
326 #define __MTAB_TYPE		(0x1<<19)
327 #define IS_MTAB_TYPE(x)		((x) & __MTAB_TYPE)
328 #define SET_MTAB_TYPE(x)	(x) |= __MTAB_TYPE
329 #define UNSET_MTAB_TYPE(x)	(x) &= (__MTAB_TYPE ^ __MASK )
330 
331 #define __PARTITION_TYPE	(0x1<<20)
332 #define IS_PARTITION_TYPE(x)	((x) & __PARTITION_TYPE)
333 #define SET_PARTITION_TYPE(x)	(x) |= __PARTITION_TYPE
334 #define UNSET_PARTITION_TYPE(x)	(x) &= (__PARTITION_TYPE ^ __MASK )
335 
336 #define __EXE_TYPE		(0x1<<21)
337 #define IS_EXE_TYPE(x)		((x) & __EXE_TYPE)
338 #define SET_EXE_TYPE(x)		(x) |= __EXE_TYPE
339 #define UNSET_EXE_TYPE(x)	(x) &= (__EXE_TYPE ^ __MASK )
340 
341 #define __NOWRITE_TYPE		(0x1<<22)
342 #define IS_NOWRITE_TYPE(x)	((x) & __NOWRITE_TYPE)
343 #define SET_NOWRITE_TYPE(x)	(x) |= __NOWRITE_TYPE
344 #define UNSET_NOWRITE_TYPE(x)	(x) &= (__NOWRITE_TYPE ^ __MASK )
345 
346 #define __NOACCESS_TYPE		(0x1<<23)
347 #define IS_NOACCESS_TYPE(x)	((x) & __NOACCESS_TYPE)
348 #define SET_NOACCESS_TYPE(x)	(x) |= __NOACCESS_TYPE
349 #define UNSET_NOACCESS_TYPE(x)	(x) &= (__NOACCESS_TYPE ^ __MASK )
350 
351 #define __BROKEN_LNK		(0x1<<24)
352 #define IS_BROKEN_LNK(x)	((x) & __BROKEN_LNK)
353 #define SET_BROKEN_LNK(x)	(x) |= __BROKEN_LNK
354 #define UNSET_BROKEN_LNK(x)	(x) &= (__BROKEN_LNK ^ __MASK )
355 
356 #define __MOUNTED_TYPE		(0x1<<25)
357 #define IS_MOUNTED_TYPE(x)	((x) & __MOUNTED_TYPE)
358 #define SET_MOUNTED_TYPE(x)	(x) |= __MOUNTED_TYPE
359 #define UNSET_MOUNTED_TYPE(x)	(x) &= (__MOUNTED_TYPE ^ __MASK )
360 
361 #define __DOTDESKTOP		(0x1<<26)
362 #define IS_DOTDESKTOP(x)	((x) & __DOTDESKTOP)
363 #define SET_DOTDESKTOP(x)	(x) |= __DOTDESKTOP
364 #define UNSET_DOTDESKTOP(x)	(x) &= (__DOTDESKTOP ^ __MASK )
365 
366 #define __PLUGIN_TYPE1		(0x1<<27)
367 #define IS_PLUGIN_TYPE1(x)	((x) & __PLUGIN_TYPE1)
368 #define SET_PLUGIN_TYPE1(x)	(x) |= __PLUGIN_TYPE1
369 #define UNSET_PLUGIN_TYPE1(x)	(x) &= (__PLUGIN_TYPE1 ^ __MASK )
370 
371 #define __PLUGIN_TYPE2		(0x1<<28)
372 #define IS_PLUGIN_TYPE2(x)	((x) & __PLUGIN_TYPE2)
373 #define SET_PLUGIN_TYPE2(x)	(x) |= __PLUGIN_TYPE2
374 #define UNSET_PLUGIN_TYPE2(x)	(x) &= (__PLUGIN_TYPE2 ^ __MASK )
375 
376 #define __PLUGIN_TYPE3		(0x1<<29)
377 #define IS_PLUGIN_TYPE3(x)	((x) & __PLUGIN_TYPE3)
378 #define SET_PLUGIN_TYPE3(x)	(x) |= __PLUGIN_TYPE3
379 #define UNSET_PLUGIN_TYPE3(x)	(x) &= (__PLUGIN_TYPE3 ^ __MASK )
380 
381 
382 
383 
384 /******************************************************/
385 
386 
387 
388 // IS_FILE excludes directories and symlinks to directories
389 #define IS_FILE(x) \
390 ( \
391 	!IS_SDIR(x) \
392 	     && \
393 	(  \
394 	   (x) | __SREG | __SCHR | __SBLK | __SFIFO | __SSOCK  \
395 	       || \
396 	   IS_BROKEN_LNK(x)  \
397 	)  \
398 )
399 #define SINGLE_CLICK_MODE \
400     (!getenv("RFM_DOUBLE_CLICK_NAVIGATION") || \
401        strlen(getenv("RFM_DOUBLE_CLICK_NAVIGATION"))==0)
402 
403 /****  preferences flag (view and preferences) *****/
404 #define __SHOW_HIDDEN		__SHOWS_HIDDEN
405 #define __SHOW_IMAGES		__SHOWS_IMAGES
406 // show images, and sort descending
407 #define DEFAULT_PREFERENCES    (__SHOW_IMAGES | __SHOWS_ASCENDING | __SHOWS_BACKUP)
408 //#define DEFAULT_PREFERENCES    (__SHOW_IMAGES)
409 #define DEFAULT_VIEW_PREFERENCES DEFAULT_PREFERENCES
410 #define DEFAULT_REMOTE_PREFERENCES (__SHOWS_ASCENDING)
411 #define DEFAULT_SORT_COLUMN (TYPE_SORT)
412 #define SORT_ASCENDING		__SHOWS_ASCENDING
413 
414 #define BIT_MASK	0xffffffff
415 
416 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
417   g_object_set_data_full (G_OBJECT (component), name, \
418     g_object_ref (widget), (GDestroyNotify) g_object_unref)
419 
420 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
421   g_object_set_data (G_OBJECT (component), name, widget)
422 
423 
424 # define LOCK_DISPLAY XLockDisplay(gdk_x11_display_get_xdisplay(gdk_display_get_default()))
425 
426 # define UNLOCK_DISPLAY XUnlockDisplay(gdk_x11_display_get_xdisplay(gdk_display_get_default()))
427 
428 
429 #endif /*__CONSTANTS__*/
430