1 /*
2  * Nautilus-Actions
3  * A Nautilus extension which offers configurable context menu actions.
4  *
5  * Copyright (C) 2005 The GNOME Foundation
6  * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
7  * Copyright (C) 2009-2014 Pierre Wieser and others (see AUTHORS)
8  *
9  * Nautilus-Actions 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.
13  *
14  * Nautilus-Actions 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 GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Nautilus-Actions; see the file COPYING. If not, see
21  * <http://www.gnu.org/licenses/>.
22  *
23  * Authors:
24  *   Frederic Ruaudel <grumz@grumz.net>
25  *   Rodrigo Moya <rodrigo@gnome-db.org>
26  *   Pierre Wieser <pwieser@trychlos.org>
27  *   ... and many others (see AUTHORS)
28  */
29 
30 #ifndef __NAUTILUS_ACTIONS_API_NA_FACTORY_DATA_DEF_H__
31 #define __NAUTILUS_ACTIONS_API_NA_FACTORY_DATA_DEF_H__
32 
33 /**
34  * SECTION: data-def
35  * @title: NADataDef, NADataGroup
36  * @short_description: The Data Factory Structure Definitions
37  * @include: nautilus-actions/na-data-def.h
38  *
39  * #NADataDef and #NADataGroup are structures which handle the list of
40  * elementary datas for each and every #NAObjectItem which happens to
41  * implement the #NAIFactoryObject interface.
42  */
43 
44 #include <glib.h>
45 
46 G_BEGIN_DECLS
47 
48 /**
49  * NADataDef:
50  * @name:             both the id and the canonical name.
51  *                    Used when getting/setting properties.
52  *                    Is defined in na-ifactory-object-data.h and must be globally unique.
53  *                    Must be an invariant as it is known from plugin extensions.
54  * @readable:         whether the data should be read on unserialization operations.
55  *                    If FALSE, then no attempt will be made to read it
56  *                    and the data will have to be set dynamically.
57  *                    When a data has been written once (see below), and unless
58  *                    special cases (see e.g. type), it should remain readable
59  *                    even if it has becomen obsolete (for backward compatibility).
60  * @writable:         whether the data is to be written on serialization operations.
61  *                    If FALSE, then no attempt will be made to write it.
62  *                    Mainly set to FALSE for dynamically set variables and
63  *                    obsoleted ones.
64  * @has_property:     whether a property should be set for this variable ?
65  *                    Set to FALSE for obsolete variables.
66  * @short_label:      short localizable descriptive name.
67  *                    Used in GParamSpec and in schemas.
68  * @long_label:       long, if not complete, localizable description.
69  *                    Used in GParamSpec and in schemas?
70  * @type:             the elementary NA_DATA_TYPE_xxx data type.
71  * @default_value:    the default to assign when creating a new object.
72  *                    This default is also displayed in command-line help
73  *                    of nautilus-actions-new utility.
74  * @write_if_default: write this value even if it is the default value ?
75  *                    Should default to FALSE.
76  * @copyable:         whether this data should be automatically copied when
77  *                    we are duplicating an object to another ?
78  *                    In all cases, the implementation is always triggered
79  *                    by the copy() interface method.
80  * @comparable:       whether this data should be compared when we
81  *                    are testing two objects for equality.
82  * @mandatory:        whether this data must be not null and not empty
83  *                    when we are testing for validity of an object.
84  * @localizable:      whether this is a localizable data when serializing or exporting.
85  * @gconf_entry:      same entry is also used for GConf-based XML docs.
86  * @desktop_entry:    entry in .desktop files.
87  * @option_short:     the short version of a command-line parameter in nautilus-actions-new,
88  *                    or 0.
89  * @option_long:      the long version of the same command-line parameter in nautilus-actions-new,
90  *                    or NULL.
91  * @option_flags:     #GOptionFlags for the command-line parameter, or 0.
92  * @option_arg:       the type of the option, or 0.
93  * @option_label:     the localizable description for the variable in nautilus-actions-new.
94  *                    Defaults to @short_label if NULL.
95  * @option_arg_label: the localizable description for the argument.
96  *
97  * This structure fully describes an elementary factory data.
98  * Each #NAIFactoryObject item definition may include several groups of
99  * this structure.
100  */
101 typedef struct {
102 	gchar     *name;
103 	gboolean   readable;
104 	gboolean   writable;
105 	gboolean   has_property;
106 	gchar     *short_label;
107 	gchar     *long_label;
108 	guint      type;
109 	gchar     *default_value;
110 	gboolean   write_if_default;
111 	gboolean   copyable;
112 	gboolean   comparable;
113 	gboolean   mandatory;
114 	gboolean   localizable;
115 	gchar     *gconf_entry;
116 	gchar     *desktop_entry;
117 	gchar      option_short;
118 	gchar     *option_long;
119 	gint       option_flags;
120 	GOptionArg option_arg;
121 	gchar     *option_label;
122 	gchar     *option_arg_label;
123 }
124 	NADataDef;
125 
126 /**
127  * NADataGroup:
128  * @group: the name of the group, as defined in na-ifactory-object-data.h.
129  * @def: the list of the corresponding data structures.
130  *
131  * This structure fully describes a logical group of data.
132  * Each #NAIFactoryObject item definition is built from a list of
133  * these groups.
134  */
135 typedef struct {
136 	gchar     *group;
137 	NADataDef *def;
138 }
139 	NADataGroup;
140 
141 const NADataDef *na_data_def_get_data_def( const NADataGroup *group, const gchar *group_name, const gchar *name );
142 
143 G_END_DECLS
144 
145 #endif /* __NAUTILUS_ACTIONS_API_NA_FACTORY_DATA_DEF_H__ */
146