README: add deprecation notice
[nautilus-actions.git] / src / core / fma-factory-provider.c
blobd4c06045094973d00995feae4e6ce507b22fe76d
1 /*
2 * FileManager-Actions
3 * A file-manager extension which offers configurable context menu actions.
5 * Copyright (C) 2005 The GNOME Foundation
6 * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
7 * Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
9 * FileManager-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.
14 * FileManager-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.
19 * You should have received a copy of the GNU General Public License
20 * along with FileManager-Actions; see the file COPYING. If not, see
21 * <http://www.gnu.org/licenses/>.
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)
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
34 #include <api/fma-iio-provider.h>
36 #include "fma-factory-provider.h"
39 * fma_factory_provider_read_data:
40 * @reader: the instance which implements this #FMAIFactoryProvider interface.
41 * @reader_data: instance data.
42 * @object: the #NAIFactoryobject being unserialized.
43 * @def: a #FMADataDef structure which identifies the data to be unserialized.
44 * @messages: a pointer to a #GSList list of strings; the implementation
45 * may append messages to this list, but shouldn't reinitialize it.
47 * Reads the specified data and set it up into the @boxed.
49 * Returns: a new #FMADataBoxed object which contains the data.
51 FMADataBoxed *
52 fma_factory_provider_read_data( const FMAIFactoryProvider *reader, void *reader_data,
53 const FMAIFactoryObject *object, const FMADataDef *def,
54 GSList **messages )
56 FMADataBoxed *boxed;
58 g_return_val_if_fail( FMA_IS_IFACTORY_PROVIDER( reader ), NULL );
59 g_return_val_if_fail( FMA_IS_IFACTORY_OBJECT( object ), NULL );
61 boxed = NULL;
63 if( FMA_IFACTORY_PROVIDER_GET_INTERFACE( reader )->read_data ){
64 boxed = FMA_IFACTORY_PROVIDER_GET_INTERFACE( reader )->read_data( reader, reader_data, object, def, messages );
67 return( boxed );
71 * fma_factory_provider_write_data:
72 * @writer: the instance which implements this #FMAIFactoryProvider interface.
73 * @writer_data: instance data.
74 * @object: the #NAIFactoryobject being serialized.
75 * @boxed: the #FMADataBoxed object which is to be serialized.
76 * @messages: a pointer to a #GSList list of strings; the implementation
77 * may append messages to this list, but shouldn't reinitialize it.
79 * Returns: a FMAIIOProvider operation return code.
81 guint
82 fma_factory_provider_write_data( const FMAIFactoryProvider *writer, void *writer_data,
83 const FMAIFactoryObject *object, const FMADataBoxed *boxed,
84 GSList **messages )
86 guint code;
88 g_return_val_if_fail( FMA_IS_IFACTORY_PROVIDER( writer ), IIO_PROVIDER_CODE_PROGRAM_ERROR );
89 g_return_val_if_fail( FMA_IS_IFACTORY_OBJECT( object ), IIO_PROVIDER_CODE_PROGRAM_ERROR );
91 code = IIO_PROVIDER_CODE_NOT_WILLING_TO_RUN;
93 if( FMA_IFACTORY_PROVIDER_GET_INTERFACE( writer )->write_data ){
94 code = FMA_IFACTORY_PROVIDER_GET_INTERFACE( writer )->write_data( writer, writer_data, object, boxed, messages );
97 return( code );