File: fma-icontext-factory.c

package info (click to toggle)
filemanager-actions 3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 27,428 kB
  • sloc: ansic: 48,857; xml: 17,767; sh: 4,662; makefile: 1,375; lisp: 9
file content (548 lines) | stat: -rw-r--r-- 17,088 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
/*
 * FileManager-Actions
 * A file-manager extension which offers configurable context menu actions.
 *
 * Copyright (C) 2005 The GNOME Foundation
 * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
 * Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
 *
 * FileManager-Actions is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * FileManager-Actions is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FileManager-Actions; see the file COPYING. If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *   Frederic Ruaudel <grumz@grumz.net>
 *   Rodrigo Moya <rodrigo@gnome-db.org>
 *   Pierre Wieser <pwieser@trychlos.org>
 *   ... and many others (see AUTHORS)
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <glib/gi18n.h>

#include <api/fma-ifactory-object-data.h>
#include <api/fma-data-def.h>
#include <api/fma-data-types.h>

/*
 * As of 3.2 non copyables data are:
 * - multiple flag
 */

FMADataDef data_def_conditions [] = {

	{ FMAFO_DATA_BASENAMES,
				TRUE,
				TRUE,
				TRUE,
				N_( "List of patterns to be matched against the selected file(s)/folder(s)" ),
				/* i18n: wildcard characters '*' and '?' should be considered as literals,
				 *  and not be translated */
				N_( "A list of strings with joker '*' or '?' to be matched against the name(s) " \
					"of the selected file(s)/folder(s). Each selected item must match at least " \
					"one of the filename patterns for the action or the menu be candidate to " \
					"display.\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to '*'." ),
				FMA_DATA_TYPE_STRING_LIST,
				"*",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"basenames",
				"Basenames",
				'b',
				"basename",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				/* i18n: wildcard characters '*' and '?' should be considered as literalls,
				 *  and not be translated */
				N_( "A pattern to be matched against basenames of selected file(s)/folder(s). " \
					"May include wildcards (* or ?). " \
					"You must set one option for each pattern you need" ),
					/* i18n: the "<EXPR>" is just an abbreviation for "an expression",
					 *  so is tranlatable */
				N_( "<EXPR>" ) },

	{ FMAFO_DATA_MATCHCASE,
				TRUE,
				TRUE,
				TRUE,
				N_( "Whether the specified basenames are case sensitive (default)" ),
				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
				N_( "Must be set to 'true' if the filename patterns are case sensitive, to 'false' " \
					"otherwise. E.g., if you need to match a filename in a case-sensitive manner, " \
					"set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', " \
					"then set 'false'.\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to 'true'." ),
				FMA_DATA_TYPE_BOOLEAN,
				"true",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"matchcase",
				"Matchcase",
				'a',
				"match-case",
				0,
				G_OPTION_ARG_NONE,
				NULL,
				NULL },

	{ FMAFO_DATA_MIMETYPES,
				TRUE,
				TRUE,
				TRUE,
				N_( "List of patterns to be matched against the mimetypes of the selected file(s)/folder(s)" ),
				/* i18n: wildcard character '*' is taken literally, and should not be translated */
				N_( "A list of strings with joker '*' to be matched against the mimetypes of the " \
					"selected file(s)/folder(s). Each selected item must match at least one of " \
					"the mimetype patterns for the action to appear.\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to '*/*'." ),
				FMA_DATA_TYPE_STRING_LIST,
				"*",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"mimetypes",
				"MimeTypes",
				'm',
				"mimetype",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				/* i18n: wildcard character '*' is taken literally, and should not be translated */
				N_( "A pattern to be matched against mimetypes of selected file(s)/folder(s). " \
					"May include the asterisk wildcard '*'. " \
					"You must set one option for each pattern you need" ),
				/* i18n: "<EXPR>" is just an abbreviation for "an expression", so is tranlatable */
				N_( "<EXPR>" ) },

	/* A runtime boolean set to TRUE if we detect that the previous string list
	 * just cover all mimetypes: this let us optimize the check for candidates
	 * in the menu plugin.
	 * When FALSE, than we have to check each and every mimetype :(
	 * This value is set when loading a pre-v3 profile, and then reset each time
	 * we update the list of mimetypes.
	 */
	{ FMAFO_DATA_MIMETYPES_IS_ALL,
				FALSE,
				FALSE,
				TRUE,
				"Does the mimetypes list is generic ?",
				"The generic wildcard may be coded as '*', or '*/*' or 'all' or 'all/*' or 'all/all'. "
				"In each case, we will try to spend as less time as possible to check " \
				"selection mimetypes",
				FMA_DATA_TYPE_BOOLEAN,
				"true",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				NULL,
				NULL,
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	/* this is obsoleted starting with 2.30-newdata (released as 2.31.x series)
	 * and replaced by mimetypes
	 */
	{ FMAFO_DATA_ISFILE,
				TRUE,
				FALSE,
				FALSE,
				N_( "Whether the profile applies to files (deprecated option, see mimetype)" ),
				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
				N_( "Set to 'true' if the selection can have files, to 'false' otherwise.\n" \
					"This setting is tied in with the 'isdir' setting. The valid combinations are: \n" \
					"isfile='true' and isdir='false': the selection may hold only files\n" \
					"isfile='false' and isdir='true': the selection may hold only folders\n" \
					"isfile='true' and isdir='true': the selection may hold both files and folders\n" \
					"isfile='false' and isdir='false': this is an invalid combination " \
					"(your configuration will never appear).\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to 'true'." ),
				FMA_DATA_TYPE_BOOLEAN,
				"true",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"isfile",
				NULL,
				'f',
				"accept-files",
				0,
				G_OPTION_ARG_NONE,
				NULL,
				NULL },

	{ FMAFO_DATA_ISDIR,
				TRUE,
				FALSE,
				FALSE,
				N_( "Whether the profile applies to folders (deprecated option, see mimetype)" ),
				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
				N_( "Set to 'true' if the selection can have folders, to 'false' otherwise.\n" \
					"This setting is tied in with the 'isfile' setting. The valid combinations are: \n" \
					"isfile='true' and isdir='false': the selection may hold only files\n" \
					"isfile='false' and isdir='true': the selection may hold only folders\n" \
					"isfile='true' and isdir='true': the selection may hold both files and folders\n" \
					"isfile='false' and isdir='false': this is an invalid combination " \
					"(your configuration will never appear).\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to 'false'." ),
				FMA_DATA_TYPE_BOOLEAN,
				"false",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"isdir",
				NULL,
				'd',
				"accept-dirs",
				0,
				G_OPTION_ARG_NONE,
				NULL,
				NULL },

	/* this is obsoleted starting with 2.30-newdata (released as 2.31.x series)
	 * and replaced by selection-count
	 */
	{ FMAFO_DATA_MULTIPLE,
				TRUE,
				FALSE,
				FALSE,
				N_( "Whether the selection may be multiple (deprecated option, see selection count)" ),
				/* i18n: 'true' and 'false' values are taken literally, and should not be translated */
				N_( "If you need more than one files or folders to be selected, set this " \
					"key to 'true'. If you want just one file or folder, set it to 'false'.\n" \
					"This obviously only applies when there is a selection.\n" \
					"Defaults to 'false'." ),
				FMA_DATA_TYPE_BOOLEAN,
				"false",
				FALSE,
				FALSE,
				FALSE,
				FALSE,
				FALSE,
				"accept-multiple-files",
				NULL,
				'u',
				"accept-multiple",
				0,
				G_OPTION_ARG_NONE,
				NULL,
				NULL },

	{ FMAFO_DATA_SCHEMES,
				TRUE,
				TRUE,
				TRUE,
				N_( "List of schemes to be matched against those of selected file(s)/folder(s)" ),
										/* too long string for iso c: 510 (max=509) */
				/* i18n: schemes (sftp, ssh, ftp, file, etc.) are standard keywords which define
				 *  the access protocol to an object, they should not be translated */
				N_( "Defines the list of valid schemes to be matched against the selected " \
					"items. The scheme is the protocol used to access the files. The " \
					"keyword to use is the one used in the URI by the file manager.\n" \
					"Examples of valid URI include:\n" \
					"- file:///tmp/foo.txt\n" \
					"- sftp:///root@test.example.net/tmp/foo.txt\n" \
					"The most common schemes are:\n" \
					"'file': local files\n" \
					"'sftp': files accessed via SSH\n" \
					"'ftp': files accessed via FTP\n" \
					"'smb': files accessed via Samba (Windows share)\n" \
					"'dav': files accessed via WebDAV.\n" \
					"All schemes used by your favorite file manager may be used here.\n" \
					"This obviously only applies when there is a selection, " \
					"or when targeting the special 'x-nautilus-desktop' scheme.\n" \
					"Defaults to 'file'." ),
				FMA_DATA_TYPE_STRING_LIST,
				"*",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"schemes",
				"Schemes",
				's',
				"scheme",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				N_( "A valid GIO scheme where the selected file(s)/folder(s) should be located. " \
					"You must set one option for each scheme you need" ),
				/* i18n: "<STRING>" is just an abbreviation for "a string", so is tranlatable */
				N_( "<STRING>" ) },

	{ FMAFO_DATA_FOLDERS,
				TRUE,
				TRUE,
				TRUE,
				N_( "List of folders" ),
				N_( "Defines the list of valid paths to be matched against the current folder.\n " \
					"All folders 'under' the specified path are considered valid.\n" \
					"Defaults to '/'." ),
				FMA_DATA_TYPE_STRING_LIST,
				"/",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"folders",
				"Folders",
				'r',
				"folder",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				N_( "The path of a (parent) directory for which the item will be displayed. " \
					"You must set one option for each folder you need" ),
				/* i18n: "<PATH>" is just an abbreviation for "a folder path", so is tranlatable */
				N_( "<PATH>" ) },

	{ FMAFO_DATA_SELECTION_COUNT,
				TRUE,
				TRUE,
				TRUE,
				N_( "Operator of the selection count relation" ),
				N_( "Whether this profile may be selected depending of the count of the selection.\n" \
					"This is a string of the form \"{'<'|'='|'>'} number\".\n" \
					"Examples of valid strings are: \"=0\", \"> 1\", \"< 10\".\n" \
					"Defaults to \">0\"." ),
				FMA_DATA_TYPE_STRING,
				">0",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"selection-count",
				"SelectionCount",
				'c',
				"selection-count",
				0,
				G_OPTION_ARG_STRING,
				N_( "Selection count relation [>0]" ),
				/* i18n: "<EXPR>" is just an abbreviation for "an expression", so is tranlatable */
				N_( "<EXPR>" ) },

	{ FMAFO_DATA_ONLY_SHOW,
				TRUE,
				TRUE,
				TRUE,
				N_( "Only show in environment" ),
				N_( "Defaults to all." ),
				FMA_DATA_TYPE_STRING_LIST,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"only-show-in",
				"OnlyShowIn",
				'y',
				"only-show-in",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				N_( "The name of an only desktop environment where the item must be displayed. " \
					"You must set one option for each environment you want" ),
				/* i18n: "<DESKTOP>" is just a placeholder for "a desktop name", so is tranlatable */
				N_( "<DESKTOP>" ) },

	{ FMAFO_DATA_NOT_SHOW,
				TRUE,
				TRUE,
				TRUE,
				N_( "Not show in environment" ),
				N_( "Defaults to none." ),
				FMA_DATA_TYPE_STRING_LIST,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"not-show-in",
				"NotShowIn",
				'Y',
				"not-show-in",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				N_( "The name of a desktop environment where the item must not be displayed. " \
					"You must set one option for each environment you want" ),
				/* i18n: "<DESKTOP>" is just a placeholder for "a desktop name", so is tranlatable */
				N_( "<DESKTOP>" ) },

	{ FMAFO_DATA_TRY_EXEC,
				TRUE,
				TRUE,
				TRUE,
				N_( "Try exec" ),
				/* i18n: TryExec is a keyword of the specification, it is not translatable */
				N_( "Note that, when specified, only the presence and the executability status of " \
					"the specified file are checked.\n" \
					"Parameters may appear in 'TryExec' value, and will be substituted at runtime.\n" \
					"Defaults to successful." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"try-exec",
				"TryExec",
				'X',
				"try-exec",
				0,
				G_OPTION_ARG_STRING,
				N_( "the path to a file whose executability is to be checked" ),
				/* i18n: "<PATH>" is the path to a binary, so may be tranlatable */
				N_( "<PATH>" ) },

	{ FMAFO_DATA_SHOW_IF_REGISTERED,
				TRUE,
				TRUE,
				TRUE,
				N_( "Show if registered" ),
				/* i18n: ShowIfRegistered is a keyword of the specification, it is not translatable */
				N_( "The well-known name of a DBus service.\n" \
					"The item will be candidate if the named service is registered on session DBus at runtime.\n" \
					"Parameters may appear in 'ShowIfRegistered' value, and will be substituted at runtime.\n" \
					"Defaults to successful." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"show-if-registered",
				"ShowIfRegistered",
				'g',
				"show-if-registered",
				0,
				G_OPTION_ARG_STRING,
				N_( "The name of a service which must be registered on session DBus" ),
				N_( "<NAME>" ) },

	{ FMAFO_DATA_SHOW_IF_TRUE,
				TRUE,
				TRUE,
				TRUE,
				N_( "Show if True" ),
				/* i18n: ShowIfTrue is a keyword of the specification, it is not translatable */
				N_( "A command which, when executed, should output a string on stdout.\n" \
					"The item will be candidate if the outputed string is equal to \"true\".\n" \
					"Parameters may appear in 'ShowIfTrue' value, and will be substituted at runtime.\n" \
					"Defaults to successful." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"show-if-true",
				"ShowIfTrue",
				'U',
				"show-if-true",
				0,
				G_OPTION_ARG_STRING,
				/* i18n: 'true' is to be taken as a literal, must not be translated */
				N_( "The path to a command which will display the 'true' string" ),
				N_( "<PATH>" ) },

	{ FMAFO_DATA_SHOW_IF_RUNNING,
				TRUE,
				TRUE,
				TRUE,
				N_( "Show if running" ),
				/* i18n: ShowIfRunning is a keyword of the specification, it is not translatable */
				N_( "The name of a process.\n" \
					"The item will be candidate if the process name is found in memory at runtime.\n" \
					"Parameters may appear in 'ShowIfRunning' value, and will be substituted at runtime.\n" \
					"Defaults to successful." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"show-if-running",
				"ShowIfRunning",
				'R',
				"show-if-running",
				0,
				G_OPTION_ARG_STRING,
				N_( "The name of a binary which must be running" ),
				N_( "<NAME>" ) },

	{ FMAFO_DATA_CAPABILITITES,
				TRUE,
				TRUE,
				TRUE,
				N_( "Capabilities" ),
				/* i18n: 'Owner', 'Readable', 'Writable', 'Executable' and 'Local' are all keywords
				 *  of the specification; they are not translatable */
				N_( "A list of capabilities each item of the selection must satisfy in order for the item to be candidate.\n" \
					"Capabilities may be negated.\n" \
					"Capabilities have to be chosen between following predefined ones:\n" \
					"- 'Owner': current user is the owner of selected items\n" \
					"- 'Readable': selected items are readable by user (probably more useful when negated)\n" \
					"- 'Writable': selected items are writable by user\n" \
					"- 'Executable': selected items are executable by user\n" \
					"- 'Local': selected items are local.\n" \
					"Defaults to empty list." ),
				FMA_DATA_TYPE_STRING_LIST,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"capabilities",
				"Capabilities",
				'P',
				"capability",
				0,
				G_OPTION_ARG_STRING_ARRAY,
				N_( "The name of a capability the selection must meet. "
					"May be 'Owner', 'Readable', 'Writable', 'Executable' or 'Local'" ),
				N_( "<NAME>" ) },

	{ NULL },
};