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>
40 #include <gtk/gtktreemodel.h>
41 #include <gtk/gtkenums.h>
45 /* convenience macros */
46 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
47 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
48 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
49 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
50 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
51 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
55 #ifdef MODEST_TOOLKIT_HILDON2
56 ModestHildon2Window parent;
60 } ModestMsgViewWindow;
63 #ifdef MODEST_TOOLKIT_HILDON2
64 ModestHildon2WindowClass parent_class;
66 ModestWindowClass parent_class;
69 void (*msg_changed) (ModestMsgViewWindow *self,
71 GtkTreeRowReference *row_reference,
74 gboolean (*scroll_child) (ModestMsgViewWindow *self,
75 GtkScrollType scroll_type,
78 } ModestMsgViewWindowClass;
81 * modest_msg_view_window_get_type:
83 * get the GType for the #ModestMsgViewWindow class
85 * Returns: a GType for #ModestMsgViewWindow
87 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
91 * modest_msg_view_window_new_for_attachment:
92 * @msg: an #TnyMsg instance
93 * @modest_account_name: the account name
94 * @mailbox: the mailbox (if any)
96 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
97 * attachment in another message.
98 * The account name is used to
99 * set the proper account when choosing reply/forward from the msg view window
101 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
103 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
104 const gchar *modest_account_name,
105 const gchar *mailbox,
106 const gchar *msg_uid);
109 * modest_msg_view_window_new_with_header_model:
110 * @msg: an #TnyMsg instance
111 * @modest_account_name: the account name
112 * @mailbox: the mailbox (if any)
113 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
114 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
116 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
117 * set the proper account when choosing reply/forward from the msg view window.
118 * This constructor also passes a reference to the @model of the header view
119 * to allow selecting previous/next messages in the message list when appropriate.
121 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
123 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
124 const gchar *modest_account_name,
125 const gchar *mailbox,
126 const gchar *msg_uid,
128 GtkTreeRowReference *row_reference);
131 * modest_msg_view_window_new_from_header_view:
132 * @header_view: an #ModestHeaderView instance
133 * @modest_account_name: the account name
134 * @mailbox: the mailbox (if any)
135 * @msg_uid: the initial uid reserved by this window
136 * @row_reference: a #GtkTreeRowReference, pointing to the selected position @model.
138 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
139 * set the proper account when choosing reply/forward from the msg view window.
140 * It's different from new_with_header_model, as it creates the window and then
141 * loads the message in that window.
143 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
145 ModestWindow* modest_msg_view_window_new_from_header_view (ModestHeaderView *header_view,
146 const gchar *modest_account_name,
147 const gchar *mailbox,
148 const gchar *msg_uid,
149 GtkTreeRowReference *row_reference);
153 * modest_msg_view_window_new_for_search_result:
154 * @msg: an #TnyMsg instance
155 * @modest_account_name: the account name
157 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
158 * set the proper account when choosing reply/forward from the msg view window.
159 * This constructor marks the window as being for a search result, which should
160 * cause some UI to be disabled, such as the previous/next buttons.
162 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
165 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
166 const gchar *modest_account_name,
167 const gchar *mailbox,
168 const gchar *msg_uid);
171 * modest_msg_view_window_get_header:
172 * @window: an #ModestMsgViewWindow instance
174 * get the message header in this msg view. Header instance is get
175 * from tree_model of headers list.
177 * Returns: a new #TnyHeader instance, or NULL in case of error
180 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
183 * modest_msg_view_window_get_message:
184 * @window: an #ModestMsgViewWindow instance
186 * get a new reference to the message in this msg view. The caller
187 * must free this new reference
189 * Returns: a new #TnyMsg instance, or NULL in case of error
191 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
194 * modest_msg_view_window_get_message_uid:
195 * @msg: an #ModestMsgViewWindow instance
197 * gets the unique identifier for the message in this msg view. The
198 * returned value *must* not be freed
200 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
202 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
205 * modest_msg_view_window_select_next_message:
206 * @window: a #ModestMsgViewWindow instance
208 * select the next message obtained from the header view this view
211 * Returns: %TRUE if a new message is shown.
213 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
216 * modest_msg_view_window_select_previous_message:
217 * @window: a #ModestMsgViewWindow instance
219 * select the previous message obtained from the header view this view
222 * Returns: %TRUE if a new message is shown.
224 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
227 * modest_msg_view_window_view_attachment:
228 * @window: a #ModestMsgViewWindow
229 * @mime_part: a #TnyMimePart
231 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
232 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
233 * with the contents of the attachment.
235 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
236 TnyMimePart *mime_part);
239 * modest_msg_view_window_get_attachments:
240 * @window: a #ModestMsgViewWindow
242 * Get selected attachments from #ModetMsgView private object.
244 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
247 * modest_msg_view_window_save_attachments:
248 * @window: a #ModestMsgViewWindow
249 * @mime_parts: a #TnyList of #TnyMimePart
251 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
252 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
254 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
255 TnyList *mime_parts);
258 * modest_msg_view_window_remove_attachments:
259 * @window: a #ModestMsgViewWindow
260 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
261 * purges only selected ones.
263 * Removes selected attachments.
265 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
270 * modest_msg_view_window_toolbar_on_transfer_mode:
271 * @window: a #ModestMsgViewWindow
273 * Check if toolbar is in transfer mode, which determines whether a
274 * transfer operation is being processed.
276 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
280 * modest_msg_view_window_last_message_selected:
281 * @window: a #ModestMsgViewWindow
283 * Check message currently viewed is the last message into folder .
285 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
289 * modest_msg_view_window_first_message_selected:
290 * @window: a #ModestMsgViewWindow
292 * Check message currently viewed is the last message into folder .
294 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
297 * modest_msg_view_window_has_headers_model:
298 * @window: a #ModestMsgViewWindow
300 * Check if window has been created with a full headers model.
302 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
305 * modest_msg_view_window_is_search_result:
306 * @window: a #ModestMsgViewWindow
308 * Check if window has been created to show a search result.
310 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
314 * modest_msg_view_window_get_folder_type:
315 * @window: a #ModestMsgViewWindow
317 * Gets folder type of message currently viewed .
320 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
323 * modest_msg_view_window_transfer_mode_enabled:
324 * @window: a #ModestMsgViewWindow
326 * Determines if some transfer operation is in progress.
328 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
331 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
334 * modest_msg_view_window_add_to_contacts:
335 * @self: a #ModestMsgViewWindow
337 * activates the add to contacts use case. In Diablo and gnome it gets the
338 * clipboard selection current value and tries to add it to the addressbook.
339 * In fremantle, it shows the add to contacts dialog to select the recipient
343 modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self);
346 * modest_msg_view_window_get_msg_view:
347 * @self: a #ModestMsgViewWindow
349 * Tells that external images should be fetched in this window.
352 modest_msg_view_window_fetch_images (ModestMsgViewWindow *self);
355 * modest_msg_view_window_has_blocked_external_images:
356 * @self: a #ModestMsgViewWindow
358 * checks if the msg currently shown has blocked external images.
360 * Returns: %TRUE if external images are blocked, %FALSE otherwise
362 gboolean modest_msg_view_window_has_blocked_external_images (ModestMsgViewWindow *self);
365 * modest_msg_view_window_reload:
366 * @self: a #ModestMsgViewWindow
368 * Reloads currently loaded message. This is intended to show the message in case it
369 * has some update on the previously visible result.
371 void modest_msg_view_window_reload (ModestMsgViewWindow *self);
375 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */