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 <modest-shell-window.h>
40 #include <widgets/modest-window.h>
41 #include <widgets/modest-header-view.h>
46 /* convenience macros */
47 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
48 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
49 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
50 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
51 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
52 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
56 #ifdef MODEST_TOOLKIT_HILDON2
57 ModestHildon2Window parent;
59 ModestShellWindow parent;
61 } ModestMsgViewWindow;
64 #ifdef MODEST_TOOLKIT_HILDON2
65 ModestHildon2WindowClass parent_class;
67 ModestShellWindowClass parent_class;
70 void (*msg_changed) (ModestMsgViewWindow *self,
72 GtkTreeRowReference *row_reference,
75 gboolean (*scroll_child) (ModestMsgViewWindow *self,
76 GtkScrollType scroll_type,
79 } ModestMsgViewWindowClass;
82 * modest_msg_view_window_get_type:
84 * get the GType for the #ModestMsgViewWindow class
86 * Returns: a GType for #ModestMsgViewWindow
88 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
92 * modest_msg_view_window_new_for_attachment:
93 * @msg: an #TnyMsg instance
94 * @modest_account_name: the account name
95 * @mailbox: the mailbox (if any)
97 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
98 * attachment in another message.
99 * The account name is used to
100 * set the proper account when choosing reply/forward from the msg view window
102 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
104 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
106 const gchar *modest_account_name,
107 const gchar *mailbox,
108 const gchar *msg_uid);
111 * modest_msg_view_window_new_with_other_body:
112 * @msg: an #TnyMsg instance
113 * @modest_account_name: the account name
114 * @mailbox: the mailbox (if any)
116 * instantiates a new #ModestMsgViewWindow widget to view a message that is a different body
117 * in another message.
118 * The account name is used to
119 * set the proper account when choosing reply/forward from the msg view window
121 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
123 ModestWindow* modest_msg_view_window_new_with_other_body (TnyMsg *msg,
124 TnyMimePart *other_body,
126 const gchar *modest_account_name,
127 const gchar *mailbox,
128 const gchar *msg_uid);
131 * modest_msg_view_window_is_other_body:
132 * @self: a #ModestMsgViewWindow
134 * tells if the view window is showing other body
136 * Returns: %TRUE if showing "not first body"
138 gboolean modest_msg_view_window_is_other_body (ModestMsgViewWindow *self);
141 * modest_msg_view_window_new_with_header_model:
142 * @msg: an #TnyMsg instance
143 * @modest_account_name: the account name
144 * @mailbox: the mailbox (if any)
145 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
146 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
148 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
149 * set the proper account when choosing reply/forward from the msg view window.
150 * This constructor also passes a reference to the @model of the header view
151 * to allow selecting previous/next messages in the message list when appropriate.
153 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
155 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
156 const gchar *modest_account_name,
157 const gchar *mailbox,
158 const gchar *msg_uid,
160 GtkTreeRowReference *row_reference);
163 * modest_msg_view_window_new_from_header_view:
164 * @header_view: an #ModestHeaderView instance
165 * @modest_account_name: the account name
166 * @mailbox: the mailbox (if any)
167 * @msg_uid: the initial uid reserved by this window
168 * @row_reference: a #GtkTreeRowReference, pointing to the selected position @model.
170 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
171 * set the proper account when choosing reply/forward from the msg view window.
172 * It's different from new_with_header_model, as it creates the window and then
173 * loads the message in that window.
175 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
177 ModestWindow* modest_msg_view_window_new_from_header_view (ModestHeaderView *header_view,
178 const gchar *modest_account_name,
179 const gchar *mailbox,
180 const gchar *msg_uid,
181 GtkTreeRowReference *row_reference);
185 * modest_msg_view_window_new_from_uid:
188 modest_msg_view_window_new_from_uid (const gchar *modest_account_name,
189 const gchar *mailbox,
190 const gchar *msg_uid);
193 * modest_msg_view_window_new_for_search_result:
194 * @msg: an #TnyMsg instance
195 * @modest_account_name: the account name
197 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
198 * set the proper account when choosing reply/forward from the msg view window.
199 * This constructor marks the window as being for a search result, which should
200 * cause some UI to be disabled, such as the previous/next buttons.
202 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
205 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
206 const gchar *modest_account_name,
207 const gchar *mailbox,
208 const gchar *msg_uid);
211 * modest_msg_view_window_get_header:
212 * @window: an #ModestMsgViewWindow instance
214 * get the message header in this msg view. Header instance is get
215 * from tree_model of headers list.
217 * Returns: a new #TnyHeader instance, or NULL in case of error
220 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
223 * modest_msg_view_window_get_message:
224 * @window: an #ModestMsgViewWindow instance
226 * get a new reference to the message in this msg view. The caller
227 * must free this new reference
229 * Returns: a new #TnyMsg instance, or NULL in case of error
231 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
234 * modest_msg_view_window_get_top_message:
235 * @window: an #ModestMsgViewWindow instance
237 * get a new reference to the parent message of the tree of views. The caller
238 * must free this new reference
240 * Returns: a new #TnyMsg instance, or NULL in case of error
242 TnyMsg* modest_msg_view_window_get_top_message (ModestMsgViewWindow *window);
245 * modest_msg_view_window_get_message_uid:
246 * @msg: an #ModestMsgViewWindow instance
248 * gets the unique identifier for the message in this msg view. The
249 * returned value *must* not be freed
251 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
253 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
256 * modest_msg_view_window_select_next_message:
257 * @window: a #ModestMsgViewWindow instance
259 * select the next message obtained from the header view this view
262 * Returns: %TRUE if a new message is shown.
264 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
267 * modest_msg_view_window_select_previous_message:
268 * @window: a #ModestMsgViewWindow instance
270 * select the previous message obtained from the header view this view
273 * Returns: %TRUE if a new message is shown.
275 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
278 * modest_msg_view_window_view_attachment:
279 * @window: a #ModestMsgViewWindow
280 * @mime_part: a #TnyMimePart
282 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
283 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
284 * with the contents of the attachment.
286 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
287 TnyMimePart *mime_part);
290 * modest_msg_view_window_get_attachments:
291 * @window: a #ModestMsgViewWindow
293 * Get selected attachments from #ModetMsgView private object.
295 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
298 * modest_msg_view_window_save_attachments:
299 * @window: a #ModestMsgViewWindow
300 * @mime_parts: a #TnyList of #TnyMimePart
302 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
303 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
305 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
306 TnyList *mime_parts);
309 * modest_msg_view_window_remove_attachments:
310 * @window: a #ModestMsgViewWindow
311 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
312 * purges only selected ones.
314 * Removes selected attachments.
316 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
321 * modest_msg_view_window_toolbar_on_transfer_mode:
322 * @window: a #ModestMsgViewWindow
324 * Check if toolbar is in transfer mode, which determines whether a
325 * transfer operation is being processed.
327 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
331 * modest_msg_view_window_last_message_selected:
332 * @window: a #ModestMsgViewWindow
334 * Check message currently viewed is the last message into folder .
336 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
340 * modest_msg_view_window_first_message_selected:
341 * @window: a #ModestMsgViewWindow
343 * Check message currently viewed is the last message into folder .
345 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
348 * modest_msg_view_window_has_headers_model:
349 * @window: a #ModestMsgViewWindow
351 * Check if window has been created with a full headers model.
353 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
356 * modest_msg_view_window_is_search_result:
357 * @window: a #ModestMsgViewWindow
359 * Check if window has been created to show a search result.
361 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
365 * modest_msg_view_window_get_folder_type:
366 * @window: a #ModestMsgViewWindow
368 * Gets folder type of message currently viewed .
371 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
374 * modest_msg_view_window_transfer_mode_enabled:
375 * @window: a #ModestMsgViewWindow
377 * Determines if some transfer operation is in progress.
379 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
382 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
385 * modest_msg_view_window_add_to_contacts:
386 * @self: a #ModestMsgViewWindow
388 * activates the add to contacts use case. In Diablo and gnome it gets the
389 * clipboard selection current value and tries to add it to the addressbook.
390 * In fremantle, it shows the add to contacts dialog to select the recipient
394 modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self);
397 * modest_msg_view_window_get_msg_view:
398 * @self: a #ModestMsgViewWindow
400 * Tells that external images should be fetched in this window.
403 modest_msg_view_window_fetch_images (ModestMsgViewWindow *self);
406 * modest_msg_view_window_has_blocked_external_images:
407 * @self: a #ModestMsgViewWindow
409 * checks if the msg currently shown has blocked external images.
411 * Returns: %TRUE if external images are blocked, %FALSE otherwise
413 gboolean modest_msg_view_window_has_blocked_external_images (ModestMsgViewWindow *self);
416 * modest_msg_view_window_reload:
417 * @self: a #ModestMsgViewWindow
419 * Reloads currently loaded message. This is intended to show the message in case it
420 * has some update on the previously visible result.
422 void modest_msg_view_window_reload (ModestMsgViewWindow *self);
426 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */