1 /*
2  *  caja-info-provider.h - Interface for Caja extensions that
3  *                             provide info about files.
4  *
5  *  Copyright (C) 2003 Novell, Inc.
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Library General Public
9  *  License as published by the Free Software Foundation; either
10  *  version 2 of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Library General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Library General Public
18  *  License along with this library; if not, write to the Free
19  *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  *  Author:  Dave Camp <dave@ximian.com>
22  *
23  */
24 
25 /* This interface is implemented by Caja extensions that want to
26  * provide information about files.  Extensions are called when Caja
27  * needs information about a file.  They are passed a CajaFileInfo
28  * object which should be filled with relevant information */
29 
30 #ifndef CAJA_INFO_PROVIDER_H
31 #define CAJA_INFO_PROVIDER_H
32 
33 #include <glib-object.h>
34 #include "caja-extension-types.h"
35 #include "caja-file-info.h"
36 
37 G_BEGIN_DECLS
38 
39 #define CAJA_TYPE_INFO_PROVIDER           (caja_info_provider_get_type ())
40 #define CAJA_INFO_PROVIDER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_INFO_PROVIDER, CajaInfoProvider))
41 #define CAJA_IS_INFO_PROVIDER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_INFO_PROVIDER))
42 #define CAJA_INFO_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_INFO_PROVIDER, CajaInfoProviderIface))
43 
44 typedef struct _CajaInfoProvider       CajaInfoProvider;
45 typedef struct _CajaInfoProviderIface  CajaInfoProviderIface;
46 
47 typedef void (*CajaInfoProviderUpdateComplete) (CajaInfoProvider    *provider,
48                                                 CajaOperationHandle *handle,
49                                                 CajaOperationResult  result,
50                                                 gpointer             user_data);
51 
52 /**
53  * CajaInfoProviderIface:
54  * @g_iface: The parent interface.
55  * @update_file_info: Returns a #CajaOperationResult.
56  *   See caja_info_provider_update_file_info() for details.
57  * @cancel_update: Cancels a previous call to caja_info_provider_update_file_info().
58  *   See caja_info_provider_cancel_update() for details.
59  *
60  * Interface for extensions to provide additional information about files.
61  */
62 
63 struct _CajaInfoProviderIface {
64     GTypeInterface g_iface;
65 
66     CajaOperationResult (*update_file_info) (CajaInfoProvider     *provider,
67                                              CajaFileInfo         *file,
68                                              GClosure             *update_complete,
69                                              CajaOperationHandle **handle);
70     void                (*cancel_update)    (CajaInfoProvider     *provider,
71                                              CajaOperationHandle  *handle);
72 };
73 
74 /* Interface Functions */
75 GType               caja_info_provider_get_type               (void);
76 CajaOperationResult caja_info_provider_update_file_info       (CajaInfoProvider     *provider,
77                                                                CajaFileInfo         *file,
78                                                                GClosure             *update_complete,
79                                                                CajaOperationHandle **handle);
80 void                caja_info_provider_cancel_update          (CajaInfoProvider     *provider,
81                                                                CajaOperationHandle  *handle);
82 
83 
84 
85 /* Helper functions for implementations */
86 void                caja_info_provider_update_complete_invoke (GClosure             *update_complete,
87                                                                CajaInfoProvider     *provider,
88                                                                CajaOperationHandle  *handle,
89                                                                CajaOperationResult   result);
90 
91 G_END_DECLS
92 
93 #endif
94