New address book.
[claws.git] / src / addressitem.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999,2000 Hiroyuki Yamamoto
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  * Address item data. Shared among GUI components only.
22  */
23
24 #ifndef __ADDRESSITEM_H__
25 #define __ADDRESSITEM_H__
26
27 #include <glib.h>
28 #include <gtk/gtkwidget.h>
29 #include <gtk/gtkctree.h>
30
31 #include "compose.h"
32 #include "addrindex.h"
33
34 #define ADDRESS_OBJECT(obj)             ((AddressObject *)obj)
35 #define ADDRESS_OBJECT_TYPE(obj)        (ADDRESS_OBJECT(obj)->type)
36 #define ADDRESS_OBJECT_NAME(obj)        (ADDRESS_OBJECT(obj)->name)
37
38 #define ADAPTER_INTERFACE(obj)          ((AdapterInterface *)obj)
39 #define ADAPTER_FOLDER(obj)             ((AdapterFolder *)obj)
40 #define ADAPTER_GROUP(obj)              ((AdapterGroup *)obj)
41 #define ADAPTER_DSOURCE(obj)            ((AdapterDSource *)obj)
42
43 typedef enum {
44         ADDR_NONE,
45         ADDR_ITEM_PERSON,
46         ADDR_ITEM_EMAIL,
47         ADDR_ITEM_FOLDER,
48         ADDR_ITEM_GROUP,
49         ADDR_INTERFACE,
50         ADDR_DATASOURCE,
51         ADDR_BOOK,              // Sub-type
52         ADDR_VCARD,             // Sub-type
53         ADDR_JPILOT,            // Sub-type
54         ADDR_CATEGORY,          // Sub-type
55         ADDR_LDAP               // Sub-type
56 } AddressObjectType;
57
58 typedef struct _AddressBook_win AddressBook_win;
59 struct _AddressBook_win
60 {
61         GtkWidget *window;
62         GtkWidget *menubar;
63         GtkWidget *ctree;
64         GtkWidget *clist;
65         GtkWidget *entry;
66         GtkWidget *statusbar;
67
68         GtkWidget *del_btn;
69         GtkWidget *reg_btn;
70         GtkWidget *lup_btn;
71         GtkWidget *to_btn;
72         GtkWidget *cc_btn;
73         GtkWidget *bcc_btn;
74
75         GtkWidget *tree_popup;
76         GtkWidget *list_popup;
77         GtkItemFactory *tree_factory;
78         GtkItemFactory *list_factory;
79         GtkItemFactory *menu_factory;
80
81         GtkCTreeNode *treeSelected;
82         GtkCTreeNode *opened;
83         GtkCTreeNode *listSelected;
84
85         Compose *target_compose;
86         gint status_cid;
87 };
88
89 typedef struct _AddressTypeControlItem  AddressTypeControlItem;
90 struct _AddressTypeControlItem {
91         AddressObjectType objectType;
92         AddressIfType interfaceType;
93         gchar *displayName;
94         gboolean showInTree;
95         gboolean treeExpand;
96         gboolean treeLeaf;
97         gchar *menuCommand;
98         GdkPixmap *iconXpm;
99         GdkBitmap *maskXpm;
100         GdkPixmap *iconXpmOpen;
101         GdkBitmap *maskXpmOpen;
102 };
103
104 typedef struct _AddressObject   AddressObject;
105 struct _AddressObject {
106         AddressObjectType type;
107         gchar *name;
108 };
109
110 typedef struct _AdapterInterface AdapterInterface;
111 struct _AdapterInterface {
112         AddressObject obj;
113         AddressInterface *interface;
114         AddressIfType interfaceType;
115         AddressTypeControlItem *atci;
116         gboolean enabled;
117         gboolean haveLibrary;
118         GtkCTreeNode *treeNode;
119 };
120
121 typedef struct _AdapterDSource AdapterDSource;
122 struct _AdapterDSource {
123         AddressObject obj;
124         AddressDataSource *dataSource;
125         AddressObjectType subType;
126 };
127
128 typedef struct _AdapterFolder AdapterFolder;
129 struct _AdapterFolder {
130         AddressObject obj;
131         ItemFolder *itemFolder;
132 };
133
134 typedef struct _AdapterGroup AdapterGroup;
135 struct _AdapterGroup {
136         AddressObject obj;
137         ItemGroup *itemGroup;
138 };
139
140 typedef struct _AddressFileSelection AddressFileSelection;
141 struct _AddressFileSelection {
142         GtkWidget *fileSelector;
143         gboolean cancelled;
144 };
145
146 AdapterDSource *addressbook_create_ds_adapter   ( AddressDataSource     *ds,
147                                                   AddressObjectType     otype,
148                                                   gchar                 *name );
149
150 void addressbook_ads_set_name                   ( AdapterDSource        *adapter,
151                                                   gchar *value );
152
153 #endif /* __ADDRESSITEM_H__ */
154
155 /*
156 * End of Source.
157 */
158