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-msg-edit-window.h>
34 #include <widgets/modest-msg-view-window.h>
35 #include <widgets/modest-msg-view.h>
36 #include <widgets/modest-recpt-view.h>
37 #include <widgets/modest-folder-view.h>
38 #include <widgets/modest-header-view.h>
39 #include "modest-mail-operation.h"
40 #include "modest-tny-send-queue.h"
41 #include "modest-plugin-ui-actions.h"
45 /* Menu & toolbar actions */
46 void modest_ui_actions_on_about (GtkAction *action, ModestWindow *win);
48 void modest_ui_actions_refresh_message_window_after_delete (ModestMsgViewWindow* win);
50 void modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win);
52 gboolean modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win);
54 gboolean modest_ui_actions_on_edit_mode_delete_folder (ModestWindow *win);
56 void modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow *win);
58 void modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win);
60 void modest_ui_actions_on_close_window (GtkAction *action, ModestWindow *win);
62 void modest_ui_actions_on_new_account (GtkAction *action, ModestWindow *win);
64 void modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win);
66 void modest_ui_actions_on_smtp_servers (GtkAction *action, ModestWindow *win);
68 void modest_ui_actions_add_to_contacts (GtkAction *action, ModestWindow *win);
69 void modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win);
71 void modest_ui_actions_on_select_contacts (GtkAction *action, ModestMsgEditWindow *win);
73 void modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win);
75 void modest_ui_actions_on_check_names (GtkAction *action, ModestMsgEditWindow *win);
77 void modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win);
79 void modest_ui_actions_on_new_msg_or_folder (GtkAction *action, ModestWindow *win);
81 void modest_ui_actions_on_open (GtkAction *action, ModestWindow *win);
83 void modest_ui_actions_on_reply (GtkAction *action, ModestWindow *win);
85 void modest_ui_actions_on_forward (GtkAction *action, ModestWindow *win);
87 void modest_ui_actions_on_sort (GtkAction *action, ModestWindow *window);
89 void modest_ui_actions_on_reply_all (GtkAction *action, ModestWindow *win);
91 void modest_ui_actions_on_next (GtkAction *action, ModestWindow *window);
93 void modest_ui_actions_on_prev (GtkAction *action, ModestWindow *window);
95 void modest_ui_actions_on_details (GtkAction *action, ModestWindow *win);
97 void modest_ui_actions_on_limit_error (GtkAction *action, ModestWindow *win);
99 gboolean modest_ui_actions_on_edit_mode_move_to (ModestWindow *win);
101 void modest_ui_actions_on_move_to (GtkAction *action, ModestWindow *win);
103 void modest_ui_actions_on_settings (GtkAction *action, ModestWindow *win);
106 * modest_ui_actions_on_help:
107 * @action: a #GtkAction
108 * @win: a #ModestWindow
110 * Shows the help dialog
112 void modest_ui_actions_on_help (GtkAction *action, GtkWindow *win);
116 * modest_ui_actions_on_csm_elp:
117 * @action: a #GtkAction
118 * @win: a #ModestWindow
120 * Shows the help dialog for folder view CSM. It shows the help ID
121 * which refers to the currently selected folder if any
123 void modest_ui_actions_on_csm_help (GtkAction *action, GtkWindow *win);
125 #ifndef MODEST_TOOLKIT_HILDON2
127 * modest_ui_actions_toggle_folders_view:
128 * @action: the #GtkAction
129 * @window: the #ModestWindow
131 * this action switches between split view (with a folders pane at the
132 * left) and simple view without the left pane with the folders and
133 * accounts. Maybe it's only useful for Maemo code, but as it uses
134 * generic code could be used also by the GNOME UI
136 void modest_ui_actions_toggle_folders_view (GtkAction *action,
137 ModestWindow *window);
140 * modest_ui_actions_toggle_folders_view:
141 * @action: the #GtkAction
142 * @window: the #ModestWindow
144 * this action shows or hides the column titles of the header list
145 * view. It also enables the two lines rendering for the treeview rows
147 void modest_ui_actions_toggle_header_list_view (GtkAction *action,
148 ModestWindow *window);
151 void modest_ui_actions_on_header_selected (ModestHeaderView *folder_view,
153 ModestWindow *window);
155 void modest_ui_actions_on_header_activated (ModestHeaderView *folder_view,
158 ModestWindow *window);
160 #ifndef MODEST_TOOLKIT_HILDON2
161 void modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
162 TnyFolderStore *folder_store,
164 ModestWindow *window);
167 void modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,
169 ModestWindow *window);
171 void modest_ui_actions_on_msg_link_hover (ModestMsgView *msgview, const gchar* link,
174 void modest_ui_actions_on_msg_link_clicked (ModestMsgView *msgview, const gchar* link,
177 void modest_ui_actions_on_msg_link_contextual (ModestMsgView *msgview, const gchar* link,
180 void modest_ui_actions_on_msg_attachment_clicked (ModestMsgView *msgview, TnyMimePart *mime_part,
183 void modest_ui_actions_on_msg_recpt_activated (ModestMsgView *msgview, const gchar *address,
186 gboolean modest_ui_actions_on_send (GtkWidget *widget,
187 ModestMsgEditWindow *edit_window);
188 gboolean modest_ui_actions_on_save_to_drafts (GtkWidget *widget,
189 ModestMsgEditWindow *edit_window);
192 void modest_ui_actions_on_toggle_bold (GtkToggleAction *action,
193 ModestMsgEditWindow *window);
195 void modest_ui_actions_on_toggle_italics (GtkToggleAction *action,
196 ModestMsgEditWindow *window);
198 void modest_ui_actions_on_toggle_bullets (GtkToggleAction *action,
199 ModestMsgEditWindow *window);
201 void modest_ui_actions_on_change_justify (GtkRadioAction *action,
202 GtkRadioAction *selected,
203 ModestMsgEditWindow *window);
205 void modest_ui_actions_on_select_editor_color (GtkAction *action,
206 ModestMsgEditWindow *window);
208 void modest_ui_actions_on_select_editor_background_color (GtkAction *action,
209 ModestMsgEditWindow *window);
211 void modest_ui_actions_on_insert_image (GObject *object,
212 ModestMsgEditWindow *window);
214 void modest_ui_actions_on_attach_file (GtkAction *action,
215 ModestMsgEditWindow *window);
217 void modest_ui_actions_on_remove_attachments (GtkAction *action,
218 ModestMsgEditWindow *window);
219 void modest_ui_actions_on_mark_as_read (GtkAction *action,
220 ModestWindow *window);
222 void modest_ui_actions_on_mark_as_unread (GtkAction *action,
223 ModestWindow *window);
225 void modest_ui_actions_cancel_send (GtkAction *action, ModestWindow *win);
228 * modest_ui_actions_do_send_receive_all:
229 * @win: the window that will be used as source of the refresh mail operation
230 * @force_connection: whether or not the code should try to force a new connection if we're offline
231 * @poke_status: wheter ot not we want to poke the status of all mail folders
232 * @interactive: is coming from an interactive send receive.
234 * Refreshes all the accounts
236 void modest_ui_actions_do_send_receive_all (ModestWindow *win,
237 gboolean force_connection,
238 gboolean poke_status,
239 gboolean interactive);
242 * modest_ui_actions_do_send_receive:
243 * @account_name: the name of the Modest account or NULL
244 * @force_connection: whether or not the code should try to force a new connection if we're offline
245 * @poke_status: wheter ot not we want to poke the status of all mail folders
246 * @interactive: is coming from an interactive send receive
247 * @win: the window that will be used as source of the refresh mail operation
249 * Refreshes the Modest account whose name is passed as argument. If
250 * NULL is passed as #account_name then this function refreses the
251 * active account, if no active account is defined then it picks the
254 void modest_ui_actions_do_send_receive (const gchar *account_name,
255 gboolean force_connection,
256 gboolean poke_status,
257 gboolean interactive,
261 * modest_ui_actions_on_send_receive:
262 * @action: a #GtkAction
263 * @win: the Window that contains the action
265 * Handles the activation of the send receive action, for example
266 * clicks on Send&Receive button in the main toolbar
268 void modest_ui_actions_on_send_receive (GtkAction *action,
271 void modest_ui_actions_on_new_folder (GtkAction *action,
272 ModestWindow *window);
274 gboolean modest_ui_actions_on_edit_mode_rename_folder (ModestWindow *window);
276 void modest_ui_actions_on_rename_folder (GtkAction *action,
277 ModestWindow *window);
279 void modest_ui_actions_on_delete_folder (GtkAction *action,
280 ModestWindow *window);
282 #ifndef MODEST_TOOLKIT_HILDON2
283 void modest_ui_actions_on_move_folder_to_trash_folder (GtkAction *action,
284 ModestWindow *window);
287 void modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
288 const gchar* server_account_name,
289 gchar **username, gchar **password, gboolean *cancel,
290 gboolean *remember, ModestWindow *window);
292 void modest_ui_actions_on_undo (GtkAction *action,
293 ModestWindow *window);
295 void modest_ui_actions_on_redo (GtkAction *action,
296 ModestWindow *window);
298 void modest_ui_actions_on_cut (GtkAction *action,
299 ModestWindow *window);
301 void modest_ui_actions_on_copy (GtkAction *action,
302 ModestWindow *window);
304 void modest_ui_actions_on_zoom_plus (GtkAction *action,
305 ModestWindow *window);
307 void modest_ui_actions_on_zoom_minus (GtkAction *action,
308 ModestWindow *window);
310 void modest_ui_actions_on_toggle_fullscreen (GtkToggleAction *toggle,
311 ModestWindow *window);
313 void modest_ui_actions_on_change_fullscreen (GtkAction *action,
314 ModestWindow *window);
316 void modest_ui_actions_on_paste (GtkAction *action,
317 ModestWindow *window);
319 void modest_ui_actions_on_select_all (GtkAction *action,
320 ModestWindow *window);
322 void modest_ui_actions_on_toggle_show_cc (GtkToggleAction *toggle,
323 ModestMsgEditWindow *window);
325 void modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle,
326 ModestMsgEditWindow *window);
328 void modest_ui_actions_on_change_zoom (GtkRadioAction *action,
329 GtkRadioAction *selected,
330 ModestWindow *window);
332 void modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
333 GtkRadioAction *selected,
334 ModestWindow *window);
336 void modest_ui_actions_msg_edit_on_change_file_format (GtkRadioAction *action,
337 GtkRadioAction *selected,
338 ModestWindow *window);
340 void modest_ui_actions_msg_edit_on_select_font (GtkAction *action,
341 ModestMsgEditWindow *window);
344 * modest_ui_actions_on_toggle_toolbar:
348 * Hides/Shows the toolbars of the #ModestWindow instances
350 void modest_ui_actions_on_toggle_toolbar (GtkToggleAction *toggle,
351 ModestWindow *window);
354 * modest_ui_actions_on_folder_display_name_changed:
355 * @folder_view: a #ModestFolderView
356 * @display_name: the new window title
357 * @window: a #GtkWindow
359 * Sets the title of the window to the value specified by
360 * display_name. This function is used typically as a callback to the
361 * "folder-display-name-changed" signal from the #ModestFolderView
363 void modest_ui_actions_on_folder_display_name_changed (ModestFolderView *folder_view,
364 const gchar *display_name,
367 void modest_ui_actions_view_attachment (GtkAction *action,
368 ModestWindow *window);
370 void modest_ui_actions_save_attachments (GtkAction *action,
371 ModestWindow *window);
373 void modest_ui_actions_remove_attachments (GtkAction *action,
374 ModestWindow *window);
377 * modest_ui_actions_on_retrieve_msg_contents:
378 * @action: the #GtkAction
379 * @window: the #ModestWindow that issues the action
381 * Retrieve the contents of the selected messages in the header view
383 void modest_ui_actions_on_retrieve_msg_contents (GtkAction *action,
384 ModestWindow *window);
387 modest_ui_actions_on_email_menu_activated (GtkAction *action,
388 ModestWindow *window);
391 modest_ui_actions_on_edit_menu_activated (GtkAction *action,
392 ModestWindow *window);
395 modest_ui_actions_on_format_menu_activated (GtkAction *action,
396 ModestWindow *window);
399 modest_ui_actions_on_view_menu_activated (GtkAction *action,
400 ModestWindow *window);
403 modest_ui_actions_on_tools_menu_activated (GtkAction *action,
404 ModestWindow *window);
407 modest_ui_actions_on_attachment_menu_activated (GtkAction *action,
408 ModestWindow *window);
411 modest_ui_actions_on_toolbar_csm_menu_activated (GtkAction *action,
412 ModestWindow *window);
415 modest_ui_actions_on_folder_view_csm_menu_activated (GtkAction *action,
416 ModestWindow *window);
419 modest_ui_actions_on_header_view_csm_menu_activated (GtkAction *action,
420 ModestWindow *window);
423 modest_ui_actions_check_toolbar_dimming_rules (ModestWindow *window);
426 modest_ui_actions_check_menu_dimming_rules (ModestWindow *window);
428 /* Dimming rules groups */
429 #define MODEST_DIMMING_RULES_TOOLBAR "ModestToolbarDimmingRules"
430 #define MODEST_DIMMING_RULES_MENU "ModestMenuDimmingRules"
431 #define MODEST_DIMMING_RULES_CLIPBOARD "ModestClipboardDimmingRules"
434 * modest_ui_actions_move_folder_error_handler:
435 * @mail_op: a #ModestMailOperation
436 * @user_data: user data
438 * manages an error in a mail operation that tries to move a folder
440 void modest_ui_actions_move_folder_error_handler (ModestMailOperation *mail_op,
443 * modest_ui_actions_send-receive_error_handler:
444 * @mail_op: a #ModestMailOperation
445 * @user_data: user data
447 * manages an error in a mail operation that tries to execute
448 * a send&receive operation.
450 void modest_ui_actions_send_receive_error_handler (ModestMailOperation *mail_op,
454 * modest_ui_actions_on_search_messages:
455 * @action: a #GtkAction
456 * @window: a #ModestWindow
458 * Shows the search messages dialog
460 void modest_ui_actions_on_search_messages (GtkAction *action,
461 ModestWindow *window);
464 * modest_ui_actions_on_find_in_page:
465 * @action: a #GtkAction
466 * @window: a #ModestWindow
468 * Toggles the visibility of the find in page toolbar
470 void modest_ui_actions_on_toggle_find_in_page (GtkAction *action,
471 ModestWindow *window);
474 * modest_ui_actions_msg_retrieval_check
475 * @mail_op: a #ModestMailOperation
476 * @header: a #TnyHeader
479 * This function checks that the message has been retrieved
480 * successfully. It it was not the case it unregisters the header from
481 * the window manager because it won't do it automatically unless the
484 * Returns: TRUE if the operation was OK, otherwise FALSE
486 gboolean modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
492 * modest_ui_actions_disk_operations_error_handler
493 * @mail_op: a #ModestMailOperation
495 * Error handler for retrieval operations like
496 * modest_mail_operation_get_msg or
497 * modest_mail_operation_get_msgs_full
499 void modest_ui_actions_disk_operations_error_handler (ModestMailOperation *mail_op,
502 /* Show the account creation wizard dialog.
503 * returns: TRUE if an account was created. FALSE if the user cancelled.
505 gboolean modest_ui_actions_run_account_setup_wizard (ModestWindow *win);
507 gint modest_ui_actions_msgs_move_to_confirmation (ModestWindow *win,
508 TnyFolder *dest_folder,
513 * modest_ui_actions_on_send_queue_error_happened:
515 * Method for handling errors in send queues
517 void modest_ui_actions_on_send_queue_error_happened (TnySendQueue *self,
524 * modest_ui_actions_on_send_queue_status_changed:
526 * Method for handling changes in the status of the messages in the send queues
528 void modest_ui_actions_on_send_queue_status_changed (ModestTnySendQueue *send_queue,
534 * modest_ui_actions_compose_msg
535 * @win: Modest main window (can be NULL)
536 * @to_str: "To:" header, or NULL
537 * @cc_str: "Cc:" header, or NULL
538 * @bcc_str: "Bcc:" header, or NULL
539 * @subject_str: Subject of the message, or NULL
540 * @body_str: Body of the message (without signature), or NULL
541 * @attachments: attachments List of file URIs to attach
542 * @set_as_modified: wheter or not the message is set initially as modified or not
544 * Opens a new message editor for composing
546 void modest_ui_actions_compose_msg (ModestWindow *win,
549 const gchar *bcc_str,
550 const gchar *subject_str,
551 const gchar *body_str,
553 gboolean set_as_modified);
555 void modest_ui_actions_on_account_connection_error (ModestWindow *parent_window,
556 TnyAccount *account);
558 gchar *modest_ui_actions_get_msg_already_deleted_error_msg (ModestWindow *win);
560 void modest_ui_actions_transfer_messages_helper (ModestWindow *win,
561 TnyFolder *src_folder,
563 TnyFolder *dst_folder);
565 void modest_ui_actions_on_fetch_images (GtkAction *action,
566 ModestWindow *window);
569 * modest_ui_actions_check_for_active_account:
570 * @win: a #ModestWindow
571 * @account_name: the account name of the account to check
573 * Check whether any connections are active, and cancel them if
576 * Returns: Returns TRUE if there was no problem, or if an operation
577 * was cancelled so we can continue. Returns FALSE if the user chose
578 * to cancel his request instead.
580 gboolean modest_ui_actions_check_for_active_account (ModestWindow *win,
581 const gchar* account_name);
584 #endif /* __MODEST_UI_ACTIONS_H__ */