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>
40 /* convenience macros */
41 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
42 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
43 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
44 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
45 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
46 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
51 } ModestMsgViewWindow;
54 ModestWindowClass parent_class;
56 void (*msg_changed) (ModestMsgViewWindow *self,
58 GtkTreeRowReference *row_reference,
60 } ModestMsgViewWindowClass;
63 * modest_msg_view_window_get_type:
65 * get the GType for the #ModestMsgViewWindow class
67 * Returns: a GType for #ModestMsgViewWindow
69 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
73 * modest_msg_view_window_new_for_attachment:
74 * @msg: an #TnyMsg instance
75 * @modest_account_name: the account name
77 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
78 * attachment in another message.
79 * The account name is used to
80 * set the proper account when choosing reply/forward from the msg view window
82 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
84 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
85 const gchar *modest_account_name,
86 const gchar *msg_uid);
89 * modest_msg_view_window_new_with_header_model:
90 * @msg: an #TnyMsg instance
91 * @modest_account_name: the account name
92 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
93 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
95 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
96 * set the proper account when choosing reply/forward from the msg view window.
97 * This constructor also passes a reference to the @model of the header view
98 * to allow selecting previous/next messages in the message list when appropriate.
100 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
102 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
103 const gchar *modest_account_name,
104 const gchar *msg_uid,
106 GtkTreeRowReference *row_reference);
110 * modest_msg_view_window_new_for_search_result:
111 * @msg: an #TnyMsg instance
112 * @modest_account_name: the account name
114 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
115 * set the proper account when choosing reply/forward from the msg view window.
116 * This constructor marks the window as being for a search result, which should
117 * cause some UI to be disabled, such as the previous/next buttons.
119 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
122 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
123 const gchar *modest_account_name,
124 const gchar *msg_uid);
127 * modest_msg_view_window_get_header:
128 * @window: an #ModestMsgViewWindow instance
130 * get the message header in this msg view. Header instance is get
131 * from tree_model of headers list.
133 * Returns: a new #TnyHeader instance, or NULL in case of error
136 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
139 * modest_msg_view_window_get_message:
140 * @window: an #ModestMsgViewWindow instance
142 * get a new reference to the message in this msg view. The caller
143 * must free this new reference
145 * Returns: a new #TnyMsg instance, or NULL in case of error
147 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
150 * modest_msg_view_window_get_message_uid:
151 * @msg: an #ModestMsgViewWindow instance
153 * gets the unique identifier for the message in this msg view. The
154 * returned value *must* not be freed
156 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
158 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
161 * modest_msg_view_window_select_next_message:
162 * @window: a #ModestMsgViewWindow instance
164 * select the next message obtained from the header view this view
167 * Returns: %TRUE if a new message is shown.
169 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
172 * modest_msg_view_window_select_previous_message:
173 * @window: a #ModestMsgViewWindow instance
175 * select the previous message obtained from the header view this view
178 * Returns: %TRUE if a new message is shown.
180 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
183 * modest_msg_view_window_view_attachment:
184 * @window: a #ModestMsgViewWindow
185 * @mime_part: a #TnyMimePart
187 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
188 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
189 * with the contents of the attachment.
191 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
192 TnyMimePart *mime_part);
195 * modest_msg_view_window_get_attachments:
196 * @window: a #ModestMsgViewWindow
198 * Get selected attachments from #ModetMsgView private object.
200 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
203 * modest_msg_view_window_save_attachments:
204 * @window: a #ModestMsgViewWindow
205 * @mime_parts: a #TnyList of #TnyMimePart
207 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
208 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
210 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
211 TnyList *mime_parts);
214 * modest_msg_view_window_remove_attachments:
215 * @window: a #ModestMsgViewWindow
216 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
217 * purges only selected ones.
219 * Removes selected attachments.
221 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
226 * modest_msg_view_window_toolbar_on_transfer_mode:
227 * @window: a #ModestMsgViewWindow
229 * Check if toolbar is in transfer mode, which determines whether a
230 * transfer operation is being processed.
232 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
236 * modest_msg_view_window_last_message_selected:
237 * @window: a #ModestMsgViewWindow
239 * Check message currently viewed is the last message into folder .
241 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
245 * modest_msg_view_window_first_message_selected:
246 * @window: a #ModestMsgViewWindow
248 * Check message currently viewed is the last message into folder .
250 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
253 * modest_msg_view_window_has_headers_model:
254 * @window: a #ModestMsgViewWindow
256 * Check if window has been created with a full headers model.
258 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
261 * modest_msg_view_window_is_search_result:
262 * @window: a #ModestMsgViewWindow
264 * Check if window has been created to show a search result.
266 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
270 * modest_msg_view_window_get_folder_type:
271 * @window: a #ModestMsgViewWindow
273 * Gets folder type of message currently viewed .
276 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
279 * modest_msg_view_window_transfer_mode_enabled:
280 * @window: a #ModestMsgViewWindow
282 * Determines if some transfer operation is in progress.
284 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
287 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
291 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */