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.
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 #ifndef __NAUTILUS_ACTIONS_API_NA_IFACTORY_OBJECT_H__
32 #define __NAUTILUS_ACTIONS_API_NA_IFACTORY_OBJECT_H__
35 * SECTION: ifactory-object
36 * @title: NAIFactoryObject
37 * @short_description: The #NAObjectItem Interface v 1
38 * @include: nautilus-actions/na-ifactory_object.h
40 * This interface is implemented by #NAObjectItem derived objects so that they
41 * can take advantage of our data factory management system.
43 * A #NAObjectItem derived object which would implement this #NAIFactoryObject
44 * interface must meet following conditions:
48 * accept an empty constructor
54 * <title>Versions historic</title>
56 * <title>Historic of the versions of the #NAIFactoryObject interface</title>
57 * <tgroup rowsep="1" colsep="1" align="center" cols="3">
58 * <colspec colname="na-version" />
59 * <colspec colname="api-version" />
60 * <colspec colname="current" />
63 * <entry>&prodname; version</entry>
64 * <entry>#NAIFactoryObject interface version</entry>
70 * <entry>since 2.30</entry>
72 * <entry>current version</entry>
80 #include "na-data-def.h"
81 #include "na-data-boxed.h"
82 #include "na-ifactory-provider-provider.h"
86 #define NA_IFACTORY_OBJECT_TYPE ( na_ifactory_object_get_type())
87 #define NA_IFACTORY_OBJECT( instance ) ( G_TYPE_CHECK_INSTANCE_CAST( instance, NA_IFACTORY_OBJECT_TYPE, NAIFactoryObject ))
88 #define NA_IS_IFACTORY_OBJECT( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NA_IFACTORY_OBJECT_TYPE ))
89 #define NA_IFACTORY_OBJECT_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_IFACTORY_OBJECT_TYPE, NAIFactoryObjectInterface ))
91 typedef struct _NAIFactoryObject NAIFactoryObject
;
92 typedef struct _NAIFactoryObjectInterfacePrivate NAIFactoryObjectInterfacePrivate
;
95 * NAIFactoryObjectInterface:
96 * @get_version: returns the version of this interface the NAObjectItem implements.
97 * @get_groups: returns a pointer to the NADataGroup which defines this object.
98 * @copy: post copy callback.
99 * @are_equal: tests if two NAObjectItem are equals.
100 * @is_valid: tests if one NAObjectItem is valid.
101 * @read_start: triggered before serializing a NAObjectItem.
102 * @read_done: triggered after a NAObjectItem has been serialized.
103 * @write_start: triggered before unserializing a NAObjectItem.
104 * @write_done: triggered after a NAObjectItem has been unserialized.
106 * In order to take full advantage of our data managament system,
107 * NAObjectItem-derived objects all implement this #NAIFactoryObject
112 GTypeInterface parent
;
113 NAIFactoryObjectInterfacePrivate
*private;
118 * @instance: this #NAIFactoryObject instance.
122 * Returns: the version of this interface supported by @instance implementation.
126 guint ( *get_version
)( const NAIFactoryObject
*instance
);
130 * @instance: this #NAIFactoryObject instance.
132 * Returns: a pointer to the NADataGroup which defines this object.
136 NADataGroup
* ( *get_groups
) ( const NAIFactoryObject
*instance
);
140 * @instance: the target #NAIFactoryObject instance.
141 * @source: the source #NAIFactoryObject instance.
143 * This function is triggered after having copied @source to
144 * @instance target. This later may take advantage of this call
145 * to do some particular copy tasks.
149 void ( *copy
) ( NAIFactoryObject
*instance
, const NAIFactoryObject
*source
);
153 * @a: the first #NAIFactoryObject instance.
154 * @b: the second #NAIFactoryObject instance.
156 * This function is triggered after all elementary data comparisons
157 * have been sucessfully made.
159 * Returns: %TRUE if @a is equal to @b.
163 gboolean ( *are_equal
) ( const NAIFactoryObject
*a
, const NAIFactoryObject
*b
);
167 * @object: the #NAIFactoryObject instance whose validity is to be checked.
169 * This function is triggered after all elementary data comparisons
170 * have been sucessfully made.
172 * Returns: %TRUE if @object is valid.
176 gboolean ( *is_valid
) ( const NAIFactoryObject
*object
);
180 * @instance: this #NAIFactoryObject instance.
181 * @reader: the instance which has provided read services.
182 * @reader_data: the data associated to @reader.
183 * @messages: a pointer to a #GSList list of strings; the instance
184 * may append messages to this list, but shouldn't reinitialize it.
186 * Called just before the object is unserialized.
190 void ( *read_start
) ( NAIFactoryObject
*instance
, const NAIFactoryProvider
*reader
, void *reader_data
, GSList
**messages
);
194 * @instance: this #NAIFactoryObject instance.
195 * @reader: the instance which has provided read services.
196 * @reader_data: the data associated to @reader.
197 * @messages: a pointer to a #GSList list of strings; the instance
198 * may append messages to this list, but shouldn't reinitialize it.
200 * Called when the object has been unserialized.
204 void ( *read_done
) ( NAIFactoryObject
*instance
, const NAIFactoryProvider
*reader
, void *reader_data
, GSList
**messages
);
208 * @instance: this #NAIFactoryObject instance.
209 * @writer: the instance which has provided writing services.
210 * @writer_data: the data associated to @writer.
211 * @messages: a pointer to a #GSList list of strings; the instance
212 * may append messages to this list, but shouldn't reinitialize it.
214 * Called just before the object is serialized.
216 * Returns: a NAIIOProvider operation return code.
220 guint ( *write_start
)( NAIFactoryObject
*instance
, const NAIFactoryProvider
*writer
, void *writer_data
, GSList
**messages
);
224 * @instance: this #NAIFactoryObject instance.
225 * @writer: the instance which has provided writing services.
226 * @writer_data: the data associated to @writer.
227 * @messages: a pointer to a #GSList list of strings; the instance
228 * may append messages to this list, but shouldn't reinitialize it.
230 * Called when the object has been serialized.
232 * Returns: a NAIIOProvider operation return code.
236 guint ( *write_done
) ( NAIFactoryObject
*instance
, const NAIFactoryProvider
*writer
, void *writer_data
, GSList
**messages
);
238 NAIFactoryObjectInterface
;
240 GType
na_ifactory_object_get_type( void );
242 NADataBoxed
*na_ifactory_object_get_data_boxed ( const NAIFactoryObject
*object
, const gchar
*name
);
243 NADataGroup
*na_ifactory_object_get_data_groups( const NAIFactoryObject
*object
);
244 void *na_ifactory_object_get_as_void ( const NAIFactoryObject
*object
, const gchar
*name
);
245 void na_ifactory_object_set_from_void ( NAIFactoryObject
*object
, const gchar
*name
, const void *data
);
249 #endif /* __NAUTILUS_ACTIONS_API_NA_IFACTORY_OBJECT_H__ */