1 /* Copyright (c) 2006, 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_UI_ACTIONS_H__
31 #define __MODEST_UI_ACTIONS_H__
33 #include <widgets/modest-main-window.h>
34 #include <widgets/modest-msg-edit-window.h>
35 #include <widgets/modest-recpt-view.h>
36 #include "modest-mail-operation.h"
37 #include "modest-tny-send-queue.h"
38 #include "modest-plugin-ui-actions.h"
42 /* Menu & toolbar actions */
43 void modest_ui_actions_on_about (GtkAction *action, ModestWindow *win);
45 void modest_ui_actions_refresh_message_window_after_delete (ModestMsgViewWindow* win);
47 void modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win);
49 gboolean modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win);
51 gboolean modest_ui_actions_on_edit_mode_delete_folder (ModestWindow *win);
53 void modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow *win);
55 void modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win);
57 void modest_ui_actions_on_close_window (GtkAction *action, ModestWindow *win);
59 void modest_ui_actions_on_new_account (GtkAction *action, ModestWindow *win);
61 void modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win);
63 void modest_ui_actions_on_smtp_servers (GtkAction *action, ModestWindow *win);
65 void modest_ui_actions_add_to_contacts (GtkAction *action, ModestWindow *win);
66 void modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win);
68 void modest_ui_actions_on_select_contacts (GtkAction *action, ModestMsgEditWindow *win);
70 void modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win);
72 void modest_ui_actions_on_check_names (GtkAction *action, ModestMsgEditWindow *win);
74 void modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win);
76 void modest_ui_actions_on_new_msg_or_folder (GtkAction *action, ModestWindow *win);
78 void modest_ui_actions_on_open (GtkAction *action, ModestWindow *win);
80 void modest_ui_actions_on_reply (GtkAction *action, ModestWindow *win);
82 void modest_ui_actions_reply_calendar (ModestWindow *win, TnyMsg *msg, TnyList *header_pairs);
84 void modest_ui_actions_on_forward (GtkAction *action, ModestWindow *win);
86 void modest_ui_actions_on_sort (GtkAction *action, ModestWindow *window);
88 void modest_ui_actions_on_reply_all (GtkAction *action, ModestWindow *win);
90 void modest_ui_actions_on_next (GtkAction *action, ModestWindow *main_window);
92 void modest_ui_actions_on_prev (GtkAction *action, ModestWindow *main_window);
94 void modest_ui_actions_on_details (GtkAction *action, ModestWindow *win);
96 void modest_ui_actions_on_limit_error (GtkAction *action, ModestWindow *win);
98 gboolean modest_ui_actions_on_edit_mode_move_to (ModestWindow *win);
100 void modest_ui_actions_on_move_to (GtkAction *action, ModestWindow *win);
102 void modest_ui_actions_on_settings (GtkAction *action, ModestWindow *win);
105 * modest_ui_actions_on_help:
106 * @action: a #GtkAction
107 * @win: a #ModestWindow
109 * Shows the help dialog
111 void modest_ui_actions_on_help (GtkAction *action, GtkWindow *win);
115 * modest_ui_actions_on_csm_elp:
116 * @action: a #GtkAction
117 * @win: a #ModestWindow
119 * Shows the help dialog for folder view CSM. It shows the help ID
120 * which refers to the currently selected folder if any
122 void modest_ui_actions_on_csm_help (GtkAction *action, GtkWindow *win);
125 * modest_ui_actions_toggle_folders_view:
126 * @action: the #GtkAction
127 * @main_window: the #ModestMainWindow
129 * this action switches between split view (with a folders pane at the
130 * left) and simple view without the left pane with the folders and
131 * accounts. Maybe it's only useful for Maemo code, but as it uses
132 * generic code could be used also by the GNOME UI
134 void modest_ui_actions_toggle_folders_view (GtkAction *action,
135 ModestMainWindow *main_window);
138 * modest_ui_actions_toggle_folders_view:
139 * @action: the #GtkAction
140 * @main_window: the #ModestMainWindow
142 * this action shows or hides the column titles of the header list
143 * view. It also enables the two lines rendering for the treeview rows
145 void modest_ui_actions_toggle_header_list_view (GtkAction *action,
146 ModestMainWindow *main_window);
149 void modest_ui_actions_on_header_selected (ModestHeaderView *folder_view,
151 ModestMainWindow *main_window);
152 void modest_ui_actions_on_header_activated (ModestHeaderView *folder_view,
155 ModestWindow *main_window);
157 void modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
158 TnyFolderStore *folder_store,
160 ModestMainWindow *main_window);
162 void modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,
164 ModestWindow *window);
166 void modest_ui_actions_on_msg_link_hover (ModestMsgView *msgview, const gchar* link,
169 void modest_ui_actions_on_msg_link_clicked (ModestMsgView *msgview, const gchar* link,
172 void modest_ui_actions_on_msg_link_contextual (ModestMsgView *msgview, const gchar* link,
175 void modest_ui_actions_on_msg_attachment_clicked (ModestMsgView *msgview, TnyMimePart *mime_part,
178 void modest_ui_actions_on_msg_recpt_activated (ModestMsgView *msgview, const gchar *address,
181 gboolean modest_ui_actions_on_send (GtkWidget *widget,
182 ModestMsgEditWindow *edit_window);
183 gboolean modest_ui_actions_on_save_to_drafts (GtkWidget *widget,
184 ModestMsgEditWindow *edit_window);
187 void modest_ui_actions_on_toggle_bold (GtkToggleAction *action,
188 ModestMsgEditWindow *window);
190 void modest_ui_actions_on_toggle_italics (GtkToggleAction *action,
191 ModestMsgEditWindow *window);
193 void modest_ui_actions_on_toggle_bullets (GtkToggleAction *action,
194 ModestMsgEditWindow *window);
196 void modest_ui_actions_on_change_justify (GtkRadioAction *action,
197 GtkRadioAction *selected,
198 ModestMsgEditWindow *window);
200 void modest_ui_actions_on_select_editor_color (GtkAction *action,
201 ModestMsgEditWindow *window);
203 void modest_ui_actions_on_select_editor_background_color (GtkAction *action,
204 ModestMsgEditWindow *window);
206 void modest_ui_actions_on_insert_image (GObject *object,
207 ModestMsgEditWindow *window);
209 void modest_ui_actions_on_attach_file (GtkAction *action,
210 ModestMsgEditWindow *window);
212 void modest_ui_actions_on_remove_attachments (GtkAction *action,
213 ModestMsgEditWindow *window);
214 void modest_ui_actions_on_mark_as_read (GtkAction *action,
215 ModestWindow *window);
217 void modest_ui_actions_on_mark_as_unread (GtkAction *action,
218 ModestWindow *window);
220 void modest_ui_actions_cancel_send (GtkAction *action, ModestWindow *win);
223 * modest_ui_actions_do_send_receive_all:
224 * @win: the window that will be used as source of the refresh mail operation
225 * @force_connection: whether or not the code should try to force a new connection if we're offline
226 * @poke_status: wheter ot not we want to poke the status of all mail folders
227 * @interactive: is coming from an interactive send receive.
229 * Refreshes all the accounts
231 void modest_ui_actions_do_send_receive_all (ModestWindow *win,
232 gboolean force_connection,
233 gboolean poke_status,
234 gboolean interactive);
237 * modest_ui_actions_do_send_receive:
238 * @account_name: the name of the Modest account or NULL
239 * @force_connection: whether or not the code should try to force a new connection if we're offline
240 * @poke_status: wheter ot not we want to poke the status of all mail folders
241 * @interactive: is coming from an interactive send receive
242 * @win: the window that will be used as source of the refresh mail operation
244 * Refreshes the Modest account whose name is passed as argument. If
245 * NULL is passed as #account_name then this function refreses the
246 * active account, if no active account is defined then it picks the
249 void modest_ui_actions_do_send_receive (const gchar *account_name,
250 gboolean force_connection,
251 gboolean poke_status,
252 gboolean interactive,
256 * modest_ui_actions_on_send_receive:
257 * @action: a #GtkAction
258 * @win: the Window that contains the action
260 * Handles the activation of the send receive action, for example
261 * clicks on Send&Receive button in the main toolbar
263 void modest_ui_actions_on_send_receive (GtkAction *action,
266 void modest_ui_actions_on_new_folder (GtkAction *action,
267 ModestWindow *main_window);
269 gboolean modest_ui_actions_on_edit_mode_rename_folder (ModestWindow *window);
271 void modest_ui_actions_on_rename_folder (GtkAction *action,
272 ModestWindow *window);
274 void modest_ui_actions_on_delete_folder (GtkAction *action,
275 ModestWindow *window);
277 void modest_ui_actions_on_move_folder_to_trash_folder (GtkAction *action,
278 ModestMainWindow *main_window);
280 void modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
281 const gchar* server_account_name,
282 gchar **username, gchar **password, gboolean *cancel,
283 gboolean *remember, ModestMainWindow *main_window);
285 void modest_ui_actions_on_undo (GtkAction *action,
286 ModestWindow *window);
288 void modest_ui_actions_on_redo (GtkAction *action,
289 ModestWindow *window);
291 void modest_ui_actions_on_cut (GtkAction *action,
292 ModestWindow *window);
294 void modest_ui_actions_on_copy (GtkAction *action,
295 ModestWindow *window);
297 void modest_ui_actions_on_zoom_plus (GtkAction *action,
298 ModestWindow *window);
300 void modest_ui_actions_on_zoom_minus (GtkAction *action,
301 ModestWindow *window);
303 void modest_ui_actions_on_toggle_fullscreen (GtkToggleAction *toggle,
304 ModestWindow *window);
306 void modest_ui_actions_on_change_fullscreen (GtkAction *action,
307 ModestWindow *window);
309 void modest_ui_actions_on_paste (GtkAction *action,
310 ModestWindow *window);
312 void modest_ui_actions_on_select_all (GtkAction *action,
313 ModestWindow *window);
315 void modest_ui_actions_on_toggle_show_cc (GtkToggleAction *toggle,
316 ModestMsgEditWindow *window);
318 void modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle,
319 ModestMsgEditWindow *window);
321 void modest_ui_actions_on_change_zoom (GtkRadioAction *action,
322 GtkRadioAction *selected,
323 ModestWindow *window);
325 void modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
326 GtkRadioAction *selected,
327 ModestWindow *window);
329 void modest_ui_actions_msg_edit_on_change_file_format (GtkRadioAction *action,
330 GtkRadioAction *selected,
331 ModestWindow *window);
333 void modest_ui_actions_msg_edit_on_select_font (GtkAction *action,
334 ModestMsgEditWindow *window);
337 * modest_ui_actions_on_toggle_toolbar:
341 * Hides/Shows the toolbars of the #ModestWindow instances
343 void modest_ui_actions_on_toggle_toolbar (GtkToggleAction *toggle,
344 ModestWindow *window);
347 * modest_ui_actions_on_folder_display_name_changed:
348 * @folder_view: a #ModestFolderView
349 * @display_name: the new window title
350 * @window: a #GtkWindow
352 * Sets the title of the window to the value specified by
353 * display_name. This function is used typically as a callback to the
354 * "folder-display-name-changed" signal from the #ModestFolderView
356 void modest_ui_actions_on_folder_display_name_changed (ModestFolderView *folder_view,
357 const gchar *display_name,
360 void modest_ui_actions_view_attachment (GtkAction *action,
361 ModestWindow *window);
363 void modest_ui_actions_save_attachments (GtkAction *action,
364 ModestWindow *window);
366 void modest_ui_actions_remove_attachments (GtkAction *action,
367 ModestWindow *window);
370 * modest_ui_actions_on_retrieve_msg_contents:
371 * @action: the #GtkAction
372 * @window: the #ModestWindow that issues the action
374 * Retrieve the contents of the selected messages in the header view
376 void modest_ui_actions_on_retrieve_msg_contents (GtkAction *action,
377 ModestWindow *window);
380 modest_ui_actions_on_email_menu_activated (GtkAction *action,
381 ModestWindow *window);
384 modest_ui_actions_on_edit_menu_activated (GtkAction *action,
385 ModestWindow *window);
388 modest_ui_actions_on_format_menu_activated (GtkAction *action,
389 ModestWindow *window);
392 modest_ui_actions_on_view_menu_activated (GtkAction *action,
393 ModestWindow *window);
396 modest_ui_actions_on_tools_menu_activated (GtkAction *action,
397 ModestWindow *window);
400 modest_ui_actions_on_attachment_menu_activated (GtkAction *action,
401 ModestWindow *window);
404 modest_ui_actions_on_toolbar_csm_menu_activated (GtkAction *action,
405 ModestWindow *window);
408 modest_ui_actions_on_folder_view_csm_menu_activated (GtkAction *action,
409 ModestWindow *window);
412 modest_ui_actions_on_header_view_csm_menu_activated (GtkAction *action,
413 ModestWindow *window);
416 modest_ui_actions_check_toolbar_dimming_rules (ModestWindow *window);
419 modest_ui_actions_check_menu_dimming_rules (ModestWindow *window);
421 /* Dimming rules groups */
422 #define MODEST_DIMMING_RULES_TOOLBAR "ModestToolbarDimmingRules"
423 #define MODEST_DIMMING_RULES_MENU "ModestMenuDimmingRules"
424 #define MODEST_DIMMING_RULES_CLIPBOARD "ModestClipboardDimmingRules"
427 * modest_ui_actions_move_folder_error_handler:
428 * @mail_op: a #ModestMailOperation
429 * @user_data: user data
431 * manages an error in a mail operation that tries to move a folder
433 void modest_ui_actions_move_folder_error_handler (ModestMailOperation *mail_op,
436 * modest_ui_actions_send-receive_error_handler:
437 * @mail_op: a #ModestMailOperation
438 * @user_data: user data
440 * manages an error in a mail operation that tries to execute
441 * a send&receive operation.
443 void modest_ui_actions_send_receive_error_handler (ModestMailOperation *mail_op,
447 * modest_ui_actions_on_search_messages:
448 * @action: a #GtkAction
449 * @window: a #ModestWindow
451 * Shows the search messages dialog
453 void modest_ui_actions_on_search_messages (GtkAction *action,
454 ModestWindow *window);
457 * modest_ui_actions_on_find_in_page:
458 * @action: a #GtkAction
459 * @window: a #ModestWindow
461 * Toggles the visibility of the find in page toolbar
463 void modest_ui_actions_on_toggle_find_in_page (GtkAction *action,
464 ModestWindow *window);
467 * modest_ui_actions_msg_retrieval_check
468 * @mail_op: a #ModestMailOperation
469 * @header: a #TnyHeader
472 * This function checks that the message has been retrieved
473 * successfully. It it was not the case it unregisters the header from
474 * the window manager because it won't do it automatically unless the
477 * Returns: TRUE if the operation was OK, otherwise FALSE
479 gboolean modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
485 * modest_ui_actions_disk_operations_error_handler
486 * @mail_op: a #ModestMailOperation
488 * Error handler for retrieval operations like
489 * modest_mail_operation_get_msg or
490 * modest_mail_operation_get_msgs_full
492 void modest_ui_actions_disk_operations_error_handler (ModestMailOperation *mail_op,
495 /* Show the account creation wizard dialog.
496 * returns: TRUE if an account was created. FALSE if the user cancelled.
498 gboolean modest_ui_actions_run_account_setup_wizard (ModestWindow *win);
500 gint modest_ui_actions_msgs_move_to_confirmation (ModestWindow *win,
501 TnyFolder *dest_folder,
506 * modest_ui_actions_on_send_queue_error_happened:
508 * Method for handling errors in send queues
510 void modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self,
517 * modest_ui_actions_on_send_queue_status_changed:
519 * Method for handling changes in the status of the messages in the send queues
521 void modest_ui_actions_on_send_queue_status_changed (ModestTnySendQueue *send_queue,
527 * modest_ui_actions_compose_msg
528 * @win: Modest main window (can be NULL)
529 * @to_str: "To:" header, or NULL
530 * @cc_str: "Cc:" header, or NULL
531 * @bcc_str: "Bcc:" header, or NULL
532 * @subject_str: Subject of the message, or NULL
533 * @body_str: Body of the message (without signature), or NULL
534 * @attachments: attachments List of file URIs to attach
535 * @set_as_modified: wheter or not the message is set initially as modified or not
537 * Opens a new message editor for composing
539 void modest_ui_actions_compose_msg (ModestWindow *win,
542 const gchar *bcc_str,
543 const gchar *subject_str,
544 const gchar *body_str,
546 gboolean set_as_modified);
548 void modest_ui_actions_on_account_connection_error (GtkWindow *parent_window,
549 TnyAccount *account);
551 gchar *modest_ui_actions_get_msg_already_deleted_error_msg (ModestWindow *win);
553 void modest_ui_actions_transfer_messages_helper (GtkWindow *win,
554 TnyFolder *src_folder,
556 TnyFolder *dst_folder);
558 void modest_ui_actions_on_fetch_images (GtkAction *action,
559 ModestWindow *window);
562 * modest_ui_actions_check_for_active_account:
563 * @win: a #ModestWindow
564 * @account_name: the account name of the account to check
566 * Check whether any connections are active, and cancel them if
569 * Returns: Returns TRUE if there was no problem, or if an operation
570 * was cancelled so we can continue. Returns FALSE if the user chose
571 * to cancel his request instead.
573 gboolean modest_ui_actions_check_for_active_account (ModestWindow *win,
574 const gchar* account_name);
577 #endif /* __MODEST_UI_ACTIONS_H__ */