1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 3 /* 4 * e-destination.h 5 * 6 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 7 * 8 * This library is free software: you can redistribute it and/or modify it 9 * under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation. 11 * 12 * This library is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 * for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with this library. If not, see <http://www.gnu.org/licenses/>. 19 * 20 * Authors: Jon Trowbridge <trow@ximian.com> 21 * Chris Toshok <toshok@ximian.com> 22 */ 23 24 #if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION) 25 #error "Only <libebook/libebook.h> should be included directly." 26 #endif 27 28 #ifndef __E_DESTINATION_H__ 29 #define __E_DESTINATION_H__ 30 31 #include <libebook-contacts/libebook-contacts.h> 32 #include <libebook/e-book.h> 33 #include <libebook/e-book-client.h> 34 #include <libxml/tree.h> 35 36 /* Standard GObject macros */ 37 #define E_TYPE_DESTINATION \ 38 (e_destination_get_type ()) 39 #define E_DESTINATION(obj) \ 40 (G_TYPE_CHECK_INSTANCE_CAST \ 41 ((obj), E_TYPE_DESTINATION, EDestination)) 42 #define E_DESTINATION_CLASS(cls) \ 43 (G_TYPE_CHECK_CLASS_CAST \ 44 ((cls), E_TYPE_DESTINATION, EDestinationClass)) 45 #define E_IS_DESTINATION(obj) \ 46 (G_TYPE_CHECK_INSTANCE_TYPE \ 47 ((obj), E_TYPE_DESTINATION)) 48 #define E_IS_DESTINATION_CLASS(cls) \ 49 (G_TYPE_CHECK_CLASS_TYPE \ 50 ((cls), E_TYPE_DESTINATION)) 51 #define E_DESTINATION_GET_CLASS(obj) \ 52 (G_TYPE_INSTANCE_GET_CLASS \ 53 ((obj), E_TYPE_DESTINATION, EDestinationClass)) 54 55 G_BEGIN_DECLS 56 57 typedef struct _EDestination EDestination; 58 typedef struct _EDestinationClass EDestinationClass; 59 typedef struct _EDestinationPrivate EDestinationPrivate; 60 61 struct _EDestination { 62 GObject object; 63 EDestinationPrivate *priv; 64 }; 65 66 struct _EDestinationClass { 67 GObjectClass parent_class; 68 69 /* Signals */ 70 void (*changed) (EDestination *destination); 71 72 /* Padding for future expansion */ 73 void (*_ebook_reserved1) (void); 74 void (*_ebook_reserved2) (void); 75 void (*_ebook_reserved3) (void); 76 void (*_ebook_reserved4) (void); 77 }; 78 79 GType e_destination_get_type (void) G_GNUC_CONST; 80 81 EDestination * e_destination_new (void); 82 EDestination * e_destination_copy (const EDestination *dest); 83 84 gboolean e_destination_empty (const EDestination *dest); 85 gboolean e_destination_equal (const EDestination *a, 86 const EDestination *b); 87 88 /* for use with EDestinations that wrap a particular contact */ 89 void e_destination_set_contact (EDestination *dest, 90 EContact *contact, 91 gint email_num); 92 void e_destination_set_contact_uid (EDestination *dest, 93 const gchar *uid, 94 gint email_num); 95 void e_destination_set_client (EDestination *dest, 96 EBookClient *client); 97 EContact * e_destination_get_contact (const EDestination *dest); 98 const gchar * e_destination_get_source_uid (const EDestination *dest); 99 const gchar * e_destination_get_contact_uid (const EDestination *dest); 100 gint e_destination_get_email_num (const EDestination *dest); 101 102 /* for use with EDestinations built up from strings 103 * (not corresponding to contacts in a user's address books) */ 104 void e_destination_set_name (EDestination *dest, 105 const gchar *name); 106 void e_destination_set_email (EDestination *dest, 107 const gchar *email); 108 const gchar * e_destination_get_name (const EDestination *dest); 109 const gchar * e_destination_get_email (const EDestination *dest); 110 const gchar * e_destination_get_address (const EDestination *dest); 111 112 gboolean e_destination_is_evolution_list (const EDestination *dest); 113 gboolean e_destination_list_show_addresses 114 (const EDestination *dest); 115 const GList * e_destination_list_get_dests (const EDestination *dest); 116 const GList * e_destination_list_get_root_dests 117 (const EDestination *dest); 118 gboolean e_destination_is_ignored (const EDestination *dest); 119 void e_destination_set_ignored (EDestination *dest, 120 gboolean ignored); 121 122 /* If true, they want HTML mail. */ 123 gboolean e_destination_get_html_mail_pref 124 (const EDestination *dest); 125 void e_destination_set_html_mail_pref 126 (EDestination *dest, 127 gboolean flag); 128 129 /* used by the evolution composer to manage automatic recipients 130 * 131 * XXX should probably be implemented using a more neutral/extensible 132 * approach instead of a hardcoded evolution-only flag. */ 133 gboolean e_destination_is_auto_recipient (const EDestination *dest); 134 void e_destination_set_auto_recipient 135 (EDestination *dest, 136 gboolean value); 137 138 /* set an EDestination (name/email, not contact) from a free form string. */ 139 void e_destination_set_raw (EDestination *dest, 140 const gchar *raw); 141 142 /* generate a plain-text representation of an EDestination */ 143 const gchar * e_destination_get_textrep (const EDestination *dest, 144 gboolean include_email); 145 gchar * e_destination_get_textrepv (EDestination **destv); 146 147 /* XML export/import routines. */ 148 gchar * e_destination_export (const EDestination *dest); 149 gchar * e_destination_exportv (EDestination **destv); 150 EDestination * e_destination_import (const gchar *str); 151 EDestination ** e_destination_importv (const gchar *str); 152 153 /* EVCard "export" routines */ 154 void e_destination_export_to_vcard_attribute 155 (EDestination *dest, 156 EVCardAttribute *attr); 157 158 void e_destination_freev (EDestination **destv); 159 160 #ifndef EDS_DISABLE_DEPRECATED 161 #ifndef __GI_SCANNER__ 162 void e_destination_set_book (EDestination *dest, 163 EBook *book); 164 #endif /* __GI_SCANNER__ */ 165 #endif /* EDS_DISABLE_DEPRECATED */ 166 167 G_END_DECLS 168 169 #endif /* __E_DESTINATION_H__ */ 170