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