comment out menu entry not existing in claws
[claws.git] / src / addrindex.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2001 Match Grun
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 /*
21  * General functions for accessing address index file.
22  */
23
24 #ifndef __ADDRINDEX_H__
25 #define __ADDRINDEX_H__
26
27 #include <stdio.h>
28 #include <glib.h>
29 #include "addritem.h"
30
31 #define ADDRESSBOOK_MAX_IFACE  4
32 #define ADDRESSBOOK_INDEX_FILE "addrbook--index.xml"
33 #define ADDRESSBOOK_OLD_FILE   "addressbook.xml"
34
35 typedef enum {
36         ADDR_IF_NONE,
37         ADDR_IF_BOOK,
38         ADDR_IF_VCARD,
39         ADDR_IF_JPILOT,
40         ADDR_IF_LDAP,
41         ADDR_IF_COMMON,
42         ADDR_IF_PERSONAL
43 } AddressIfType;
44
45 typedef struct _AddressIndex AddressIndex;
46 struct _AddressIndex {
47         AddrItemObject obj;
48         gchar *filePath;
49         gchar *fileName;
50         gint  retVal;
51         gboolean needsConversion;
52         gboolean wasConverted;
53         gboolean conversionError;
54         AddressIfType lastType;
55         gboolean dirtyFlag;
56         GList *interfaceList;
57 };
58
59 typedef struct _AddressInterface AddressInterface;
60 struct _AddressInterface {
61         AddrItemObject obj;
62         AddressIfType type;
63         gchar *name;
64         gchar *listTag;
65         gchar *itemTag;
66         gboolean legacyFlag;
67         gboolean useInterface;
68         gboolean haveLibrary;
69         gboolean readOnly;
70         GList *listSource;
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 * );
82 };
83
84 typedef struct _AddressDataSource AddressDataSource;
85 struct _AddressDataSource {
86         AddrItemObject obj;
87         AddressIfType type;
88         AddressInterface *interface;
89         gpointer rawDataSource;
90 };
91
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 );
99
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 );
104
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 );
110
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 );
123
124 #endif /* __ADDRINDEX_H__ */
125
126 /*
127 * End of Source.
128 */
129
130