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 <widgets/modest-header-view.h>
37 #include <gtk/gtktreemodel.h>
38 #include <gtk/gtkenums.h>
42 /* convenience macros */
43 #define MODEST_TYPE_MSG_VIEW_WINDOW (modest_msg_view_window_get_type())
44 #define MODEST_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgViewWindow))
45 #define MODEST_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MSG_VIEW_WINDOW,ModestWindow))
46 #define MODEST_IS_MSG_VIEW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MSG_VIEW_WINDOW))
47 #define MODEST_IS_MSG_VIEW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MSG_VIEW_WINDOW))
48 #define MODEST_MSG_VIEW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MSG_VIEW_WINDOW,ModestMsgVIewWindowClass))
53 } ModestMsgViewWindow;
56 ModestWindowClass parent_class;
58 void (*msg_changed) (ModestMsgViewWindow *self,
60 GtkTreeRowReference *row_reference,
63 gboolean (*scroll_child) (ModestMsgViewWindow *self,
64 GtkScrollType scroll_type,
67 } ModestMsgViewWindowClass;
70 * modest_msg_view_window_get_type:
72 * get the GType for the #ModestMsgViewWindow class
74 * Returns: a GType for #ModestMsgViewWindow
76 GType modest_msg_view_window_get_type (void) G_GNUC_CONST;
80 * modest_msg_view_window_new_for_attachment:
81 * @msg: an #TnyMsg instance
82 * @modest_account_name: the account name
84 * instantiates a new #ModestMsgViewWindow widget to view a message that is an
85 * attachment in another message.
86 * The account name is used to
87 * set the proper account when choosing reply/forward from the msg view window
89 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
91 ModestWindow* modest_msg_view_window_new_for_attachment (TnyMsg *msg,
92 const gchar *modest_account_name,
93 const gchar *msg_uid);
96 * modest_msg_view_window_new_with_header_model:
97 * @msg: an #TnyMsg instance
98 * @modest_account_name: the account name
99 * @model: a #GtkTreeModel, with the format used by #ModestHeaderView
100 * @row_reference: a #GtkTreeRowReference, pointing to the position of @msg in @model.
102 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
103 * set the proper account when choosing reply/forward from the msg view window.
104 * This constructor also passes a reference to the @model of the header view
105 * to allow selecting previous/next messages in the message list when appropriate.
107 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
109 ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg,
110 const gchar *modest_account_name,
111 const gchar *msg_uid,
113 GtkTreeRowReference *row_reference);
116 * modest_msg_view_window_new_from_header_view:
117 * @header_view: an #ModestHeaderView instance
118 * @modest_account_name: the account name
119 * @msg_uid: the initial uid reserved by this window
120 * @row_reference: a #GtkTreeRowReference, pointing to the selected position @model.
122 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
123 * set the proper account when choosing reply/forward from the msg view window.
124 * It's different from new_with_header_model, as it creates the window and then
125 * loads the message in that window.
127 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
129 ModestWindow* modest_msg_view_window_new_from_header_view (ModestHeaderView *header_view,
130 const gchar *modest_account_name,
131 const gchar *msg_uid,
132 GtkTreeRowReference *row_reference);
136 * modest_msg_view_window_new_for_search_result:
137 * @msg: an #TnyMsg instance
138 * @modest_account_name: the account name
140 * instantiates a new #ModestMsgViewWindow widget. The account name is used to
141 * set the proper account when choosing reply/forward from the msg view window.
142 * This constructor marks the window as being for a search result, which should
143 * cause some UI to be disabled, such as the previous/next buttons.
145 * Returns: a new #ModestMsgViewWindow, or NULL in case of error
148 modest_msg_view_window_new_for_search_result (TnyMsg *msg,
149 const gchar *modest_account_name,
150 const gchar *msg_uid);
153 * modest_msg_view_window_get_header:
154 * @window: an #ModestMsgViewWindow instance
156 * get the message header in this msg view. Header instance is get
157 * from tree_model of headers list.
159 * Returns: a new #TnyHeader instance, or NULL in case of error
162 modest_msg_view_window_get_header (ModestMsgViewWindow *self);
165 * modest_msg_view_window_get_message:
166 * @window: an #ModestMsgViewWindow instance
168 * get a new reference to the message in this msg view. The caller
169 * must free this new reference
171 * Returns: a new #TnyMsg instance, or NULL in case of error
173 TnyMsg* modest_msg_view_window_get_message (ModestMsgViewWindow *window);
176 * modest_msg_view_window_get_message_uid:
177 * @msg: an #ModestMsgViewWindow instance
179 * gets the unique identifier for the message in this msg view. The
180 * returned value *must* not be freed
182 * Returns: the id of the #TnyMsg being shown, or NULL in case of error
184 const gchar* modest_msg_view_window_get_message_uid (ModestMsgViewWindow *window);
187 * modest_msg_view_window_select_next_message:
188 * @window: a #ModestMsgViewWindow instance
190 * select the next message obtained from the header view this view
193 * Returns: %TRUE if a new message is shown.
195 gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow *window);
198 * modest_msg_view_window_select_previous_message:
199 * @window: a #ModestMsgViewWindow instance
201 * select the previous message obtained from the header view this view
204 * Returns: %TRUE if a new message is shown.
206 gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
209 * modest_msg_view_window_view_attachment:
210 * @window: a #ModestMsgViewWindow
211 * @mime_part: a #TnyMimePart
213 * Opens @mime_part, or the currently selected attachment if @mime_part is %NULL.
214 * If it's a message, it opens it for viewing. Otherwise it opens a temporary file
215 * with the contents of the attachment.
217 void modest_msg_view_window_view_attachment (ModestMsgViewWindow *window,
218 TnyMimePart *mime_part);
221 * modest_msg_view_window_get_attachments:
222 * @window: a #ModestMsgViewWindow
224 * Get selected attachments from #ModetMsgView private object.
226 TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win);
229 * modest_msg_view_window_save_attachments:
230 * @window: a #ModestMsgViewWindow
231 * @mime_parts: a #TnyList of #TnyMimePart
233 * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments
234 * if @mime_parts is %NULL, offering a dialog to the user to choose the location.
236 void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window,
237 TnyList *mime_parts);
240 * modest_msg_view_window_remove_attachments:
241 * @window: a #ModestMsgViewWindow
242 * @get_all: a #gboolean. If %TRUE, purges all attachmnents, if %FALSE,
243 * purges only selected ones.
245 * Removes selected attachments.
247 void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window,
252 * modest_msg_view_window_toolbar_on_transfer_mode:
253 * @window: a #ModestMsgViewWindow
255 * Check if toolbar is in transfer mode, which determines whether a
256 * transfer operation is being processed.
258 gboolean modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self);
262 * modest_msg_view_window_last_message_selected:
263 * @window: a #ModestMsgViewWindow
265 * Check message currently viewed is the last message into folder .
267 gboolean modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window);
271 * modest_msg_view_window_first_message_selected:
272 * @window: a #ModestMsgViewWindow
274 * Check message currently viewed is the last message into folder .
276 gboolean modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window);
279 * modest_msg_view_window_has_headers_model:
280 * @window: a #ModestMsgViewWindow
282 * Check if window has been created with a full headers model.
284 gboolean modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window);
287 * modest_msg_view_window_is_search_result:
288 * @window: a #ModestMsgViewWindow
290 * Check if window has been created to show a search result.
292 gboolean modest_msg_view_window_is_search_result (ModestMsgViewWindow *window);
296 * modest_msg_view_window_get_folder_type:
297 * @window: a #ModestMsgViewWindow
299 * Gets folder type of message currently viewed .
302 modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window);
305 * modest_msg_view_window_transfer_mode_enabled:
306 * @window: a #ModestMsgViewWindow
308 * Determines if some transfer operation is in progress.
310 * Returns: TRUE if transfer mode is enabled, FASE otherwise.
313 modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self);
316 * modest_msg_view_window_add_to_contacts:
317 * @self: a #ModestMsgViewWindow
319 * activates the add to contacts use case. In Diablo and gnome it gets the
320 * clipboard selection current value and tries to add it to the addressbook.
321 * In fremantle, it shows the add to contacts dialog to select the recipient
325 modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self);
329 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */