2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2001 Match Grun
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * General functions for accessing address index file.
24 #ifndef __ADDRINDEX_H__
25 #define __ADDRINDEX_H__
31 #define ADDRESSBOOK_MAX_IFACE 4
32 #define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
33 #define ADDRESSBOOK_OLD_FILE "addressbook.xml"
45 typedef struct _AddressIndex AddressIndex;
46 struct _AddressIndex {
51 gboolean needsConversion;
52 gboolean wasConverted;
53 gboolean conversionError;
54 AddressIfType lastType;
59 typedef struct _AddressInterface AddressInterface;
60 struct _AddressInterface {
67 gboolean useInterface;
71 gboolean (*getModifyFlag)( void * );
72 gboolean (*getAccessFlag)( void * );
73 gboolean (*getReadFlag)( void * );
74 gint (*getStatusCode)( void * );
75 gint (*getReadData)( void * );
76 ItemFolder *(*getRootFolder)( void * );
77 GList *(*getListFolder)( void * );
78 GList *(*getListPerson)( void * );
79 GList *(*getAllPersons)( void * );
80 gchar *(*getName) ( void * );
81 void (*setAccessFlag)( void *, void * );
84 typedef struct _AddressDataSource AddressDataSource;
85 struct _AddressDataSource {
88 AddressInterface *interface;
89 gpointer rawDataSource;
92 AddressIndex *addrindex_create_index();
93 void addrindex_set_file_path( AddressIndex *addrIndex, const gchar *value );
94 void addrindex_set_file_name( AddressIndex *addrIndex, const gchar *value );
95 void addrindex_set_dirty( AddressIndex *addrIndex, const gboolean value );
96 GList *addrindex_get_interface_list( AddressIndex *addrIndex );
97 void addrindex_free_index( AddressIndex *addrIndex );
98 void addrindex_print_index( AddressIndex *addrIndex, FILE *stream );
100 AddressInterface *addrindex_get_interface( AddressIndex *addrIndex, AddressIfType ifType );
101 AddressDataSource *addrindex_index_add_datasource( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource );
102 AddressDataSource *addrindex_index_remove_datasource( AddressIndex *addrIndex, AddressDataSource *dataSource );
103 void addrindex_free_datasource( AddressIndex *addrIndex, AddressDataSource *ds );
105 gint addrindex_read_data( AddressIndex *addrIndex );
106 gint addrindex_write_to( AddressIndex *addrIndex, const gchar *newFile );
107 gint addrindex_save_data( AddressIndex *addrIndex );
108 gint addrindex_create_new_books( AddressIndex *addrIndex );
109 gint addrindex_save_all_books( AddressIndex *addrIndex );
111 gboolean addrindex_ds_get_modify_flag( AddressDataSource *ds );
112 gboolean addrindex_ds_get_access_flag( AddressDataSource *ds );
113 gboolean addrindex_ds_get_read_flag( AddressDataSource *ds );
114 gint addrindex_ds_get_status_code( AddressDataSource *ds );
115 gint addrindex_ds_read_data( AddressDataSource *ds );
116 ItemFolder *addrindex_ds_get_root_folder( AddressDataSource *ds );
117 GList *addrindex_ds_get_list_folder( AddressDataSource *ds );
118 GList *addrindex_ds_get_list_person( AddressDataSource *ds );
119 gchar *addrindex_ds_get_name( AddressDataSource *ds );
120 void addrindex_ds_set_access_flag( AddressDataSource *ds, gboolean *value );
121 gboolean addrindex_ds_get_readonly( AddressDataSource *ds );
122 GList *addrindex_ds_get_all_persons( AddressDataSource *ds );
124 #endif /* __ADDRINDEX_H__ */