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 __CORE_NA_IO_PROVIDER_H__
31 #define __CORE_NA_IO_PROVIDER_H__
32 
33 /* @title: NAIOProvider
34  * @short_description: The NAIOProvider Class Definition
35  * @include: core/na-io-provider.h
36  *
37  * #NAIOProvider is the Nautilus-Actions class which is used to manage
38  * external I/O Providers which implement #NAIIOProvider interface. Each
39  * #NAIOProvider objects may (or not) encapsulates one #NAIIOProvider
40  * provider.
41  *
42  * Internal Nautilus-Actions code should never directly call a
43  * #NAIIOProvider interface method, but rather should call the
44  * corresponding NAIOProvider class method.
45  *
46  * Two preferences are used for each i/o provider:
47  * 'readable': means that the i/o provider should be read when building
48  *  the items hierarchy
49  * 'writable': means that the i/o provider is candidate when writing a
50  *  new item; this also means that existing items are deletable.
51  *
52  * To be actually writable, a i/o provider must:
53  * - be set as 'writable' from a configuration point of view
54  *   this may or not be edited depending of this is a mandatory or user
55  *   preference
56  * - be willing to write: this is an intrisinc i/o provider attribute
57  * - be able to write: this is a runtime i/o provider property
58  *
59  * and the whole configuration must not have been locked by an admin.
60  */
61 
62 #include "na-pivot.h"
63 
64 G_BEGIN_DECLS
65 
66 #define NA_IO_PROVIDER_TYPE                ( na_io_provider_get_type())
67 #define NA_IO_PROVIDER( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_IO_PROVIDER_TYPE, NAIOProvider ))
68 #define NA_IO_PROVIDER_CLASS( klass )      ( G_TYPE_CHECK_CLASS_CAST( klass, NA_IO_PROVIDER_TYPE, NAIOProviderClass ))
69 #define NA_IS_IO_PROVIDER( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_IO_PROVIDER_TYPE ))
70 #define NA_IS_IO_PROVIDER_CLASS( klass )   ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_IO_PROVIDER_TYPE ))
71 #define NA_IO_PROVIDER_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_IO_PROVIDER_TYPE, NAIOProviderClass ))
72 
73 typedef struct _NAIOProviderPrivate        NAIOProviderPrivate;
74 
75 typedef struct {
76 	/*< private >*/
77 	GObject              parent;
78 	NAIOProviderPrivate *private;
79 }
80 	NAIOProvider;
81 
82 typedef struct _NAIOProviderClassPrivate   NAIOProviderClassPrivate;
83 
84 typedef struct {
85 	/*< private >*/
86 	GObjectClass              parent;
87 	NAIOProviderClassPrivate *private;
88 }
89 	NAIOProviderClass;
90 
91 /* signal sent from a NAIIOProvider
92  * via the na_iio_provider_item_changed() function
93  */
94 #define IO_PROVIDER_SIGNAL_ITEM_CHANGED		"io-provider-item-changed"
95 
96 GType         na_io_provider_get_type ( void );
97 
98 NAIOProvider *na_io_provider_find_writable_io_provider( const NAPivot *pivot );
99 NAIOProvider *na_io_provider_find_io_provider_by_id   ( const NAPivot *pivot, const gchar *id );
100 const GList  *na_io_provider_get_io_providers_list    ( const NAPivot *pivot );
101 void          na_io_provider_unref_io_providers_list  ( void );
102 
103 gchar        *na_io_provider_get_id             ( const NAIOProvider *provider );
104 gchar        *na_io_provider_get_name           ( const NAIOProvider *provider );
105 gboolean      na_io_provider_is_available       ( const NAIOProvider *provider );
106 gboolean      na_io_provider_is_conf_readable   ( const NAIOProvider *provider, const NAPivot *pivot, gboolean *mandatory );
107 gboolean      na_io_provider_is_conf_writable   ( const NAIOProvider *provider, const NAPivot *pivot, gboolean *mandatory );
108 gboolean      na_io_provider_is_finally_writable( const NAIOProvider *provider, guint *reason );
109 
110 GList        *na_io_provider_load_items( const NAPivot *pivot, guint loadable_set, GSList **messages );
111 
112 guint         na_io_provider_write_item    ( const NAIOProvider *provider, const NAObjectItem *item, GSList **messages );
113 guint         na_io_provider_delete_item   ( const NAIOProvider *provider, const NAObjectItem *item, GSList **messages );
114 guint         na_io_provider_duplicate_data( const NAIOProvider *provider, NAObjectItem *dest, const NAObjectItem *source, GSList **messages );
115 
116 gchar        *na_io_provider_get_readonly_tooltip ( guint reason );
117 gchar        *na_io_provider_get_return_code_label( guint code );
118 
119 G_END_DECLS
120 
121 #endif /* __CORE_NA_IO_PROVIDER_H__ */
122