Set Nautilus-Actions as being the actual official product name
[nautilus-actions.git] / src / core / na-icontext-factory.c
blob10bd2c52fbb35493142fd6ef0145ce5ca629cdaf
1 /*
2 * Nautilus-Actions
3 * A Nautilus extension which offers configurable context menu actions.
5 * Copyright (C) 2005 The GNOME Foundation
6 * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7 * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
9 * This Program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This Program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this Library; see the file COPYING. If not,
21 * write to the Free Software Foundation, Inc., 59 Temple Place,
22 * Suite 330, Boston, MA 02111-1307, USA.
24 * Authors:
25 * Frederic Ruaudel <grumz@grumz.net>
26 * Rodrigo Moya <rodrigo@gnome-db.org>
27 * Pierre Wieser <pwieser@trychlos.org>
28 * ... and many others (see AUTHORS)
31 #ifdef HAVE_CONFIG_H
32 #include <config.h>
33 #endif
35 #include <glib/gi18n.h>
37 #include <api/na-ifactory-object-data.h>
38 #include <api/na-data-def.h>
39 #include <api/na-data-types.h>
41 NADataDef data_def_conditions [] = {
43 { NAFO_DATA_BASENAMES,
44 TRUE,
45 TRUE,
46 TRUE,
47 N_( "List of patterns to be matched against the selected file(s)/folder(s)" ),
48 /* i18n: wildcard characters '*' and '?' should be considered as literalls,
49 * and not be translated */
50 N_( "A list of strings with joker '*' or '?' to be matched against the name(s) " \
51 "of the selected file(s)/folder(s). Each selected items must match at least " \
52 "one of the filename patterns for the action or the menu be candidate to " \
53 "display.\n" \
54 "This obviously only applies when there is a selection.\n" \
55 "Defaults to '*'." ),
56 NAFD_TYPE_STRING_LIST,
57 "[*]",
58 FALSE,
59 TRUE,
60 TRUE,
61 FALSE,
62 FALSE,
63 "basenames",
64 "Basenames",
65 'b',
66 "basename",
68 G_OPTION_ARG_STRING_ARRAY,
69 /* i18n: wildcard characters '*' and '?' should be considered as literalls,
70 * and not be translated */
71 N_( "A pattern to be matched against basenames of selected file(s)/folder(s). " \
72 "May include wildcards (* or ?). " \
73 "You must set one option for each pattern you need" ),
74 /* i18n: the "<EXPR>" is just an abbreviation for "an expression",
75 * so is tranlatable */
76 N_( "<EXPR>" ) },
78 { NAFO_DATA_MATCHCASE,
79 TRUE,
80 TRUE,
81 TRUE,
82 N_( "Whether the specified basenames are case sensitive (default)" ),
83 /* i18n: 'true' and 'false' values are taken literally, and should not be translated */
84 N_( "Must be set to 'true' if the filename patterns are case sensitive, to 'false' " \
85 "otherwise. E.g., if you need to match a filename in a case-sensitive manner, " \
86 "set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', " \
87 "then set 'false'.\n" \
88 "This obviously only applies when there is a selection.\n" \
89 "Defaults to 'true'." ),
90 NAFD_TYPE_BOOLEAN,
91 "true",
92 FALSE,
93 TRUE,
94 TRUE,
95 FALSE,
96 FALSE,
97 "matchcase",
98 "Matchcase",
99 'a',
100 "match-case",
102 G_OPTION_ARG_NONE,
103 NULL,
104 NULL },
106 { NAFO_DATA_MIMETYPES,
107 TRUE,
108 TRUE,
109 TRUE,
110 N_( "List of patterns to be matched against the mimetypes of the selected file(s)/folder(s)" ),
111 /* i18n: wildcard character '*' is taken literally, and should not be translated */
112 N_( "A list of strings with joker '*' to be matched against the mimetypes of the " \
113 "selected file(s)/folder(s). Each selected items must match at least one of " \
114 "the mimetype patterns for the action to appear.\n" \
115 "This obviously only applies when there is a selection.\n" \
116 "Defaults to '*/*'." ),
117 NAFD_TYPE_STRING_LIST,
118 "[*/*]",
119 FALSE,
120 TRUE,
121 TRUE,
122 FALSE,
123 FALSE,
124 "mimetypes",
125 "MimeTypes",
126 'm',
127 "mimetype",
129 G_OPTION_ARG_STRING_ARRAY,
130 /* i18n: wildcard character '*' is taken literally, and should not be translated */
131 N_( "A pattern to be matched against mimetypes of selected file(s)/folder(s). " \
132 "May include the asterisk wildcard '*'. " \
133 "You must set one option for each pattern you need" ),
134 /* i18n: "<EXPR>" is just an abbreviation for "an expression", so is tranlatable */
135 N_( "<EXPR>" ) },
137 /* a runtime boolean set to TRUE if we detect that the previous string list
138 * just cover all mimetypes - this let us optimize the check for candidate
139 * in the menu plugin
140 * when FALSE, than we have to check each and every mimetype :(
142 { NAFO_DATA_ALL_MIMETYPES,
143 FALSE,
144 FALSE,
145 TRUE,
146 "Does the mimetypes list is generic ?",
147 "The generic wildcard may be coded as '*', or '*/*' or 'all' or 'all/*' or 'all/all'. "
148 "In each case, we will try to spend as less time as possible to check " \
149 "selection mimetypes",
150 NAFD_TYPE_BOOLEAN,
151 "true",
152 FALSE,
153 TRUE,
154 TRUE,
155 FALSE,
156 FALSE,
157 NULL,
158 NULL,
160 NULL,
163 NULL,
164 NULL },
166 { NAFO_DATA_ISFILE,
167 TRUE,
168 TRUE,
169 TRUE,
170 N_( "Whether the profile applies to files" ),
171 /* i18n: 'true' and 'false' values are taken literally, and should not be translated */
172 N_( "Set to 'true' if the selection can have files, to 'false' otherwise.\n" \
173 "This setting is tied in with the 'isdir' setting. The valid combinations are: \n" \
174 "isfile='true' and isdir='false': the selection may hold only files\n" \
175 "isfile='false' and isdir='true': the selection may hold only folders\n" \
176 "isfile='true' and isdir='true': the selection may hold both files and folders\n" \
177 "isfile='false' and isdir='false': this is an invalid combination " \
178 "(your configuration will never appear).\n" \
179 "This obviously only applies when there is a selection.\n" \
180 "Defaults to 'true'." ),
181 NAFD_TYPE_BOOLEAN,
182 "true",
183 FALSE,
184 TRUE,
185 TRUE,
186 FALSE,
187 FALSE,
188 "isfile",
189 NULL,
190 'f',
191 "accept-files",
193 G_OPTION_ARG_NONE,
194 NULL,
195 NULL },
197 { NAFO_DATA_ISDIR,
198 TRUE,
199 TRUE,
200 TRUE,
201 N_( "Whether the profile applies to folders" ),
202 /* i18n: 'true' and 'false' values are taken literally, and should not be translated */
203 N_( "Set to 'true' if the selection can have folders, to 'false' otherwise.\n" \
204 "This setting is tied in with the 'isfile' setting. The valid combinations are: \n" \
205 "isfile='true' and isdir='false': the selection may hold only files\n" \
206 "isfile='false' and isdir='true': the selection may hold only folders\n" \
207 "isfile='true' and isdir='true': the selection may hold both files and folders\n" \
208 "isfile='false' and isdir='false': this is an invalid combination " \
209 "(your configuration will never appear).\n" \
210 "This obviously only applies when there is a selection.\n" \
211 "Defaults to 'false'." ),
212 NAFD_TYPE_BOOLEAN,
213 "false",
214 FALSE,
215 TRUE,
216 TRUE,
217 FALSE,
218 FALSE,
219 "isdir",
220 NULL,
221 'd',
222 "accept-dirs",
224 G_OPTION_ARG_NONE,
225 NULL,
226 NULL },
228 /* this is obsoleted starting with 2.30-newdata (released as 2.31.x serie)
229 * and replaced by selection-count
231 { NAFO_DATA_MULTIPLE,
232 TRUE,
233 FALSE,
234 FALSE,
235 N_( "Whether the selection may be multiple" ),
236 /* i18n: 'true' and 'false' values are taken literally, and should not be translated */
237 N_( "If you need more than one files or folders to be selected, set this " \
238 "key to 'true'. If you want just one file or folder, set it to 'false'.\n" \
239 "This obviously only applies when there is a selection.\n" \
240 "Defaults to 'false'." ),
241 NAFD_TYPE_BOOLEAN,
242 "false",
243 FALSE,
244 FALSE,
245 FALSE,
246 FALSE,
247 FALSE,
248 "accept-multiple-files",
249 NULL,
251 NULL,
253 G_OPTION_ARG_NONE,
254 NULL,
255 NULL },
257 { NAFO_DATA_SCHEMES,
258 TRUE,
259 TRUE,
260 TRUE,
261 N_( "List of schemes to be matched against those of selected file(s)/folder(s)" ),
262 /* too long string for iso c: 510 (max=509) */
263 /* i18n: schemes (sftp, ssh, ftp, file, etc.) are standard keywords which define
264 * the access protocol to an object, they should not be translated */
265 N_( "Defines the list of valid schemes to be matched against the selected " \
266 "items. The scheme is the protocol used to access the files. The " \
267 "keyword to use is the one used in the URI by the file manager.\n" \
268 "Examples of valid URI include:\n" \
269 "- file:///tmp/foo.txt\n" \
270 "- sftp:///root@test.example.net/tmp/foo.txt\n" \
271 "The most common schemes are:\n" \
272 "'file': local files\n" \
273 "'sftp': files accessed via SSH\n" \
274 "'ftp': files accessed via FTP\n" \
275 "'smb': files accessed via Samba (Windows share)\n" \
276 "'dav': files accessed via WebDAV.\n" \
277 "All schemes used by your favorite file manager may be used here.\n" \
278 "This obviously only applies when there is a selection, " \
279 "or when targeting the special 'x-nautilus-desktop' scheme.\n" \
280 "Defaults to 'file'." ),
281 NAFD_TYPE_STRING_LIST,
282 "[*]",
283 FALSE,
284 TRUE,
285 TRUE,
286 FALSE,
287 FALSE,
288 "schemes",
289 "Schemes",
290 's',
291 "scheme",
293 G_OPTION_ARG_STRING,
294 N_( "A valid GIO scheme where the selected file(s)/folder(s) should be located. " \
295 "You must set one option for each scheme you need" ),
296 /* i18n: "<STRING>" is just an abbreviation for "a string", so is tranlatable */
297 N_( "<STRING>" ) },
299 { NAFO_DATA_FOLDERS,
300 TRUE,
301 TRUE,
302 TRUE,
303 N_( "List of folders" ),
304 N_( "Defines the list of valid paths to be matched against the current folder.\n " \
305 "All folders 'under' the specified path are considered valid.\n" \
306 "Defaults to '/'." ),
307 NAFD_TYPE_STRING_LIST,
308 "[/]",
309 FALSE,
310 TRUE,
311 TRUE,
312 FALSE,
313 FALSE,
314 "folders",
315 "Folders",
316 'r',
317 "folder",
319 G_OPTION_ARG_STRING,
320 N_( "The path of a (parent) directory for which the item will be displayed. " \
321 "You must set one option for each folder you need" ),
322 /* i18n: "<PATH>" is just an abbreviation for "a folder path", so is tranlatable */
323 N_( "<PATH>" ) },
325 { NAFO_DATA_SELECTION_COUNT,
326 TRUE,
327 TRUE,
328 TRUE,
329 N_( "Operator of the selection count relation" ),
330 N_( "Whether this profile may be selected depending of the count of the selection.\n" \
331 "This is a string of the form \"{'<'|'='|'>'} number\".\n" \
332 "Examples of valid strings are: \"=0\", \"> 1\", \"< 10\".\n" \
333 "Defaults to \">0\"." ),
334 NAFD_TYPE_STRING,
335 ">0",
336 FALSE,
337 TRUE,
338 TRUE,
339 FALSE,
340 FALSE,
341 "selection-count",
342 "SelectionCount",
344 NULL,
346 G_OPTION_ARG_NONE,
347 NULL,
348 NULL },
350 { NAFO_DATA_ONLY_SHOW,
351 TRUE,
352 TRUE,
353 TRUE,
354 N_( "Only show in environment" ),
355 N_( "Defaults to all." ),
356 NAFD_TYPE_STRING_LIST,
357 NULL,
358 FALSE,
359 TRUE,
360 TRUE,
361 FALSE,
362 FALSE,
363 "only-show-in",
364 "OnlyShowIn",
366 NULL,
368 G_OPTION_ARG_NONE,
369 NULL,
370 NULL },
372 { NAFO_DATA_NOT_SHOW,
373 TRUE,
374 TRUE,
375 TRUE,
376 N_( "Not show in environment" ),
377 N_( "Defaults to none." ),
378 NAFD_TYPE_STRING_LIST,
379 NULL,
380 FALSE,
381 TRUE,
382 TRUE,
383 FALSE,
384 FALSE,
385 "not-show-in",
386 "NotShowIn",
388 NULL,
390 G_OPTION_ARG_NONE,
391 NULL,
392 NULL },
394 { NAFO_DATA_TRY_EXEC,
395 TRUE,
396 TRUE,
397 TRUE,
398 N_( "Try exec" ),
399 /* i18n: TryExec is a keyword of the specification, it is not translatable */
400 N_( "Note that, when specified, only the presence and the executability status of " \
401 "the specified file are checked.\n" \
402 "Parameters may appear in 'TryExec' value, and will be substituted at runtime.\n" \
403 "Defaults to successful." ),
404 NAFD_TYPE_STRING,
405 NULL,
406 FALSE,
407 TRUE,
408 TRUE,
409 FALSE,
410 FALSE,
411 "try-exec",
412 "TryExec",
414 NULL,
416 G_OPTION_ARG_NONE,
417 NULL,
418 NULL },
420 { NAFO_DATA_SHOW_IF_REGISTERED,
421 TRUE,
422 TRUE,
423 TRUE,
424 N_( "Show if registered" ),
425 /* i18n: ShowIfRegistered is a keyword of the specification, it is not translatable */
426 N_( "The well-known name of a DBus service.\n" \
427 "The item will be candidate if the named service is registered on session DBus at runtime.\n" \
428 "Parameters may appear in 'ShowIfRegistered' value, and will be substituted at runtime.\n" \
429 "Defaults to successful." ),
430 NAFD_TYPE_STRING,
431 NULL,
432 FALSE,
433 TRUE,
434 TRUE,
435 FALSE,
436 FALSE,
437 "show-if-registered",
438 "ShowIfRegistered",
440 NULL,
442 G_OPTION_ARG_NONE,
443 NULL,
444 NULL },
446 { NAFO_DATA_SHOW_IF_TRUE,
447 TRUE,
448 TRUE,
449 TRUE,
450 N_( "Show if True" ),
451 /* i18n: ShowIfTrue is a keyword of the specification, it is not translatable */
452 N_( "A command which, when executed, should output a string on stdout.\n" \
453 "The item will be candidate if the outputed string is equal to \"true\".\n" \
454 "Parameters may appear in 'ShowIfTrue' value, and will be substituted at runtime.\n" \
455 "Defaults to successful." ),
456 NAFD_TYPE_STRING,
457 NULL,
458 FALSE,
459 TRUE,
460 TRUE,
461 FALSE,
462 FALSE,
463 "show-if-true",
464 "ShowIfTrue",
466 NULL,
468 G_OPTION_ARG_NONE,
469 NULL,
470 NULL },
472 { NAFO_DATA_SHOW_IF_RUNNING,
473 TRUE,
474 TRUE,
475 TRUE,
476 N_( "Show if running" ),
477 /* i18n: ShowIfRunning is a keyword of the specification, it is not translatable */
478 N_( "The name of a process.\n" \
479 "The item will be candidate if the process name is found in memory at runtime.\n" \
480 "Parameters may appear in 'ShowIfRunning' value, and will be substituted at runtime.\n" \
481 "Defaults to successful." ),
482 NAFD_TYPE_STRING,
483 NULL,
484 FALSE,
485 TRUE,
486 TRUE,
487 FALSE,
488 FALSE,
489 "show-if-running",
490 "ShowIfRunning",
492 NULL,
494 G_OPTION_ARG_NONE,
495 NULL,
496 NULL },
498 { NAFO_DATA_CAPABILITITES,
499 TRUE,
500 TRUE,
501 TRUE,
502 N_( "Capabilities" ),
503 /* i18n: 'Owner', 'Readable', 'Writable', 'Executable' and 'Local' are all keywords
504 * of the specification, they are not translatable */
505 N_( "A list of capabilities each item of the selection must satisfy in order the item be candidate.\n" \
506 "Capabilities may be negated.\n" \
507 "Capabilities have to be choosen between following predefined ones:\n" \
508 "- 'Owner': current user is the owner of selected items\n" \
509 "- 'Readable': selected items are readable by user (probably more usefull when negated)\n" \
510 "- 'Writable': selected items are writable by user\n" \
511 "- 'Executable': selected items are executable by user\n" \
512 "- 'Local': selected items are local.\n" \
513 "Defaults to empty list." ),
514 NAFD_TYPE_STRING_LIST,
515 NULL,
516 FALSE,
517 TRUE,
518 TRUE,
519 FALSE,
520 FALSE,
521 "capabilities",
522 "Capabilities",
524 NULL,
526 G_OPTION_ARG_NONE,
527 NULL,
528 NULL },
530 { NULL },