1 /* Copyright (c) 2006,2007 Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef __MODEST_MSG_VIEW_WINDOW_H__
31 #define __MODEST_MSG_VIEW_WINDOW_H__
34 #include <tny-folder.h>
35 #ifdef MODEST_TOOLKIT_HILDON2
36 #include <modest-hildon2-window.h>
38 #include <widgets/modest-window.h>
39 #include <widgets/modest-header-view.h>
44 /* convenience macros */
45 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
46 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
47 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
48 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
49 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
50 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
54 #ifdef MODEST_TOOLKIT_HILDON2
55 ModestHildon2Window parent;
59 } ModestMsgViewWindow;
62 #ifdef MODEST_TOOLKIT_HILDON2
63 ModestHildon2WindowClass parent_class;
65 ModestWindowClass parent_class;
68 void (*msg_changed) (ModestMsgViewWindow *self,
70 GtkTreeRowReference *row_reference,
73 gboolean (*scroll_child) (ModestMsgViewWindow *self,
74 GtkScrollType scroll_type,
77 } ModestMsgViewWindowClass;
80 * modest_msg_view_window_get_type:
82 * get the GType for the #ModestMsgViewWindow class
84 * Returns: a GType for #ModestMsgViewWindow
86 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
90 * modest_msg_view_window_new_for_attachment:
91 * @msg: an #TnyMsg instance
92 * @modest_account_name: the account name
93 * @mailbox: the mailbox (if any)
95 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
96 * attachment in another message.
97 * The account name is used to
98 * set the proper account when choosing reply/forward from the msg view window
100 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
102 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
103 const gchar *modest_account_name,
104 const gchar *mailbox,
105 const gchar *msg_uid);
108 * modest_msg_view_window_new_with_other_body:
109 * @msg: an #TnyMsg instance
110 * @modest_account_name: the account name
111 * @mailbox: the mailbox (if any)
113 * instantiates a new #ModestMsgViewWindow widget to view a message that is a different body
114 * in another message.
115 * The account name is used to
116 * set the proper account when choosing reply/forward from the msg view window
118 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
120 ModestWindow* modest_msg_view_window_new_with_other_body (TnyMsg *msg,
121 TnyMimePart *other_body,
122 const gchar *modest_account_name,
123 const gchar *mailbox,
124 const gchar *msg_uid);
127 * modest_msg_view_window_is_other_body:
128 * @self: a #ModestMsgViewWindow
130 * tells if the view window is showing other body
132 * Returns: %TRUE if showing "not first body"
134 gboolean modest_msg_view_window_is_other_body (ModestMsgViewWindow *self);
137 * modest_msg_view_window_new_with_header_model:
138 * @msg: an #TnyMsg instance
139 * @modest_account_name: the account name
140 * @mailbox: the mailbox (if any)
141 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
142 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
144 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
145 * set the proper account when choosing reply/forward from the msg view window.
146 * This constructor also passes a reference to the @model of the header view
147 * to allow selecting previous/next messages in the message list when appropriate.
149 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
151 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
152 const gchar *modest_account_name,
153 const gchar *mailbox,
154 const gchar *msg_uid,
156 GtkTreeRowReference *row_reference);
159 * modest_msg_view_window_new_from_header_view:
160 * @header_view: an #ModestHeaderView instance
161 * @modest_account_name: the account name
162 * @mailbox: the mailbox (if any)
163 * @msg_uid: the initial uid reserved by this window
164 * @row_reference: a #GtkTreeRowReference, pointing to the selected position @model.
166 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
167 * set the proper account when choosing reply/forward from the msg view window.
168 * It's different from new_with_header_model, as it creates the window and then
169 * loads the message in that window.
171 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
173 ModestWindow* modest_msg_view_window_new_from_header_view (ModestHeaderView *header_view,
174 const gchar *modest_account_name,
175 const gchar *mailbox,
176 const gchar *msg_uid,
177 GtkTreeRowReference *row_reference);
181 * modest_msg_view_window_new_from_uid:
184 modest_msg_view_window_new_from_uid (const gchar *modest_account_name,
185 const gchar *mailbox,
186 const gchar *msg_uid);
189 * modest_msg_view_window_new_for_search_result:
190 * @msg: an #TnyMsg instance
191 * @modest_account_name: the account name
193 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
194 * set the proper account when choosing reply/forward from the msg view window.
195 * This constructor marks the window as being for a search result, which should
196 * cause some UI to be disabled, such as the previous/next buttons.
198 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
201 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
202 const gchar *modest_account_name,
203 const gchar *mailbox,
204 const gchar *msg_uid);
207 * modest_msg_view_window_get_header:
208 * @window: an #ModestMsgViewWindow instance
210 * get the message header in this msg view. Header instance is get
211 * from tree_model of headers list.
213 * Returns: a new #TnyHeader instance, or NULL in case of error
216 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
219 * modest_msg_view_window_get_message:
220 * @window: an #ModestMsgViewWindow instance
222 * get a new reference to the message in this msg view. The caller
223 * must free this new reference
225 * Returns: a new #TnyMsg instance, or NULL in case of error
227 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
230 * modest_msg_view_window_get_message_uid:
231 * @msg: an #ModestMsgViewWindow instance
233 * gets the unique identifier for the message in this msg view. The
234 * returned value *must* not be freed
236 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
238 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
241 * modest_msg_view_window_select_next_message:
242 * @window: a #ModestMsgViewWindow instance
244 * select the next message obtained from the header view this view
247 * Returns: %TRUE if a new message is shown.
249 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
252 * modest_msg_view_window_select_previous_message:
253 * @window: a #ModestMsgViewWindow instance
255 * select the previous message obtained from the header view this view
258 * Returns: %TRUE if a new message is shown.
260 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
263 * modest_msg_view_window_view_attachment:
264 * @window: a #ModestMsgViewWindow
265 * @mime_part: a #TnyMimePart
267 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
268 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
269 * with the contents of the attachment.
271 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
272 TnyMimePart *mime_part);
275 * modest_msg_view_window_get_attachments:
276 * @window: a #ModestMsgViewWindow
278 * Get selected attachments from #ModetMsgView private object.
280 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
283 * modest_msg_view_window_save_attachments:
284 * @window: a #ModestMsgViewWindow
285 * @mime_parts: a #TnyList of #TnyMimePart
287 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
288 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
290 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
291 TnyList *mime_parts);
294 * modest_msg_view_window_remove_attachments:
295 * @window: a #ModestMsgViewWindow
296 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
297 * purges only selected ones.
299 * Removes selected attachments.
301 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
306 * modest_msg_view_window_toolbar_on_transfer_mode:
307 * @window: a #ModestMsgViewWindow
309 * Check if toolbar is in transfer mode, which determines whether a
310 * transfer operation is being processed.
312 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
316 * modest_msg_view_window_last_message_selected:
317 * @window: a #ModestMsgViewWindow
319 * Check message currently viewed is the last message into folder .
321 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
325 * modest_msg_view_window_first_message_selected:
326 * @window: a #ModestMsgViewWindow
328 * Check message currently viewed is the last message into folder .
330 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
333 * modest_msg_view_window_has_headers_model:
334 * @window: a #ModestMsgViewWindow
336 * Check if window has been created with a full headers model.
338 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
341 * modest_msg_view_window_is_search_result:
342 * @window: a #ModestMsgViewWindow
344 * Check if window has been created to show a search result.
346 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
350 * modest_msg_view_window_get_folder_type:
351 * @window: a #ModestMsgViewWindow
353 * Gets folder type of message currently viewed .
356 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
359 * modest_msg_view_window_transfer_mode_enabled:
360 * @window: a #ModestMsgViewWindow
362 * Determines if some transfer operation is in progress.
364 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
367 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
370 * modest_msg_view_window_add_to_contacts:
371 * @self: a #ModestMsgViewWindow
373 * activates the add to contacts use case. In Diablo and gnome it gets the
374 * clipboard selection current value and tries to add it to the addressbook.
375 * In fremantle, it shows the add to contacts dialog to select the recipient
379 modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self);
382 * modest_msg_view_window_get_msg_view:
383 * @self: a #ModestMsgViewWindow
385 * Tells that external images should be fetched in this window.
388 modest_msg_view_window_fetch_images (ModestMsgViewWindow *self);
391 * modest_msg_view_window_has_blocked_external_images:
392 * @self: a #ModestMsgViewWindow
394 * checks if the msg currently shown has blocked external images.
396 * Returns: %TRUE if external images are blocked, %FALSE otherwise
398 gboolean modest_msg_view_window_has_blocked_external_images (ModestMsgViewWindow *self);
401 * modest_msg_view_window_reload:
402 * @self: a #ModestMsgViewWindow
404 * Reloads currently loaded message. This is intended to show the message in case it
405 * has some update on the previously visible result.
407 void modest_msg_view_window_reload (ModestMsgViewWindow *self);
411 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */