2006-12-28 [wwp] 2.6.1cvs82
[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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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         ADDR_LDAP_QUERY         /* Sub-type */
57 } AddressObjectType;
58
59 typedef struct _AddressBook_win AddressBook_win;
60 struct _AddressBook_win
61 {
62         GtkWidget *window;
63         GtkWidget *hpaned;
64         GtkWidget *vpaned;
65         GtkWidget *menubar;
66         GtkWidget *ctree;
67         GtkWidget *ctree_swin;
68         GtkWidget *editaddress_vbox;
69         GtkWidget *clist;
70         GtkWidget *entry;
71         GtkWidget *label;
72         GtkWidget *statusbar;
73
74         GtkWidget *help_btn;
75         GtkWidget *edit_btn;
76         GtkWidget *del_btn;
77         GtkWidget *reg_btn;
78         GtkWidget *lup_btn;
79         GtkWidget *to_btn;
80         GtkWidget *cc_btn;
81         GtkWidget *bcc_btn;
82
83         GtkWidget *tree_popup;
84         GtkWidget *list_popup;
85         GtkItemFactory *tree_factory;
86         GtkItemFactory *list_factory;
87         GtkItemFactory *menu_factory;
88
89         GtkCTreeNode *treeSelected;
90         GtkCTreeNode *opened;
91         GtkCTreeNode *listSelected;
92
93         Compose *target_compose;
94         gint status_cid;
95 };
96
97 typedef struct _AddressTypeControlItem  AddressTypeControlItem;
98 struct _AddressTypeControlItem {
99         AddressObjectType objectType;
100         AddressIfType interfaceType;
101         gchar *displayName;
102         gboolean showInTree;
103         gboolean treeExpand;
104         gboolean treeLeaf;
105         gchar *menuCommand;
106         GdkPixmap *iconXpm;
107         GdkBitmap *maskXpm;
108         GdkPixmap *iconXpmOpen;
109         GdkBitmap *maskXpmOpen;
110 };
111
112 typedef struct _AddressObject   AddressObject;
113 struct _AddressObject {
114         AddressObjectType type;
115         gchar *name;
116 };
117
118 typedef struct _AdapterInterface AdapterInterface;
119 struct _AdapterInterface {
120         AddressObject obj;
121         AddressInterface *interface;
122         AddressIfType interfaceType;
123         AddressTypeControlItem *atci;
124         gboolean enabled;
125         gboolean haveLibrary;
126         GtkCTreeNode *treeNode;
127 };
128
129 typedef struct _AdapterDSource AdapterDSource;
130 struct _AdapterDSource {
131         AddressObject obj;
132         AddressDataSource *dataSource;
133         AddressObjectType subType;
134 };
135
136 typedef struct _AdapterFolder AdapterFolder;
137 struct _AdapterFolder {
138         AddressObject obj;
139         ItemFolder *itemFolder;
140 };
141
142 typedef struct _AdapterGroup AdapterGroup;
143 struct _AdapterGroup {
144         AddressObject obj;
145         ItemGroup *itemGroup;
146 };
147
148 typedef struct _AddressFileSelection AddressFileSelection;
149 struct _AddressFileSelection {
150         GtkWidget *fileSelector;
151         gboolean cancelled;
152 };
153
154 AdapterDSource *addressbook_create_ds_adapter   ( AddressDataSource     *ds,
155                                                   AddressObjectType     otype,
156                                                   gchar                 *name );
157
158 void addressbook_ads_set_name           ( AdapterDSource *adapter,
159                                           gchar          *value );
160
161 ItemObjectType addressbook_type2item    ( AddressObjectType abType );
162
163 #endif /* __ADDRESSITEM_H__ */
164
165 /*
166 * End of Source.
167 */
168