addressitem.h (3831B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team 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 3 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, see <http://www.gnu.org/licenses/>. 17 * 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/gtk.h> 29 30 #include "compose.h" 31 #include "addrindex.h" 32 33 #define ADDRESS_OBJECT(obj) ((AddressObject *)obj) 34 #define ADDRESS_OBJECT_TYPE(obj) (ADDRESS_OBJECT(obj)->type) 35 #define ADDRESS_OBJECT_NAME(obj) (ADDRESS_OBJECT(obj)->name) 36 37 #define ADAPTER_INTERFACE(obj) ((AdapterInterface *)obj) 38 #define ADAPTER_FOLDER(obj) ((AdapterFolder *)obj) 39 #define ADAPTER_GROUP(obj) ((AdapterGroup *)obj) 40 #define ADAPTER_DSOURCE(obj) ((AdapterDSource *)obj) 41 42 typedef enum { 43 ADDR_NONE, 44 ADDR_ITEM_PERSON, 45 ADDR_ITEM_EMAIL, 46 ADDR_ITEM_FOLDER, 47 ADDR_ITEM_GROUP, 48 ADDR_INTERFACE, 49 ADDR_DATASOURCE, 50 ADDR_BOOK, /* Sub-type */ 51 ADDR_CATEGORY, /* Sub-type */ 52 } AddressObjectType; 53 54 typedef struct _AddressBook_win AddressBook_win; 55 struct _AddressBook_win 56 { 57 GtkWidget *window; 58 GtkWidget *hpaned; 59 GtkWidget *vpaned; 60 GtkWidget *menubar; 61 GtkWidget *ctree; 62 GtkWidget *ctree_swin; 63 GtkWidget *editaddress_vbox; 64 GtkWidget *clist; 65 GtkWidget *entry; 66 GtkWidget *label; 67 GtkWidget *statusbar; 68 69 GtkWidget *help_btn; 70 GtkWidget *edit_btn; 71 GtkWidget *del_btn; 72 GtkWidget *reg_btn; 73 GtkWidget *lup_btn; 74 GtkWidget *to_btn; 75 GtkWidget *cc_btn; 76 GtkWidget *bcc_btn; 77 78 GtkWidget *tree_popup; 79 GtkWidget *list_popup; 80 81 GtkCMCTreeNode *treeSelected; 82 GtkCMCTreeNode *opened; 83 GtkCMCTreeNode *listSelected; 84 85 Compose *target_compose; 86 gint status_cid; 87 GtkUIManager *ui_manager; 88 }; 89 90 typedef struct _AddressTypeControlItem AddressTypeControlItem; 91 struct _AddressTypeControlItem { 92 AddressObjectType objectType; 93 AddressIfType interfaceType; 94 gchar *displayName; 95 gboolean showInTree; 96 gboolean treeExpand; 97 gboolean treeLeaf; 98 gchar *menuCommand; 99 GdkPixbuf *iconXpm; 100 GdkPixbuf *iconXpmOpen; 101 }; 102 103 typedef struct _AddressObject AddressObject; 104 struct _AddressObject { 105 AddressObjectType type; 106 gchar *name; 107 }; 108 109 typedef struct _AdapterInterface AdapterInterface; 110 struct _AdapterInterface { 111 AddressObject obj; 112 AddressInterface *interface; 113 AddressIfType interfaceType; 114 AddressTypeControlItem *atci; 115 gboolean enabled; 116 gboolean haveLibrary; 117 GtkCMCTreeNode *treeNode; 118 }; 119 120 typedef struct _AdapterDSource AdapterDSource; 121 struct _AdapterDSource { 122 AddressObject obj; 123 AddressDataSource *dataSource; 124 AddressObjectType subType; 125 }; 126 127 typedef struct _AdapterFolder AdapterFolder; 128 struct _AdapterFolder { 129 AddressObject obj; 130 ItemFolder *itemFolder; 131 }; 132 133 typedef struct _AdapterGroup AdapterGroup; 134 struct _AdapterGroup { 135 AddressObject obj; 136 ItemGroup *itemGroup; 137 }; 138 139 typedef struct _AddressFileSelection AddressFileSelection; 140 struct _AddressFileSelection { 141 GtkWidget *fileSelector; 142 gboolean cancelled; 143 }; 144 145 AdapterDSource *addressbook_create_ds_adapter ( AddressDataSource *ds, 146 AddressObjectType otype, 147 gchar *name ); 148 149 void addressbook_ads_set_name ( AdapterDSource *adapter, 150 gchar *value ); 151 152 ItemObjectType addressbook_type2item ( AddressObjectType abType ); 153 154 #endif /* __ADDRESSITEM_H__ */