1 /*
2  * gnome-keyring
3  *
4  * Copyright (C) 2008 Stefan Walter
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GKM_SERIALIZABLE_H__
22 #define __GKM_SERIALIZABLE_H__
23 
24 #include <glib-object.h>
25 
26 #include "gkm-types.h"
27 
28 G_BEGIN_DECLS
29 
30 #define GKM_TYPE_SERIALIZABLE                 (gkm_serializable_get_type())
31 #define GKM_SERIALIZABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SERIALIZABLE, GkmSerializable))
32 #define GKM_IS_SERIALIZABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SERIALIZABLE))
33 #define GKM_SERIALIZABLE_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GKM_TYPE_SERIALIZABLE, GkmSerializableIface))
34 
35 typedef struct _GkmSerializable      GkmSerializable;
36 typedef struct _GkmSerializableIface GkmSerializableIface;
37 
38 struct _GkmSerializableIface {
39 	GTypeInterface parent;
40 
41 	const gchar *extension;
42 
43 	gboolean   (*load) (GkmSerializable *self,
44 	                    GkmSecret *login,
45 	                    GBytes *data);
46 
47 	GBytes *   (*save) (GkmSerializable *self,
48 	                    GkmSecret *login);
49 };
50 
51 GType                  gkm_serializable_get_type                          (void) G_GNUC_CONST;
52 
53 gboolean               gkm_serializable_load                              (GkmSerializable *self,
54                                                                            GkmSecret *login,
55                                                                            GBytes *data);
56 
57 GBytes *               gkm_serializable_save                              (GkmSerializable *self,
58                                                                            GkmSecret *login);
59 
60 G_END_DECLS
61 
62 #endif /* __GKM_SERIALIZABLE_H__ */
63