1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Copyright (C) 2001-2004 Ximian, Inc.
8 * Authors: Jon Trowbridge <trow@ximian.com>
9 * Chris Toshok <toshok@ximian.com>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of version 2 of the GNU Lesser General Public
15 * License as published by the Free Software Foundation.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
28 #ifndef __E_DESTINATION_H__
29 #define __E_DESTINATION_H__
32 #include <glib-object.h>
33 #include <libebook/e-contact.h>
34 #include <libebook/e-book.h>
35 #include <libxml/tree.h>
37 #define E_TYPE_DESTINATION (e_destination_get_type ())
38 #define E_DESTINATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_DESTINATION, EDestination))
39 #define E_DESTINATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_DESTINATION, EDestinationClass))
40 #define E_IS_DESTINATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_DESTINATION))
41 #define E_IS_DESTINATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_DESTINATION))
42 #define E_DESTINATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_DESTINATION, EDestinationClass))
44 typedef struct _EDestination EDestination;
45 typedef struct _EDestinationClass EDestinationClass;
47 struct _EDestinationPrivate;
49 struct _EDestination {
52 struct _EDestinationPrivate *priv;
55 struct _EDestinationClass {
56 GObjectClass parent_class;
59 void (* changed) (EDestination *destination);
61 /* Padding for future expansion */
62 void (*_ebook_reserved1) (void);
63 void (*_ebook_reserved2) (void);
64 void (*_ebook_reserved3) (void);
65 void (*_ebook_reserved4) (void);
68 GType e_destination_get_type (void);
71 EDestination *e_destination_new (void);
72 EDestination *e_destination_copy (const EDestination *dest);
74 gboolean e_destination_empty (const EDestination *dest);
75 gboolean e_destination_equal (const EDestination *a, const EDestination *b);
77 /* for use with EDestinations that wrap a particular contact */
78 void e_destination_set_contact (EDestination *dest, EContact *contact, int email_num);
79 void e_destination_set_contact_uid (EDestination *dest, const char *uid, gint email_num);
80 void e_destination_set_book (EDestination *dest, EBook *book);
81 EContact *e_destination_get_contact (const EDestination *dest);
82 const char *e_destination_get_source_uid (const EDestination *dest);
83 const char *e_destination_get_contact_uid (const EDestination *dest);
84 int e_destination_get_email_num (const EDestination *dest);
86 /* for use with EDestinations built up from strings (not corresponding to contacts in a user's address books) */
87 void e_destination_set_name (EDestination *dest, const char *name);
88 void e_destination_set_email (EDestination *dest, const char *email);
89 const char *e_destination_get_name (const EDestination *dest); /* "Jane Smith" */
90 const char *e_destination_get_email (const EDestination *dest); /* "jane@assbarn.com" */
91 const char *e_destination_get_address (const EDestination *dest); /* "Jane Smith <jane@assbarn.com>" (or a comma-sep set of such for a list) */
93 gboolean e_destination_is_evolution_list (const EDestination *dest);
94 gboolean e_destination_list_show_addresses (const EDestination *dest);
95 const GList *e_destination_list_get_dests (const EDestination *dest);
96 gboolean e_destination_is_ignored (const EDestination *dest);
97 void e_destination_set_ignored (EDestination *dest, gboolean ignored);
99 /* If true, they want HTML mail. */
100 void e_destination_set_html_mail_pref (EDestination *dest, gboolean flag);
101 gboolean e_destination_get_html_mail_pref (const EDestination *dest);
103 /* used by the evolution composer to manage automatic recipients
105 XXX should probably be implemented using a more neutral/extensible
106 approach instead of a hardcoded evolution-only flag. */
107 gboolean e_destination_is_auto_recipient (const EDestination *dest);
108 void e_destination_set_auto_recipient (EDestination *dest, gboolean value);
110 /* parse out an EDestination (name/email, not contact) from a free form string. */
111 void e_destination_set_raw (EDestination *dest, const char *raw);
113 /* generate a plain-text representation of an EDestination* or EDestination** */
114 const char *e_destination_get_textrep (const EDestination *dest, gboolean include_email); /* "Jane Smith" or "jane@assbarn.com" */
115 char *e_destination_get_textrepv (EDestination **destv);
117 /* XML export/import routines. */
118 char *e_destination_export (const EDestination *dest);
119 char *e_destination_exportv (EDestination **destv);
120 EDestination *e_destination_import (const char *str);
121 EDestination **e_destination_importv (const char *str);
123 /* EVCard "export" routines */
124 void e_destination_export_to_vcard_attribute (EDestination *dest, EVCardAttribute *attr);
126 void e_destination_freev (EDestination **destv);
128 #endif /* __E_DESTINATION_H__ */