Update copyright message
[nautilus-actions.git] / src / core / na-object-item-factory.c
blob8fadb88f68ca8589cdb3ecf11105fb9f196fae7b
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_item [] = {
43 /* this data is marked as non readable as it has to be readen specifically
44 * in order to be able to create the corresponding NAObjectItem-derived
45 * object
46 * it is not writable as different I/O providers may have different values
47 * for it, and thus it must be written specifically
48 * (cf. nagp_writer_write_start(), nadp_writer_write_start())
49 * it is not instantiated because we never need to have an actual value
50 * (actually being determined at runtime by object class)
51 * it is just left here to be able to define the corresponding GConf schema
52 * and to export it as XML
54 { NAFO_DATA_TYPE,
55 FALSE,
56 FALSE,
57 FALSE,
58 N_( "Type of the item" ),
59 N_( "Defines if the item is an action or a menu. Possible values are :\n" \
60 "- 'Action',\n" \
61 "- 'Menu'.\n" \
62 "The value is case sensitive and must not be localized." ),
63 NAFD_TYPE_STRING,
64 NULL,
65 FALSE,
66 FALSE,
67 FALSE,
68 FALSE,
69 FALSE,
70 "type",
71 NULL,
73 NULL,
76 NULL,
77 NULL },
79 /* this data is common between actions and menus
80 * so default value is directly set in na_object_action_new_with_defaults()
81 * and na_object_menu_new_with_defaults()
83 { NAFO_DATA_LABEL,
84 TRUE,
85 TRUE,
86 TRUE,
87 N_( "Label of the context menu item (mandatory)" ),
88 N_( "The label of the menu item that will appear in the file manager context " \
89 "menu when the selection matches the appearance condition settings.\n" \
90 "It is also used as a default for the toolbar label of an action." ),
91 NAFD_TYPE_LOCALE_STRING,
92 "",
93 FALSE,
94 TRUE,
95 TRUE,
96 FALSE,
97 TRUE,
98 "label",
99 "Name",
100 'l',
101 "label",
103 G_OPTION_ARG_STRING,
104 NULL,
105 N_( "<STRING>" ) },
107 { NAFO_DATA_TOOLTIP,
108 TRUE,
109 TRUE,
110 TRUE,
111 N_( "Tooltip of the context menu item" ),
112 N_( "The tooltip of the menu item that will appear in the file manager " \
113 "statusbar when the user points to the file manager context menu item " \
114 "with his/her mouse." ),
115 NAFD_TYPE_LOCALE_STRING,
117 FALSE,
118 TRUE,
119 TRUE,
120 FALSE,
121 TRUE,
122 "tooltip",
123 "Tooltip",
124 't',
125 "tooltip",
127 G_OPTION_ARG_STRING,
128 NULL,
129 N_( "<STRING>" ) },
131 { NAFO_DATA_ICON,
132 TRUE,
133 TRUE,
134 TRUE,
135 N_( "Icon of the context menu item" ),
136 N_( "The icon of the menu item that will appear next to the label " \
137 "in the file manager context menu when the selection matches the appearance " \
138 "conditions settings.\n" \
139 "May be the localized name of a themed icon, or a full path to any appropriate image." ),
140 NAFD_TYPE_LOCALE_STRING,
142 FALSE,
143 TRUE,
144 TRUE,
145 FALSE,
146 TRUE,
147 "icon",
148 "Icon",
149 'i',
150 "icon",
152 G_OPTION_ARG_STRING,
153 NULL,
154 N_( "<PATH|NAME>" ) },
156 /* icon used to be not localized up to and included 2.29.4
158 { NAFO_DATA_ICON_NOLOC,
159 TRUE,
160 FALSE,
161 FALSE,
162 "Unlocalized icon name or path",
163 NULL,
164 NAFD_TYPE_STRING,
166 FALSE,
167 FALSE,
168 FALSE,
169 FALSE,
170 FALSE,
171 "icon",
172 NULL,
174 "icon",
177 NULL,
178 NULL },
180 { NAFO_DATA_DESCRIPTION,
181 TRUE,
182 TRUE,
183 TRUE,
184 N_( "Description relative to the item" ),
185 N_( "Some text which explains the goal of the menu or the action.\n" \
186 "May be used, e.g. when displaying available items on a web site." ),
187 NAFD_TYPE_LOCALE_STRING,
189 FALSE,
190 TRUE,
191 TRUE,
192 FALSE,
193 TRUE,
194 "description",
195 "Description",
197 NULL,
200 NULL,
201 NULL },
203 { NAFO_DATA_SHORTCUT,
204 TRUE,
205 TRUE,
206 TRUE,
207 N_( "Suggested shortcut" ),
208 N_( "A shortcut suggested for the action or the menu.\n" \
209 "Please note that this might be only a suggestion as the shortcut may " \
210 "be already reserved for another use. Implementation should not override " \
211 "an already existing shortcut to define this one.\n" \
212 "The format may look like \"<Control>a\" or \"<Shift><Alt>F1\".\n" \
213 "Defaults to empty." ),
214 NAFD_TYPE_STRING,
216 FALSE,
217 TRUE,
218 TRUE,
219 FALSE,
220 FALSE,
221 "shortcut",
222 "SuggestedShortcut",
224 NULL,
227 NULL,
228 NULL },
230 /* dynamic data, so not readable / not writable
232 { NAFO_DATA_SUBITEMS,
233 FALSE, /* not serializable */
234 FALSE,
235 TRUE,
236 "Subitems",
237 "List of subitems objects",
238 NAFD_TYPE_POINTER,
239 NULL,
240 FALSE,
241 FALSE, /* not copyable */
242 FALSE, /* not comparable */
243 FALSE, /* not mandatory */
244 FALSE, /* not localized */
245 NULL,
246 NULL,
248 NULL,
251 NULL,
252 NULL },
254 /* list of subitems as a string list
255 * dynamically rebuilt on write_start()
257 { NAFO_DATA_SUBITEMS_SLIST,
258 TRUE,
259 TRUE,
260 TRUE,
261 N_( "List of subitem ids" ),
262 N_( "Ordered list of the IDs of the subitems. This may be actions or menus " \
263 "if the item is a menu, or profiles if the item is an action.\n" \
264 "If this list doesn't exist or is empty for an action or a menu, " \
265 "subitems are attached in the order of the read operations." ),
266 NAFD_TYPE_STRING_LIST,
267 NULL,
268 FALSE,
269 FALSE,
270 FALSE,
271 FALSE,
272 FALSE,
273 "items",
274 NULL, /* Profiles or ItemsList */
276 NULL,
279 NULL,
280 NULL },
282 { NAFO_DATA_ENABLED,
283 TRUE,
284 TRUE,
285 TRUE,
286 N_( "Whether the action or the menu is enabled (default)" ),
287 N_( "If the or the menu action is disabled, it will never appear in the " \
288 "file manager context menu.\n" \
289 "Defaults to TRUE." ),
290 NAFD_TYPE_BOOLEAN,
291 "true",
292 FALSE,
293 TRUE,
294 TRUE,
295 FALSE,
296 FALSE,
297 "enabled",
298 "Enabled",
299 'e',
300 "enabled",
302 G_OPTION_ARG_NONE,
303 NULL,
304 NULL },
306 /* dynamic data, so non readable / non writable
307 * must be set by the NAIIOProvider when reading the item
309 { NAFO_DATA_READONLY,
310 FALSE,
311 FALSE,
312 TRUE,
313 "Read-only",
314 "Is the item only readable ? " \
315 "This is an intrinsic property, dynamically set when the item is unserialized. " \
316 "This property being FALSE doesn't mean that the item will actually be updatable, " \
317 "as this also depend of parameters set by user and administrator. " \
318 "Also, a property initially set to FALSE when first unserializing may be set to" \
319 "TRUE if an eccor occurs on a later write operation.",
320 NAFD_TYPE_BOOLEAN,
321 "false",
322 FALSE,
323 TRUE,
324 FALSE,
325 FALSE,
326 FALSE,
327 NULL,
328 NULL,
330 NULL,
333 NULL,
334 NULL },
336 /* dynamic data, so non readable / non writable
338 { NAFO_DATA_PROVIDER,
339 FALSE,
340 FALSE,
341 TRUE,
342 "I/O provider",
343 "A pointer to the NAIOProvider object.",
344 NAFD_TYPE_POINTER,
345 NULL,
346 FALSE,
347 TRUE,
348 FALSE,
349 FALSE,
350 FALSE,
351 NULL,
352 NULL,
354 NULL,
357 NULL,
358 NULL },
360 /* dynamic data, so non readable / non writable (but has property)
361 * is left at the NAIIOProvider disposition
362 * not copyable as directly duplicated by NAIIOProvider interface
363 * (see NAObjectItem::object_copy)
365 { NAFO_DATA_PROVIDER_DATA,
366 FALSE,
367 FALSE,
368 TRUE,
369 "I/O provider data",
370 "A pointer to some NAIOProvider specific data.",
371 NAFD_TYPE_POINTER,
372 NULL,
373 FALSE,
374 FALSE,
375 FALSE,
376 FALSE,
377 FALSE,
378 NULL,
379 NULL,
381 NULL,
384 NULL,
385 NULL },
387 /* this integer version number is introduced with .desktop files and obsoletes
388 * the previous string version number which was only set on actions
389 * we so have: "1.0" < "1.1" < "2.0" < 3
390 * Also note that iversion=3 is only written in GConf, while .desktop files
391 * do not have this key.
392 * Only when version will need to be incremented again, we will write a version
393 * key in .desktop files (probably 1 or 2), and increment this iversion to 4.
394 * As this version number will not be the same in .desktop and in GConf, it
395 * is marked as not automatically writable: it has to be written specifically
396 * by each i/o provider.
398 { NAFO_DATA_IVERSION,
399 TRUE,
400 FALSE,
401 TRUE,
402 N_( "Version of the format" ),
403 N_( "The version of the configuration format that will be used to manage backward compatibility." ),
404 NAFD_TYPE_UINT,
405 "3",
406 FALSE,
407 TRUE,
408 TRUE,
409 FALSE,
410 FALSE,
411 "iversion",
412 NULL,
414 NULL,
417 NULL,
418 NULL },
420 { NULL },