File: fma-object-profile-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 (319 lines) | stat: -rw-r--r-- 8,853 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
/*
 * 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>

extern FMADataDef data_def_id [];			/* defined in fma-object-id-factory.c */
extern FMADataDef data_def_conditions [];	/* defined in fma-icontext-factory.c */

static FMADataDef data_def_profile [] = {

	{ FMAFO_DATA_DESCNAME,
				TRUE,
				TRUE,
				TRUE,
				N_( "Name of the profile" ),
				N_( "May be used as a description for the function of the profile.\n" \
					"If not set, it defaults to an auto-generated name." ),
				FMA_DATA_TYPE_LOCALE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				TRUE,
				"desc-name",
				"Name",
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	/* label of the profile was unlocalized up to and included 1.11.0
	 */
	{ FMAFO_DATA_DESCNAME_NOLOC,
				TRUE,
				FALSE,
				FALSE,
				"Unlocalized name of the profile",
				NULL,
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				FALSE,
				FALSE,
				FALSE,
				FALSE,
				"desc-name",
				NULL,
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	/* Path and Parameters are two separate data both in GConf, in GConf-derived
	 * export files and in fma-config-tool user interface. Only in desktop files,
	 * they are merged as only one 'Exec' data which is splitted at read time.
	 */
	{ FMAFO_DATA_PATH,
				TRUE,
				TRUE,
				TRUE,
				N_( "Path of the command" ),
				N_( "The path of the command to be executed when the user select the menu item " \
					"in the file manager context menu or in the toolbar." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				TRUE,
				FALSE,
				"path",
				"Exec",
				'x',
				"command",
				0,
				G_OPTION_ARG_FILENAME,
				NULL,
				N_( "<PATH>" ) },

	/* Desktop files not only introduced new properties conditions to item and profiles,
	 * but also slightly changed the meaning of some parameters. This is synchronized
	 * with the change of version data (from "2.0" string to '1' integer)
	 */
	{ FMAFO_DATA_PARAMETERS,
				TRUE,
				TRUE,
				TRUE,
				N_( "Parameters of the command" ),
										/* too long string for iso c: (max=509) */
				N_( "The parameters of the command to be executed when the user selects the menu " \
					"item in the file manager context menu or in the toolbar.\n" \
					"The parameters may contain some special tokens which are replaced by the " \
					"information provided by the file manager before starting the command:\n" \
					"- up to version 2.0:\n" \
					"  %d: base folder of the selected file(s)\n" \
					"  %f: the name of the selected file or the first one if several are selected\n" \
					"  %h: hostname of the URI\n" \
					"  %m: space-separated list of the basenames of the selected file(s)/folder(s)\n" \
					"  %M: space-separated list of the selected file(s)/folder(s), with their full paths\n" \
					"  %p: port number of the first URI\n" \
					"  %R: space-separated list of selected URIs\n" \
					"  %s: scheme of the URI\n" \
					"  %u: URI\n" \
					"  %U: username of the URI\n" \
					"  %%: a percent sign.\n" \
					"- starting from version 3:\n" \
					"  %b: (first) basename\n" \
					"  %B: space-separated list of the basenames of the selected file(s)/folder(s)\n" \
					"  %c: count the selected file(s)/folder(s)\n" \
					"  %d: (first) base directory\n" \
					"  %D: space-separated list of base directories of the selected file(s)/folder(s)\n" \
					"  %f: (first) filename\n" \
					"  %F: space-separated list of the filenames of the selected file(s)/folder(s)\n" \
					"  %h: hostname of the (first) URI\n" \
					"  %m: (first) mimetype\n" \
					"  %M: space-separated list of the mimetypes of the selected file(s)/folder(s)\n" \
					"  %n: username of the (first) URI\n" \
					"  %o: no-op operator which forces the singular form of execution (since 3.0.2)\n" \
					"  %O: no-op operator which forces the plural form of execution (since 3.0.2)\n" \
					"  %p: port number of the (first) URI\n" \
					"  %s: scheme of the (first) URI\n" \
					"  %u: (first) URI\n" \
					"  %U: space-separated list of the URIs of the selected file(s)/folder(s)\n" \
					"  %w: (first) basename without the extension\n" \
					"  %W: space-separated list of basenames without the extension\n" \
					"  %x: (first) extension\n" \
					"  %X: space-separated list of the extensions of the selected file(s)/folder(s)\n" \
					"  %%: a percent sign." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"parameters",
				NULL,
				'p',
				"parameters",
				0,
				G_OPTION_ARG_STRING,
				NULL,
				N_( "<STRING>" ) },

	{ FMAFO_DATA_WORKING_DIR,
				TRUE,
				TRUE,
				TRUE,
				N_( "Working directory" ),
				N_( "The working directory the command will be started in.\n" \
					"Defaults to \"%d\"." ),
				FMA_DATA_TYPE_STRING,
				"%d",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"working-dir",
				"Path",
				'w',
				"working-dir",
				0,
				G_OPTION_ARG_FILENAME,
				NULL,
				N_( "<PATH>" ) },

	{ FMAFO_DATA_EXECUTION_MODE,
				TRUE,
				TRUE,
				TRUE,
				N_( "Execution mode" ),
				/* i18n: 'Normal', 'Terminal', 'Embedded' and 'DisplayOutput' are non-translatable keywords */
				N_( "Execution mode of the program.\n" \
					"This may be chosen between following values:\n" \
					"- Normal: starts as a standard graphical user interface\n" \
					"- Terminal: starts the preferred terminal of the graphical environment, " \
						"and runs the command in it\n" \
					"- Embedded: makes use of a special feature of the file manager which allows " \
						"a terminal to be ran inside of it; an acceptable fallback is Terminal\n" \
					"- DisplayOutput: the ran terminal may be closed at end of the command, but " \
						"standard streams (stdout, stderr) should be collected and displayed; " \
						"an acceptable fallback is Terminal.\n" \
					"Defaults to \"Normal\"." ),
				FMA_DATA_TYPE_STRING,
				"Normal",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"execution-mode",
				"ExecutionMode",
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	{ FMAFO_DATA_STARTUP_NOTIFY,
				TRUE,
				TRUE,
				TRUE,
				N_( "Startup notify" ),
				N_( "Only relevant when ExecutionMode=Normal.\n" \
					"Defaults to FALSE." ),
				FMA_DATA_TYPE_BOOLEAN,
				"false",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"startup-notify",
				"StartupNotify",
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	{ FMAFO_DATA_STARTUP_WMCLASS,
				TRUE,
				TRUE,
				TRUE,
				N_( "Startup WM Class" ),
				N_( "Only relevant when ExecutionMode=Normal.\n" \
					"Defaults to empty." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"startup-wmclass",
				"StartupWMClass",
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	{ FMAFO_DATA_EXECUTE_AS,
				TRUE,
				TRUE,
				TRUE,
				N_( "Execute as user" ),
				N_( "The user the command must be ran as. " \
					"The user may be identified by its numeric UID or by its login.\n" \
					"The profile is ignored if defined with a non-existing UID or login.\n" \
					"Defaults to empty: the command will be executed as the current user." ),
				FMA_DATA_TYPE_STRING,
				"",
				FALSE,
				TRUE,
				TRUE,
				FALSE,
				FALSE,
				"execute-as",
				"ExecuteAs",
				0,
				NULL,
				0,
				0,
				NULL,
				NULL },

	{ NULL },
};

FMADataGroup profile_data_groups [] = {
	{ FMA_FACTORY_OBJECT_ID_GROUP,         data_def_id },
	{ FMA_FACTORY_OBJECT_PROFILE_GROUP,    data_def_profile },
	{ FMA_FACTORY_OBJECT_CONDITIONS_GROUP, data_def_conditions },
	{ NULL }
};