1 /*
2  * ROX-Filer, filer for the ROX desktop project
3  * By Thomas Leonard, <tal197@users.sourceforge.net>.
4  */
5 
6 /* global.h is included by most of the other source files, just after
7  * including config.h and the system header files, but before any other
8  * ROX-Filer header files.
9  */
10 
11 #include <glib.h>
12 
13 //#define UNIT_TESTS
14 
15 /* We put all the global typedefs here to avoid creating dependencies
16  * between header files.
17  */
18 
19 /* Each filer window has one of these all to itself */
20 typedef struct _FilerWindow FilerWindow;
21 
22 /* There is one Directory object per cached disk directory inode number.
23  * Multiple FilerWindows may share a single Directory. Directories
24  * are cached, so a Directory may exist without any filer windows
25  * referencing it at all.
26  */
27 typedef struct _Directory Directory;
28 
29 /* Each item in a directory has a DirItem. This contains information from
30  * stat()ing the file, plus a few other bits. There may be several of these
31  * for a single file, if it appears (hard-linked) in several directories.
32  * Each pinboard and panel icon also has one of these (not shared).
33  */
34 typedef struct _DirItem DirItem;
35 
36 /* Widgets which can display directories implement the View interface.
37  * This should be used in preference to the old collection interface because
38  * it isn't specific to a particular type of display.
39  */
40 typedef struct _ViewIface ViewIface;
41 
42 /* A ViewIter specifies a single item in a View, rather like an index.
43  * They can be used to iterate over all the items in a View, and remain
44  * valid until the View is changed. If allocated on the stack, they do not need
45  * to be freed.
46  */
47 typedef struct _ViewIter ViewIter;
48 
49 /* This contains the pixbufs for an image, in various sizes.
50  * Despite the name, it now contains neither pixmaps nor masks!
51  */
52 typedef struct _MaskedPixmap MaskedPixmap;
53 
54 /* Each MIME type (eg 'text/plain') has one of these. It contains
55  * a link to the image and the type's name (used so that the image can
56  * be refreshed, among other things).
57  */
58 typedef struct _MIME_type MIME_type;
59 
60 /* Icon is an abstract base class for pinboard and panel icons.
61  * It contains the name and path of the icon, as well as its DirItem.
62  */
63 typedef struct _Icon Icon;
64 
65 /* There will be one of these if the pinboard is in use. It contains
66  * the name of the pinboard and links to the pinned Icons inside.
67  */
68 typedef struct _Pinboard Pinboard;
69 
70 /* There is one of these for each panel window open. Panels work rather
71  * like little pinboards, but with a more rigid layout.
72  */
73 typedef struct _Panel Panel;
74 
75 /* Each option has a static Option structure. This is initialised by
76  * calling option_add_int() or similar. See options.c for details.
77  * This structure is read-only.
78  */
79 typedef struct _Option Option;
80 
81 /* A filesystem cache provides a quick and easy way to load files.
82  * When a cache is created, functions to load and update files are
83  * registered to it. Requesting an object from the cache will load
84  * or update it as needed, or return the cached copy if the current
85  * version of the file is already cached.
86  * Caches are used to access directories, images and XML files.
87  */
88 typedef struct _GFSCache GFSCache;
89 
90 /* Each cached XML file is represented by one of these */
91 typedef struct _XMLwrapper XMLwrapper;
92 
93 /* This holds a pre-parsed version of a filename, which can be quickly
94  * compared with another CollateKey for intelligent sorting.
95  */
96 typedef struct _CollateKey CollateKey;
97 
98 /* Like a regular GtkLabel, except that the text can be wrapped to any
99  * width. Used for pinboard icons.
100  */
101 typedef struct _WrappedLabel WrappedLabel;
102 
103 /* A filename where " " has been replaced by "%20", etc.
104  * This is really just a string, but we try to catch type errors.
105  */
106 typedef struct _EscapedPath EscapedPath;
107 
108 /* The minibuffer is a text field which appears at the bottom of
109  * a filer window. It has various modes of operation:
110  */
111 typedef enum {
112 	MINI_NONE,
113 	MINI_PATH,
114 	MINI_SHELL,
115 	MINI_SELECT_IF,
116 	MINI_FILTER,
117 	MINI_SELECT_BY_NAME,
118 } MiniType;
119 
120 /* The next three correspond to the styles on the Display submenu: */
121 
122 typedef enum {		/* Values used in options, must start at 0 */
123 	LARGE_ICONS	= 0,
124 	SMALL_ICONS	= 1,
125 	HUGE_ICONS	= 2,
126 	AUTO_SIZE_ICONS	= 3,
127 	UNKNOWN_STYLE
128 } DisplayStyle;
129 
130 typedef enum {		/* Values used in options, must start at 0 */
131 	DETAILS_NONE		= 0,
132 	DETAILS_SIZE		= 2,
133 	DETAILS_PERMISSIONS	= 3,
134 	DETAILS_TYPE		= 4,
135 	DETAILS_TIMES		= 5,
136 	DETAILS_UNKNOWN		= -1,
137 } DetailsType;
138 
139 typedef enum {		/* Values used in options */
140 	SORT_NAME = 0,
141 	SORT_TYPE = 1,
142 	SORT_DATE = 2,
143 	SORT_SIZE = 3,
144 	SORT_OWNER = 4,
145 	SORT_GROUP = 5
146 } SortType;
147 
148 /* Each DirItem has a base type with indicates what kind of object it is.
149  * If the base_type is TYPE_FILE, then the MIME type field gives the exact
150  * type.
151  */
152 enum
153 {
154 	/* Base types - this also determines the sort order */
155 	TYPE_ERROR,
156 	TYPE_UNKNOWN,		/* Not scanned yet */
157 	TYPE_DIRECTORY,
158 	TYPE_PIPE,
159 	TYPE_SOCKET,
160 	TYPE_FILE,
161 	TYPE_CHAR_DEVICE,
162 	TYPE_BLOCK_DEVICE,
163 	TYPE_DOOR,
164 
165 	/* These are purely for colour allocation */
166 	TYPE_EXEC,
167 	TYPE_APPDIR,
168 };
169 
170 /* The namespaces for the SOAP messages */
171 #define SOAP_ENV_NS_OLD "http://www.w3.org/2001/06/soap-envelope"
172 #define SOAP_ENV_NS "http://www.w3.org/2001/12/soap-envelope"
173 #define SOAP_RPC_NS "http://www.w3.org/2001/12/soap-rpc"
174 #define ROX_NS "http://rox.sourceforge.net/SOAP/ROX-Filer"
175 
176 /* Namespace for configuration */
177 #define SITE "rox.sourceforge.net"
178 
179 /* Stock icons */
180 #define ROX_STOCK_SHOW_DETAILS "rox-show-details"
181 #define ROX_STOCK_SHOW_HIDDEN  "rox-show-hidden"
182 #define ROX_STOCK_SELECT       "rox-select"
183 #define ROX_STOCK_MOUNT        "rox-mount"
184 #define ROX_STOCK_MOUNTED      "rox-mounted"
185 #define ROX_STOCK_XATTR        "rox-xattr"
186 #define ROX_STOCK_SYMLINK      "rox-symlink"
187 
188 /* Re-use an existing icon for a slightly different purpose */
189 #define ROX_STOCK_BOOKMARKS    GTK_STOCK_JUMP_TO
190 
191 #include <libxml/tree.h>
192