2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999,2000 Hiroyuki Yamamoto
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.
20 #ifndef __ADDRESSBOOK_H__
21 #define __ADDRESSBOOK_H__
24 #include <gtk/gtkwidget.h>
25 #include <gtk/gtkitemfactory.h>
26 #include <gtk/gtkctree.h>
28 #define ADDRESS_OBJECT(obj) ((AddressObject *)(obj))
29 #define ADDRESS_OBJECT_TYPE(obj) (ADDRESS_OBJECT((obj))->type)
30 #define ADDRESS_ITEM(obj) ((AddressItem *)(obj))
31 #define ADDRESS_GROUP(obj) ((AddressGroup *)(obj))
32 #define ADDRESS_FOLDER(obj) ((AddressFolder *)(obj))
34 typedef struct _AddressBook AddressBook;
35 typedef struct _AddressObject AddressObject;
36 typedef struct _AddressItem AddressItem;
37 typedef struct _AddressGroup AddressGroup;
38 typedef struct _AddressFolder AddressFolder;
63 GtkWidget *tree_popup;
64 GtkWidget *list_popup;
65 GtkItemFactory *tree_factory;
66 GtkItemFactory *list_factory;
69 GtkCTreeNode *personal;
70 GtkCTreeNode *selected;
75 Compose *target_compose;
80 AddressObjectType type;
98 /* Group contains only Items */
102 struct _AddressFolder
108 /* Folder contains Groups and Items */
112 void addressbook_open (Compose *target);
113 void addressbook_set_target_compose (Compose *target);
114 Compose *addressbook_get_target_compose (void);
115 void addressbook_export_to_file (void);
117 /* provisional API for accessing the address book */
119 void addressbook_access (void);
120 void addressbook_unaccess (void);
122 const gchar *addressbook_get_personal_folder_name (void);
123 const gchar *addressbook_get_common_folder_name (void);
125 AddressObject *addressbook_find_group_by_name (const gchar *name);
126 AddressObject *addressbook_find_contact (const gchar *name, const gchar *address);
127 GList *addressbook_get_group_list (void);
128 gint addressbook_add_contact (const gchar *group, const gchar *name,
129 const gchar *address, const gchar *remarks);
131 gboolean addressbook_add_contact_by_menu(GtkWidget *submenu,
133 const gchar *address,
134 const gchar *remarks);
136 #endif /* __ADDRESSBOOK_H__ */