1 /*
2  * e-mail-reader.h
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
18  *
19  */
20 
21 #ifndef E_MAIL_READER_H
22 #define E_MAIL_READER_H
23 
24 /* XXX Anjal uses a different message list widget than Evolution, so
25  *     avoid including <mail/message-list.h> in this file.  This makes
26  *     the get_message_list() method a little awkward since it returns
27  *     a GtkWidget pointer which almost always has to be type casted. */
28 
29 #include <gtk/gtk.h>
30 #include <camel/camel.h>
31 #include <e-util/e-util.h>
32 #include <composer/e-msg-composer.h>
33 
34 #include <mail/e-mail-backend.h>
35 #include <mail/e-mail-display.h>
36 #include <mail/e-mail-enums.h>
37 
38 /* Standard GObject macros */
39 #define E_TYPE_MAIL_READER \
40 	(e_mail_reader_get_type ())
41 #define E_MAIL_READER(obj) \
42 	(G_TYPE_CHECK_INSTANCE_CAST \
43 	((obj), E_TYPE_MAIL_READER, EMailReader))
44 #define E_MAIL_READER_INTERFACE(cls) \
45 	(G_TYPE_CHECK_CLASS_CAST \
46 	((cls), E_TYPE_MAIL_READER, EMailReaderInterface))
47 #define E_IS_MAIL_READER(obj) \
48 	(G_TYPE_CHECK_INSTANCE_TYPE \
49 	((obj), E_TYPE_MAIL_READER))
50 #define E_IS_MAIL_READER_INTERFACE(cls) \
51 	(G_TYPE_CHECK_CLASS_TYPE \
52 	((cls), E_TYPE_MAIL_READER))
53 #define E_MAIL_READER_GET_INTERFACE(obj) \
54 	(G_TYPE_INSTANCE_GET_INTERFACE \
55 	((obj), E_TYPE_MAIL_READER, EMailReaderInterface))
56 
57 /* Basename of the UI definition file. */
58 #define E_MAIL_READER_UI_DEFINITION	"evolution-mail-reader.ui"
59 
60 G_BEGIN_DECLS
61 
62 typedef struct _EMailReader EMailReader;
63 typedef struct _EMailReaderInterface EMailReaderInterface;
64 
65 typedef enum {
66 	E_MAIL_READER_ACTION_GROUP_STANDARD,
67 	E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS,
68 	E_MAIL_READER_ACTION_GROUP_LABELS,
69 	E_MAIL_READER_NUM_ACTION_GROUPS
70 } EMailReaderActionGroup;
71 
72 enum {
73 	E_MAIL_READER_HAVE_ENABLED_ACCOUNT = 1 << 0,
74 	E_MAIL_READER_SELECTION_SINGLE = 1 << 1,
75 	E_MAIL_READER_SELECTION_MULTIPLE = 1 << 2,
76 	E_MAIL_READER_SELECTION_CAN_ADD_SENDER = 1 << 3,
77 	E_MAIL_READER_SELECTION_FLAG_CLEAR = 1 << 4,
78 	E_MAIL_READER_SELECTION_FLAG_COMPLETED = 1 << 5,
79 	E_MAIL_READER_SELECTION_FLAG_FOLLOWUP = 1 << 6,
80 	E_MAIL_READER_SELECTION_HAS_DELETED = 1 << 7,
81 	E_MAIL_READER_SELECTION_HAS_IMPORTANT = 1 << 8,
82 	E_MAIL_READER_SELECTION_HAS_JUNK = 1 << 9,
83 	E_MAIL_READER_SELECTION_HAS_NOT_JUNK = 1 << 10,
84 	E_MAIL_READER_SELECTION_HAS_READ = 1 << 11,
85 	E_MAIL_READER_SELECTION_HAS_UNDELETED = 1 << 12,
86 	E_MAIL_READER_SELECTION_HAS_UNIMPORTANT = 1 << 13,
87 	E_MAIL_READER_SELECTION_HAS_UNREAD = 1 << 14,
88 	E_MAIL_READER_SELECTION_HAS_ATTACHMENTS = 1 << 15,
89 	E_MAIL_READER_SELECTION_IS_MAILING_LIST = 1 << 16,
90 	E_MAIL_READER_FOLDER_IS_JUNK = 1 << 17,
91 	E_MAIL_READER_FOLDER_IS_VTRASH = 1 << 18,
92 	E_MAIL_READER_FOLDER_ARCHIVE_FOLDER_SET = 1 << 19,
93 	E_MAIL_READER_SELECTION_HAS_IGNORE_THREAD = 1 << 20,
94 	E_MAIL_READER_SELECTION_HAS_NOTIGNORE_THREAD = 1 << 21,
95 	E_MAIL_READER_SELECTION_HAS_MAIL_NOTE = 1 << 22,
96 	E_MAIL_READER_SELECTION_HAS_COLOR = 1 << 23
97 };
98 
99 struct _EMailReaderInterface {
100 	GTypeInterface parent_interface;
101 
102 	GtkActionGroup *
103 			(*get_action_group)	(EMailReader *reader,
104 						 EMailReaderActionGroup group);
105 	EAlertSink *	(*get_alert_sink)	(EMailReader *reader);
106 	EMailBackend *	(*get_backend)		(EMailReader *reader);
107 	EMailDisplay *	(*get_mail_display)	(EMailReader *reader);
108 	gboolean	(*get_hide_deleted)	(EMailReader *reader);
109 	GtkWidget *	(*get_message_list)	(EMailReader *reader);
110 	GtkMenu *	(*get_popup_menu)	(EMailReader *reader);
111 	EPreviewPane *	(*get_preview_pane)	(EMailReader *reader);
112 	GPtrArray *	(*get_selected_uids)	(EMailReader *reader);
113 	GPtrArray *	(*get_selected_uids_with_collapsed_threads)
114 						(EMailReader *reader);
115 	GtkWindow *	(*get_window)		(EMailReader *reader);
116 
117 	CamelFolder *	(*ref_folder)		(EMailReader *reader);
118 	void		(*set_folder)		(EMailReader *reader,
119 						 CamelFolder *folder);
120 	void		(*set_message)		(EMailReader *reader,
121 						 const gchar *message_uid);
122 	guint		(*open_selected_mail)	(EMailReader *reader);
123 
124 	/* Signals */
125 	void		(*composer_created)	(EMailReader *reader,
126 						 EMsgComposer *composer,
127 						 CamelMimeMessage *source);
128 	void		(*folder_loaded)	(EMailReader *reader);
129 	void		(*message_loaded)	(EMailReader *reader,
130 						 const gchar *message_uid,
131 						 CamelMimeMessage *message);
132 	void		(*message_seen)		(EMailReader *reader,
133 						 const gchar *message_uid,
134 						 CamelMimeMessage *message);
135 	void		(*show_search_bar)	(EMailReader *reader);
136 	void		(*update_actions)	(EMailReader *reader,
137 						 guint32 state);
138 	gboolean	(*close_on_delete_or_junk)
139 						(EMailReader *reader);
140 	void		(*reload)		(EMailReader *reader);
141 	void		(*remove_ui)		(EMailReader *reader);
142 
143 	/* Padding for future expansion */
144 	gpointer reserved[1];
145 };
146 
147 GType		e_mail_reader_get_type		(void);
148 void		e_mail_reader_init		(EMailReader *reader,
149 						 gboolean init_actions,
150 						 gboolean connect_signals);
151 void		e_mail_reader_dispose		(EMailReader *reader);
152 void		e_mail_reader_changed		(EMailReader *reader);
153 guint32		e_mail_reader_check_state	(EMailReader *reader);
154 EActivity *	e_mail_reader_new_activity	(EMailReader *reader);
155 void		e_mail_reader_update_actions	(EMailReader *reader,
156 						 guint32 state);
157 GtkAction *	e_mail_reader_get_action	(EMailReader *reader,
158 						 const gchar *action_name);
159 GtkActionGroup *
160 		e_mail_reader_get_action_group	(EMailReader *reader,
161 						 EMailReaderActionGroup group);
162 EAlertSink *	e_mail_reader_get_alert_sink	(EMailReader *reader);
163 EMailBackend *	e_mail_reader_get_backend	(EMailReader *reader);
164 EMailDisplay *	e_mail_reader_get_mail_display	(EMailReader *reader);
165 gboolean	e_mail_reader_get_hide_deleted	(EMailReader *reader);
166 GtkWidget *	e_mail_reader_get_message_list	(EMailReader *reader);
167 guint		e_mail_reader_open_selected_mail
168 						(EMailReader *reader);
169 GtkMenu *	e_mail_reader_get_popup_menu	(EMailReader *reader);
170 EPreviewPane *	e_mail_reader_get_preview_pane	(EMailReader *reader);
171 GPtrArray *	e_mail_reader_get_selected_uids	(EMailReader *reader);
172 GPtrArray *	e_mail_reader_get_selected_uids_with_collapsed_threads
173 						(EMailReader *reader);
174 GtkWindow *	e_mail_reader_get_window	(EMailReader *reader);
175 gboolean	e_mail_reader_close_on_delete_or_junk
176 						(EMailReader *reader);
177 CamelFolder *	e_mail_reader_ref_folder	(EMailReader *reader);
178 void		e_mail_reader_set_folder	(EMailReader *reader,
179 						 CamelFolder *folder);
180 void		e_mail_reader_set_message	(EMailReader *reader,
181 						 const gchar *message_uid);
182 EMailForwardStyle
183 		e_mail_reader_get_forward_style	(EMailReader *reader);
184 void		e_mail_reader_set_forward_style	(EMailReader *reader,
185 						 EMailForwardStyle style);
186 gboolean	e_mail_reader_get_group_by_threads
187 						(EMailReader *reader);
188 void		e_mail_reader_set_group_by_threads
189 						(EMailReader *reader,
190 						 gboolean group_by_threads);
191 EMailReplyStyle	e_mail_reader_get_reply_style	(EMailReader *reader);
192 void		e_mail_reader_set_reply_style	(EMailReader *reader,
193 						 EMailReplyStyle style);
194 gboolean	e_mail_reader_get_mark_seen_always
195 						(EMailReader *reader);
196 void		e_mail_reader_set_mark_seen_always
197 						(EMailReader *reader,
198 						 gboolean mark_seen_always);
199 gboolean	e_mail_reader_get_delete_selects_previous
200 						(EMailReader *reader);
201 void		e_mail_reader_set_delete_selects_previous
202 						(EMailReader *reader,
203 						 gboolean delete_selects_previous);
204 void		e_mail_reader_create_charset_menu
205 						(EMailReader *reader,
206 						 GtkUIManager *ui_manager,
207 						 guint merge_id);
208 void		e_mail_reader_show_search_bar	(EMailReader *reader);
209 void		e_mail_reader_avoid_next_mark_as_seen
210 						(EMailReader *reader);
211 void		e_mail_reader_unset_folder_just_selected
212 						(EMailReader *reader);
213 void		e_mail_reader_composer_created	(EMailReader *reader,
214 						 EMsgComposer *composer,
215 						 CamelMimeMessage *message);
216 void		e_mail_reader_reload		(EMailReader *reader);
217 void		e_mail_reader_remove_ui		(EMailReader *reader);
218 
219 G_END_DECLS
220 
221 #endif /* E_MAIL_READER_H */
222