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 GList *(*getAllGroups)( void * );
81 gchar *(*getName)( void * );
82 void (*setAccessFlag)( void *, void * );
85 typedef struct _AddressDataSource AddressDataSource;
86 struct _AddressDataSource {
89 AddressInterface *interface;
90 gpointer rawDataSource;
93 AddressIndex *addrindex_create_index ();
94 void addrindex_set_file_path ( AddressIndex *addrIndex, const gchar *value );
95 void addrindex_set_file_name ( AddressIndex *addrIndex, const gchar *value );
96 void addrindex_set_dirty ( AddressIndex *addrIndex, const gboolean value );
97 GList *addrindex_get_interface_list ( AddressIndex *addrIndex );
98 void addrindex_free_index ( AddressIndex *addrIndex );
99 void addrindex_print_index ( AddressIndex *addrIndex, FILE *stream );
101 AddressInterface *addrindex_get_interface ( AddressIndex *addrIndex, AddressIfType ifType );
102 AddressDataSource *addrindex_index_add_datasource ( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource );
103 AddressDataSource *addrindex_index_remove_datasource ( AddressIndex *addrIndex, AddressDataSource *dataSource );
104 void addrindex_free_datasource ( AddressIndex *addrIndex, AddressDataSource *ds );
106 gint addrindex_read_data ( AddressIndex *addrIndex );
107 gint addrindex_write_to ( AddressIndex *addrIndex, const gchar *newFile );
108 gint addrindex_save_data ( AddressIndex *addrIndex );
109 gint addrindex_create_new_books ( AddressIndex *addrIndex );
110 gint addrindex_save_all_books ( AddressIndex *addrIndex );
112 gboolean addrindex_ds_get_modify_flag ( AddressDataSource *ds );
113 gboolean addrindex_ds_get_access_flag ( AddressDataSource *ds );
114 gboolean addrindex_ds_get_read_flag ( AddressDataSource *ds );
115 gint addrindex_ds_get_status_code ( AddressDataSource *ds );
116 gint addrindex_ds_read_data ( AddressDataSource *ds );
117 ItemFolder *addrindex_ds_get_root_folder( AddressDataSource *ds );
118 GList *addrindex_ds_get_list_folder ( AddressDataSource *ds );
119 GList *addrindex_ds_get_list_person ( AddressDataSource *ds );
120 gchar *addrindex_ds_get_name ( AddressDataSource *ds );
121 void addrindex_ds_set_access_flag ( AddressDataSource *ds, gboolean *value );
122 gboolean addrindex_ds_get_readonly ( AddressDataSource *ds );
123 GList *addrindex_ds_get_all_persons ( AddressDataSource *ds );
124 GList *addrindex_ds_get_all_groups ( AddressDataSource *ds );
126 #endif /* __ADDRINDEX_H__ */