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 #include <widgets/modest-window.h>
36 #include <gtk/gtktreemodel.h>
37 #include <gtk/gtkenums.h>
41 /* convenience macros */
42 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
43 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
44 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
45 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
46 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
47 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
52 } ModestMsgViewWindow;
55 ModestWindowClass parent_class;
57 void (*msg_changed) (ModestMsgViewWindow *self,
59 GtkTreeRowReference *row_reference,
62 gboolean (*scroll_child) (ModestMsgViewWindow *self,
63 GtkScrollType scroll_type,
66 } ModestMsgViewWindowClass;
69 * modest_msg_view_window_get_type:
71 * get the GType for the #ModestMsgViewWindow class
73 * Returns: a GType for #ModestMsgViewWindow
75 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
79 * modest_msg_view_window_new_for_attachment:
80 * @msg: an #TnyMsg instance
81 * @modest_account_name: the account name
83 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
84 * attachment in another message.
85 * The account name is used to
86 * set the proper account when choosing reply/forward from the msg view window
88 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
90 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
91 const gchar *modest_account_name,
92 const gchar *msg_uid);
95 * modest_msg_view_window_new_with_header_model:
96 * @msg: an #TnyMsg instance
97 * @modest_account_name: the account name
98 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
99 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
101 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
102 * set the proper account when choosing reply/forward from the msg view window.
103 * This constructor also passes a reference to the @model of the header view
104 * to allow selecting previous/next messages in the message list when appropriate.
106 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
108 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
109 const gchar *modest_account_name,
110 const gchar *msg_uid,
112 GtkTreeRowReference *row_reference);
116 * modest_msg_view_window_new_for_search_result:
117 * @msg: an #TnyMsg instance
118 * @modest_account_name: the account name
120 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
121 * set the proper account when choosing reply/forward from the msg view window.
122 * This constructor marks the window as being for a search result, which should
123 * cause some UI to be disabled, such as the previous/next buttons.
125 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
128 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
129 const gchar *modest_account_name,
130 const gchar *msg_uid);
133 * modest_msg_view_window_get_header:
134 * @window: an #ModestMsgViewWindow instance
136 * get the message header in this msg view. Header instance is get
137 * from tree_model of headers list.
139 * Returns: a new #TnyHeader instance, or NULL in case of error
142 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
145 * modest_msg_view_window_get_message:
146 * @window: an #ModestMsgViewWindow instance
148 * get a new reference to the message in this msg view. The caller
149 * must free this new reference
151 * Returns: a new #TnyMsg instance, or NULL in case of error
153 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
156 * modest_msg_view_window_get_message_uid:
157 * @msg: an #ModestMsgViewWindow instance
159 * gets the unique identifier for the message in this msg view. The
160 * returned value *must* not be freed
162 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
164 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
167 * modest_msg_view_window_select_next_message:
168 * @window: a #ModestMsgViewWindow instance
170 * select the next message obtained from the header view this view
173 * Returns: %TRUE if a new message is shown.
175 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
178 * modest_msg_view_window_select_previous_message:
179 * @window: a #ModestMsgViewWindow instance
181 * select the previous message obtained from the header view this view
184 * Returns: %TRUE if a new message is shown.
186 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
189 * modest_msg_view_window_view_attachment:
190 * @window: a #ModestMsgViewWindow
191 * @mime_part: a #TnyMimePart
193 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
194 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
195 * with the contents of the attachment.
197 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
198 TnyMimePart *mime_part);
201 * modest_msg_view_window_get_attachments:
202 * @window: a #ModestMsgViewWindow
204 * Get selected attachments from #ModetMsgView private object.
206 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
209 * modest_msg_view_window_save_attachments:
210 * @window: a #ModestMsgViewWindow
211 * @mime_parts: a #TnyList of #TnyMimePart
213 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
214 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
216 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
217 TnyList *mime_parts);
220 * modest_msg_view_window_remove_attachments:
221 * @window: a #ModestMsgViewWindow
222 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
223 * purges only selected ones.
225 * Removes selected attachments.
227 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
232 * modest_msg_view_window_toolbar_on_transfer_mode:
233 * @window: a #ModestMsgViewWindow
235 * Check if toolbar is in transfer mode, which determines whether a
236 * transfer operation is being processed.
238 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
242 * modest_msg_view_window_last_message_selected:
243 * @window: a #ModestMsgViewWindow
245 * Check message currently viewed is the last message into folder .
247 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
251 * modest_msg_view_window_first_message_selected:
252 * @window: a #ModestMsgViewWindow
254 * Check message currently viewed is the last message into folder .
256 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
259 * modest_msg_view_window_has_headers_model:
260 * @window: a #ModestMsgViewWindow
262 * Check if window has been created with a full headers model.
264 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
267 * modest_msg_view_window_is_search_result:
268 * @window: a #ModestMsgViewWindow
270 * Check if window has been created to show a search result.
272 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
276 * modest_msg_view_window_get_folder_type:
277 * @window: a #ModestMsgViewWindow
279 * Gets folder type of message currently viewed .
282 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
285 * modest_msg_view_window_transfer_mode_enabled:
286 * @window: a #ModestMsgViewWindow
288 * Determines if some transfer operation is in progress.
290 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
293 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
297 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */