diff options
-rw-r--r-- | mail/mail-send-recv.c | 26 | ||||
-rw-r--r-- | mail/mail-send-recv.h | 3 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 20 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 68 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.h | 8 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 357 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.h | 15 | ||||
-rw-r--r-- | shell/e-shell-view.c | 1 | ||||
-rw-r--r-- | shell/e-shell-window-actions.c | 27 | ||||
-rw-r--r-- | shell/e-shell-window-actions.h | 2 | ||||
-rw-r--r-- | shell/e-shell-window-private.c | 7 | ||||
-rw-r--r-- | shell/e-shell.c | 36 | ||||
-rw-r--r-- | shell/e-shell.h | 4 | ||||
-rw-r--r-- | shell/test/e-test-shell-backend.c | 12 | ||||
-rw-r--r-- | ui/evolution-calendars.ui | 7 | ||||
-rw-r--r-- | ui/evolution-contacts.ui | 7 | ||||
-rw-r--r-- | ui/evolution-mail.ui | 4 | ||||
-rw-r--r-- | ui/evolution-memos.ui | 9 | ||||
-rw-r--r-- | ui/evolution-tasks.ui | 9 |
19 files changed, 472 insertions, 150 deletions
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index ff3eb6363f..cdcce0455d 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -409,7 +409,8 @@ build_dialog (GtkWindow *parent, EMailSession *session, EAccountList *accounts, CamelFolder *outbox, - const gchar *destination) + const gchar *destination, + gboolean allow_send) { GtkDialog *gd; GtkWidget *table; @@ -534,7 +535,7 @@ build_dialog (GtkWindow *parent, info->uri = g_strdup (source->url); info->keep_on_server = source->keep_on_server; info->cancellable = camel_operation_new (); - info->state = SEND_ACTIVE; + info->state = allow_send ? SEND_ACTIVE : SEND_COMPLETE; info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); g_signal_connect ( @@ -612,7 +613,7 @@ build_dialog (GtkWindow *parent, (EEventTarget *) target); /* Skip displaying the SMTP row if we've got no outbox, destination or unsent mails */ - if (outbox && destination + if (allow_send && outbox && destination && (camel_folder_get_message_count (outbox) - camel_folder_get_deleted_message_count (outbox)) != 0) { info = g_hash_table_lookup (data->active, SEND_URI_KEY); @@ -1009,9 +1010,8 @@ receive_update_got_store (gchar *uri, CamelStore *store, gpointer data) } } -GtkWidget * -mail_send_receive (GtkWindow *parent, - EMailSession *session) +static GtkWidget * +send_receive (GtkWindow *parent, EMailSession *session, gboolean allow_send) { CamelFolder *local_outbox; struct _send_data *data; @@ -1038,7 +1038,7 @@ mail_send_receive (GtkWindow *parent, local_outbox = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX); data = build_dialog ( parent, session, accounts, - local_outbox, account->transport->url); + local_outbox, account->transport->url, allow_send); scan = data->infos; while (scan) { struct _send_info *info = scan->data; @@ -1078,6 +1078,18 @@ mail_send_receive (GtkWindow *parent, return send_recv_dialog; } +GtkWidget * +mail_send_receive (GtkWindow *parent, EMailSession *session) +{ + return send_receive (parent, session, TRUE); +} + +GtkWidget * +mail_receive (GtkWindow *parent, EMailSession *session) +{ + return send_receive (parent, session, FALSE); +} + struct _auto_data { EAccount *account; EMailSession *session; diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h index 67b0647fc7..7ae0dd11d5 100644 --- a/mail/mail-send-recv.h +++ b/mail/mail-send-recv.h @@ -33,6 +33,9 @@ G_BEGIN_DECLS GtkWidget * mail_send_receive (GtkWindow *parent, EMailSession *session); +GtkWidget * mail_receive (GtkWindow *parent, + EMailSession *session); + /* receive a single uri */ void mail_receive_uri (EMailSession *session, const gchar *uri, diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 09db9ce0e8..590241a838 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -367,21 +367,6 @@ mail_shell_backend_prepare_for_quit_cb (EShell *shell, } static void -mail_shell_backend_send_receive_cb (EShell *shell, - GtkWindow *parent, - EShellBackend *shell_backend) -{ - EMailBackend *backend; - EMailSession *session; - - backend = E_MAIL_BACKEND (shell_backend); - session = e_mail_backend_get_session (backend); - - em_utils_clear_get_password_canceled_accounts_flag (); - mail_send_receive (parent, session); -} - -static void mail_shell_backend_window_weak_notify_cb (EShell *shell, GObject *where_the_object_was) { @@ -480,11 +465,6 @@ mail_shell_backend_constructed (GObject *object) shell_backend); g_signal_connect ( - shell, "send-receive", - G_CALLBACK (mail_shell_backend_send_receive_cb), - shell_backend); - - g_signal_connect ( shell, "window-created", G_CALLBACK (mail_shell_backend_window_created_cb), shell_backend); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index b2c5b8d1bb..01c53bed6e 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -716,6 +716,24 @@ action_mail_label_none_cb (GtkAction *action, } static void +action_mail_send_receive_cb (GtkAction *action, EMailShellView *mail_shell_view) +{ + e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_BOTH, NULL); +} + +static void +action_mail_send_receive_receive_all_cb (GtkAction *action, EMailShellView *mail_shell_view) +{ + e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, NULL); +} + +static void +action_mail_send_receive_send_all_cb (GtkAction *action, EMailShellView *mail_shell_view) +{ + e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_SEND, NULL); +} + +static void action_mail_show_deleted_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { @@ -1180,6 +1198,34 @@ static GtkActionEntry mail_entries[] = { N_("Subscribe or unsubscribe to folders on remote servers"), G_CALLBACK (action_mail_tools_subscriptions_cb) }, + { "mail-send-receive", + "mail-send-receive", + N_("Send / _Receive"), + "F9", + N_("Send queued items and retrieve new items"), + G_CALLBACK (action_mail_send_receive_cb) }, + + { "mail-send-receive-receive-all", + NULL, + N_("R_eceive all"), + NULL, + N_("Receive new items from all accounts"), + G_CALLBACK (action_mail_send_receive_receive_all_cb) }, + + { "mail-send-receive-send-all", + "mail-send", + N_("_Send all"), + NULL, + N_("Send queued items in all accounts"), + G_CALLBACK (action_mail_send_receive_send_all_cb) }, + + { "mail-send-receive-submenu", + "mail-send-receive", + N_("Send / _Receive"), + NULL, + NULL, + NULL }, + { "mail-smart-backward", NULL, NULL, /* No menu item; key press only */ @@ -1570,6 +1616,8 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) e_shell_searchbar_set_search_option ( searchbar, GTK_RADIO_ACTION (action)); + g_object_set (ACTION (MAIL_SEND_RECEIVE), "is-important", TRUE, NULL); + /* Bind GObject properties for GConf keys. */ bridge = gconf_bridge_get (); @@ -1637,6 +1685,26 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) ACTION (MAIL_STOP), "sensitive", G_BINDING_SYNC_CREATE); + g_object_bind_property ( + shell, "online", + ACTION (MAIL_SEND_RECEIVE), "sensitive", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell, "online", + ACTION (MAIL_SEND_RECEIVE_RECEIVE_ALL), "sensitive", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell, "online", + ACTION (MAIL_SEND_RECEIVE_SEND_ALL), "sensitive", + G_BINDING_SYNC_CREATE); + + g_object_bind_property ( + shell, "online", + ACTION (MAIL_SEND_RECEIVE_SUBMENU), "sensitive", + G_BINDING_SYNC_CREATE); + /* Keep the sensitivity of "Create Search Folder from Search" * in sync with "Save Search" so that its only selectable when * showing search results. */ diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h index 5eb015bd47..d9b801a9c0 100644 --- a/modules/mail/e-mail-shell-view-actions.h +++ b/modules/mail/e-mail-shell-view-actions.h @@ -167,6 +167,14 @@ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-subject") #define E_SHELL_WINDOW_ACTION_MAIL_SELECT_ALL(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-select-all") +#define E_SHELL_WINDOW_ACTION_MAIL_SEND_RECEIVE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-send-receive") +#define E_SHELL_WINDOW_ACTION_MAIL_SEND_RECEIVE_RECEIVE_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-send-receive-receive-all") +#define E_SHELL_WINDOW_ACTION_MAIL_SEND_RECEIVE_SEND_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-send-receive-send-all") +#define E_SHELL_WINDOW_ACTION_MAIL_SEND_RECEIVE_SUBMENU(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-send-receive-submenu") #define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers") #define E_SHELL_WINDOW_ACTION_MAIL_SHOW_DELETED(window) \ diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 12ff06567d..871f9d756c 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -22,6 +22,7 @@ #include "e-mail-shell-view-private.h" #include "widgets/menus/gal-view-factory-etable.h" +#include "widgets/misc/e-menu-tool-button.h" #include "e-util/e-util-private.h" @@ -658,6 +659,11 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) G_CALLBACK (e_shell_taskbar_set_message), shell_taskbar, G_CONNECT_SWAPPED); + g_signal_connect_object ( + mail_shell_view, "toggled", + G_CALLBACK (e_mail_shell_view_update_send_receive_menus), + mail_shell_view, G_CONNECT_AFTER | G_CONNECT_SWAPPED); + /* Need to keep the handler ID so we can disconnect it in * dispose(). The shell outlives us and we don't want it * invoking callbacks on finalized shell views. */ @@ -1104,3 +1110,354 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) g_string_free (buffer, TRUE); } + +void +e_mail_shell_view_send_receive (EMailShellView *mail_shell_view, EMailSendReceiveMode mode, const gchar *account_uid) +{ + EMailBackend *backend; + EMailSession *session; + EShellWindow *shell_window; + + g_return_if_fail (mail_shell_view != NULL); + + shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view)); + backend = E_MAIL_BACKEND (e_shell_view_get_shell_backend (E_SHELL_VIEW (mail_shell_view))); + session = e_mail_backend_get_session (backend); + + em_utils_clear_get_password_canceled_accounts_flag (); + + if (!account_uid) { + switch (mode) { + case E_MAIL_SEND_RECEIVE_BOTH: + mail_send_receive (GTK_WINDOW (shell_window), session); + break; + case E_MAIL_SEND_RECEIVE_RECEIVE: + mail_receive (GTK_WINDOW (shell_window), session); + break; + case E_MAIL_SEND_RECEIVE_SEND: + mail_send (session); + break; + } + } else { + /* allow only receive on individual accounts */ + EAccount *account; + + account = e_get_account_by_uid (account_uid); + g_return_if_fail (account != NULL); + + if (account->enabled && account->source && account->source->url && *account->source->url) + mail_receive_uri (session, account->source->url, account->source->keep_on_server); + } +} + +static GtkMenuItem * +send_receive_find_account_menu_item (GtkMenuShell *menu, EAccount *account) +{ + GList *children, *child; + + g_return_val_if_fail (menu != NULL, NULL); + g_return_val_if_fail (account != NULL, NULL); + g_return_val_if_fail (account->uid != NULL, NULL); + + children = gtk_container_get_children (GTK_CONTAINER (menu)); + + for (child = children; child != NULL; child = child->next) { + GObject *obj = child->data; + const gchar *uid; + + if (!obj) + continue; + + uid = g_object_get_data (obj, "e-account-uid"); + if (!uid) + continue; + + if (g_strcmp0 (uid, account->uid) == 0) { + g_list_free (children); + + return GTK_MENU_ITEM (obj); + } + } + + g_list_free (children); + + return NULL; +} + +static gint +send_receive_get_account_index (EAccount *account) +{ + gint res; + EAccountList *accounts; + EIterator *iterator; + + g_return_val_if_fail (account != NULL, -1); + + accounts = e_get_account_list (); + g_return_val_if_fail (accounts != NULL, -1); + + res = 0; + for (iterator = e_list_get_iterator (E_LIST (accounts)); + e_iterator_is_valid (iterator); + e_iterator_next (iterator)) { + EAccount *acc = (EAccount *) e_iterator_get (iterator); + const gchar *name; + + if (!acc || !acc->enabled || !acc->source || !acc->source->url || !*acc->source->url) + continue; + + name = e_account_get_string (acc, E_ACCOUNT_NAME); + if (!name || !*name || !acc->uid || !*acc->uid) + continue; + + if (g_strcmp0 (acc->uid, account->uid) == 0) { + g_object_unref (iterator); + return res; + } + + res++; + } + + return -1; +} + +static void +send_receive_account_item_activate_cb (GtkMenuItem *item, GtkMenuShell *menu) +{ + EMailShellView *mail_shell_view; + const gchar *account_uid; + + g_return_if_fail (item != NULL); + g_return_if_fail (menu != NULL); + + mail_shell_view = g_object_get_data (G_OBJECT (menu), "mail-shell-view"); + g_return_if_fail (mail_shell_view != NULL); + + account_uid = g_object_get_data (G_OBJECT (item), "e-account-uid"); + g_return_if_fail (account_uid != NULL); + + e_mail_shell_view_send_receive (mail_shell_view, E_MAIL_SEND_RECEIVE_RECEIVE, account_uid); +} + +static void +send_receive_add_to_menu (GtkMenuShell *menu, EAccount *account, gint insert_index) +{ + const gchar *name; + GtkWidget *item; + + g_return_if_fail (menu != NULL); + g_return_if_fail (account != NULL); + + if (send_receive_find_account_menu_item (menu, account) != NULL) + return; + + if (!account->source || !account->source->url || !*account->source->url) + return; + + name = e_account_get_string (account, E_ACCOUNT_NAME); + if (!name || !*name || !account->uid || !*account->uid) + return; + + item = gtk_menu_item_new_with_label (name); + gtk_widget_show (item); + g_object_set_data_full (G_OBJECT (item), "e-account-uid", g_strdup (account->uid), g_free); + g_signal_connect (item, "activate", G_CALLBACK (send_receive_account_item_activate_cb), menu); + + /* it's index between accounts, not in the menu */ + if (insert_index < 0) + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + else + gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, insert_index + 4); +} + +static void +send_receive_remove_from_menu (GtkMenuShell *menu, EAccount *account) +{ + GtkMenuItem *item; + + g_return_if_fail (menu != NULL); + g_return_if_fail (account != NULL); + + item = send_receive_find_account_menu_item (menu, account); + if (!item) + return; + + gtk_container_remove (GTK_CONTAINER (menu), GTK_WIDGET (item)); +} + +static void +send_receive_menu_account_added_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu) +{ + g_return_if_fail (account != NULL); + g_return_if_fail (menu != NULL); + + if (account->enabled) + send_receive_add_to_menu (menu, account, send_receive_get_account_index (account)); +} + +static void +send_receive_menu_account_changed_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu) +{ + g_return_if_fail (account != NULL); + g_return_if_fail (menu != NULL); + + if (account->enabled) { + GtkMenuItem *item = send_receive_find_account_menu_item (menu, account); + + if (item) { + if (!account->source || !account->source->url || !*account->source->url) { + send_receive_remove_from_menu (menu, account); + } else { + const gchar *name = e_account_get_string (account, E_ACCOUNT_NAME); + if (name && *name) + gtk_menu_item_set_label (item, name); + } + } else { + send_receive_add_to_menu (menu, account, send_receive_get_account_index (account)); + } + } else { + send_receive_remove_from_menu (menu, account); + } +} + +static void +send_receive_menu_account_removed_cb (EAccountList *list, EAccount *account, GtkMenuShell *menu) +{ + g_return_if_fail (account != NULL); + g_return_if_fail (menu != NULL); + + send_receive_remove_from_menu (menu, account); +} + +static void +menu_weak_ref_cb (gpointer accounts, GObject *freed_menu) +{ + g_return_if_fail (accounts != NULL); + + g_signal_handlers_disconnect_matched (accounts, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, freed_menu); +} + +static GtkWidget * +create_send_receive_submenu (EMailShellView *mail_shell_view) +{ + EShellWindow *shell_window; + EAccountList *accounts; + GtkWidget *menu; + GtkAccelGroup *accel_group; + GtkUIManager *ui_manager; + GtkAction *action; + + g_return_val_if_fail (mail_shell_view != NULL, NULL); + + shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view)); + + accounts = e_get_account_list (); + menu = gtk_menu_new (); + ui_manager = e_shell_window_get_ui_manager (shell_window); + accel_group = gtk_ui_manager_get_accel_group (ui_manager); + + action = e_shell_window_get_action (shell_window, "mail-send-receive"); + gtk_action_set_accel_group (action, accel_group); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action)); + + action = e_shell_window_get_action (shell_window, "mail-send-receive-receive-all"); + gtk_action_set_accel_group (action, accel_group); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action)); + + action = e_shell_window_get_action (shell_window, "mail-send-receive-send-all"); + gtk_action_set_accel_group (action, accel_group); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action)); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ()); + + if (accounts) { + EIterator *iterator; + + for (iterator = e_list_get_iterator (E_LIST (accounts)); + e_iterator_is_valid (iterator); + e_iterator_next (iterator)) { + EAccount *account = (EAccount *) e_iterator_get (iterator); + + if (!account || !account->enabled) + continue; + + send_receive_add_to_menu (GTK_MENU_SHELL (menu), account, -1); + } + + g_signal_connect (accounts, "account-added", G_CALLBACK (send_receive_menu_account_added_cb), menu); + g_signal_connect (accounts, "account-changed", G_CALLBACK (send_receive_menu_account_changed_cb), menu); + g_signal_connect (accounts, "account-removed", G_CALLBACK (send_receive_menu_account_removed_cb), menu); + + g_object_weak_ref (G_OBJECT (menu), menu_weak_ref_cb, accounts); + } + + gtk_widget_show_all (menu); + + g_object_set_data (G_OBJECT (menu), "mail-shell-view", mail_shell_view); + + return menu; +} + +void +e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view) +{ + EMailShellViewPrivate *priv; + EShellWindow *shell_window; + GtkWidget *widget, *toolbar; + GtkToolItem *tool_item; + gint index; + + g_return_if_fail (mail_shell_view != NULL); + + priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view); + g_return_if_fail (priv != NULL); + + if (!e_shell_view_is_active (E_SHELL_VIEW (mail_shell_view))) { + if (priv->send_receive_tool_item) { + shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view)); + + toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar"); + g_return_if_fail (toolbar != NULL); + + gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (priv->send_receive_tool_item)); + gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (priv->send_receive_tool_separator)); + + priv->send_receive_tool_item = NULL; + priv->send_receive_tool_separator = NULL; + } + + return; + } + + shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view)); + + widget = e_shell_window_get_managed_widget (shell_window, "/main-menu/file-menu/mail-send-receiver/mail-send-receive-submenu"); + if (widget) + gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), create_send_receive_submenu (mail_shell_view)); + + toolbar = e_shell_window_get_managed_widget (shell_window, "/main-toolbar"); + g_return_if_fail (toolbar != NULL); + + widget = e_shell_window_get_managed_widget (shell_window, "/main-toolbar/toolbar-actions/mail-send-receiver"); + g_return_if_fail (widget != NULL); + + index = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget)); + + tool_item = gtk_separator_tool_item_new (); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index); + gtk_widget_show (GTK_WIDGET (tool_item)); + priv->send_receive_tool_separator = tool_item; + + tool_item = GTK_TOOL_ITEM (e_menu_tool_button_new (_("Send / Receive"))); + gtk_tool_item_set_is_important (tool_item, TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index); + gtk_widget_show (GTK_WIDGET (tool_item)); + priv->send_receive_tool_item = tool_item; + + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (tool_item), create_send_receive_submenu (mail_shell_view)); + + g_object_bind_property ( + ACTION (MAIL_SEND_RECEIVE), "sensitive", + tool_item, "sensitive", + G_BINDING_SYNC_CREATE); +} diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index 806b408772..9f028e0e8a 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -131,6 +131,12 @@ enum { MAIL_SCOPE_ALL_ACCOUNTS }; +typedef enum { + E_MAIL_SEND_RECEIVE_BOTH, + E_MAIL_SEND_RECEIVE_RECEIVE, + E_MAIL_SEND_RECEIVE_SEND +} EMailSendReceiveMode; + struct _EMailShellViewPrivate { /*** Other Stuff ***/ @@ -156,6 +162,9 @@ struct _EMailShellViewPrivate { GCancellable *search_account_cancel; guint show_deleted : 1; + + GtkToolItem *send_receive_tool_item; + GtkToolItem *send_receive_tool_separator; }; void e_mail_shell_view_private_init @@ -186,6 +195,12 @@ void e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view); void e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view); +void e_mail_shell_view_send_receive + (EMailShellView *mail_shell_view, + EMailSendReceiveMode mode, + const gchar *account_uid); +void e_mail_shell_view_update_send_receive_menus + (EMailShellView *mail_shell_view); G_END_DECLS diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index e07b76213a..26b22645c4 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -724,7 +724,6 @@ shell_view_toggled (EShellView *shell_view) priv->merge_id = e_ui_manager_add_ui_from_file ( E_UI_MANAGER (ui_manager), basename); e_plugin_ui_enable_manager (ui_manager, id); - } else if (!view_is_active && priv->merge_id != 0) { e_plugin_ui_disable_manager (ui_manager, id); gtk_ui_manager_remove_ui (ui_manager, priv->merge_id); diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index a77bd35e97..949183133d 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -1153,24 +1153,6 @@ action_search_save_cb (GtkAction *action, } /** - * E_SHELL_WINDOW_ACTION_SEND_RECEIVE: - * @window: an #EShellWindow - * - * Activation of this action opens the Send & Receive Mail dialog. - * - * Main menu item: File -> Send / Receive - **/ -static void -action_send_receive_cb (GtkAction *action, - EShellWindow *shell_window) -{ - EShell *shell; - - shell = e_shell_window_get_shell (shell_window); - e_shell_send_receive (shell, GTK_WINDOW (shell_window)); -} - -/** * E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR: * @window: an #EShellWindow * @@ -1571,13 +1553,6 @@ static GtkActionEntry shell_entries[] = { N_("Select all text"), NULL }, /* Handled by EFocusTracker */ - { "send-receive", - "mail-send-receive", - N_("Send / _Receive"), - "F9", - N_("Send queued items and retrieve new items"), - G_CALLBACK (action_send_receive_cb) }, - { "submit-bug", NULL, N_("Submit _Bug Report..."), @@ -1933,8 +1908,6 @@ e_shell_window_actions_init (EShellWindow *shell_window) gtk_action_set_sensitive (ACTION (SEARCH_QUICK), FALSE); - g_object_set (ACTION (SEND_RECEIVE), "is-important", TRUE, NULL); - g_object_bind_property ( shell_window, "sidebar-visible", ACTION (SHOW_SIDEBAR), "active", diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h index a3f752c15e..3746fe92c8 100644 --- a/shell/e-shell-window-actions.h +++ b/shell/e-shell-window-actions.h @@ -79,8 +79,6 @@ E_SHELL_WINDOW_ACTION ((window), "search-save") #define E_SHELL_WINDOW_ACTION_SELECT_ALL(window) \ E_SHELL_WINDOW_ACTION ((window), "select-all") -#define E_SHELL_WINDOW_ACTION_SEND_RECEIVE(window) \ - E_SHELL_WINDOW_ACTION ((window), "send-receive") #define E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR(window) \ E_SHELL_WINDOW_ACTION ((window), "show-sidebar") #define E_SHELL_WINDOW_ACTION_SHOW_SWITCHER(window) \ diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 39c6ca971d..cf0ee93df2 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -390,13 +390,6 @@ e_shell_window_private_constructed (EShellWindow *shell_window) /* Bind GObject properties to GObject properties. */ - action = ACTION (SEND_RECEIVE); - - g_object_bind_property ( - shell, "online", - action, "sensitive", - G_BINDING_SYNC_CREATE); - action = ACTION (WORK_OFFLINE); g_object_bind_property ( diff --git a/shell/e-shell.c b/shell/e-shell.c index b983b18403..7ffe91b40d 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -96,7 +96,6 @@ enum { PREPARE_FOR_ONLINE, PREPARE_FOR_QUIT, QUIT_REQUESTED, - SEND_RECEIVE, WINDOW_CREATED, WINDOW_DESTROYED, LAST_SIGNAL @@ -1109,24 +1108,6 @@ e_shell_class_init (EShellClass *class) E_TYPE_SHELL_QUIT_REASON); /** - * EShell::send-receive - * @shell: the #EShell which emitted the signal - * @parent: a parent #GtkWindow - * - * Emitted when the user chooses the "Send / Receive" action. - * The parent window can be used for showing transient windows. - **/ - signals[SEND_RECEIVE] = g_signal_new ( - "send-receive", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (EShellClass, send_receive), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_WINDOW); - - /** * EShell::window-created * @shell: the #EShell which emitted the signal * @window: the newly created #GtkWindow @@ -1689,23 +1670,6 @@ e_shell_get_active_window (EShell *shell) } /** - * e_shell_send_receive: - * @shell: an #EShell - * @parent: the parent #GtkWindow - * - * Emits the #EShell::send-receive signal. - **/ -void -e_shell_send_receive (EShell *shell, - GtkWindow *parent) -{ - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (GTK_IS_WINDOW (parent)); - - g_signal_emit (shell, signals[SEND_RECEIVE], 0, parent); -} - -/** * e_shell_get_express_mode: * @shell: an #EShell * diff --git a/shell/e-shell.h b/shell/e-shell.h index 15bcbb3694..3f037ba2d6 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -106,8 +106,6 @@ struct _EShellClass { EActivity *activity); void (*quit_requested) (EShell *shell, EShellQuitReason reason); - void (*send_receive) (EShell *shell, - GtkWindow *parent); void (*window_created) (EShell *shell, GtkWindow *window); void (*window_destroyed) (EShell *shell); @@ -134,8 +132,6 @@ void e_shell_watch_window (EShell *shell, GtkWindow *window); GList * e_shell_get_watched_windows (EShell *shell); GtkWindow * e_shell_get_active_window (EShell *shell); -void e_shell_send_receive (EShell *shell, - GtkWindow *parent); gboolean e_shell_get_meego_mode (EShell *shell); gboolean e_shell_get_express_mode (EShell *shell); gboolean e_shell_get_small_screen_mode (EShell *shell); diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c index 58fe1aa17f..cbbd07cdb8 100644 --- a/shell/test/e-test-shell-backend.c +++ b/shell/test/e-test-shell-backend.c @@ -101,13 +101,6 @@ test_shell_backend_handle_uri_cb (EShellBackend *shell_backend, } static void -test_shell_backend_send_receive_cb (EShellBackend *shell_backend, - GtkWindow *parent_window) -{ - g_debug ("%s (window=%p)", G_STRFUNC, parent_window); -} - -static void test_shell_backend_window_created_cb (EShellBackend *shell_backend, GtkWindow *window) { @@ -150,11 +143,6 @@ test_shell_backend_constructed (GObject *object) shell_backend); g_signal_connect_swapped ( - shell, "send-receive", - G_CALLBACK (test_shell_backend_send_receive_cb), - shell_backend); - - g_signal_connect_swapped ( shell, "window-created", G_CALLBACK (test_shell_backend_window_created_cb), shell_backend); diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui index 55f546626d..483446b5e0 100644 --- a/ui/evolution-calendars.ui +++ b/ui/evolution-calendars.ui @@ -1,11 +1,6 @@ <ui> <menubar name='main-menu'> <menu action='file-menu'> - <placeholder name='mail-send-receiver'> -#if !EXPRESS - <menuitem action='send-receive'/> -#endif - </placeholder> <placeholder name='file-actions'> <menuitem action='event-open'/> </placeholder> @@ -36,8 +31,6 @@ </menubar> <toolbar name='main-toolbar'> #if !EXPRESS - <toolitem action='send-receive'/> - <separator/> <toolitem action='calendar-print'/> <toolitem action='delete-selection'/> <separator/> diff --git a/ui/evolution-contacts.ui b/ui/evolution-contacts.ui index 49e34a72d3..763e43c30d 100644 --- a/ui/evolution-contacts.ui +++ b/ui/evolution-contacts.ui @@ -1,11 +1,6 @@ <ui> <menubar name='main-menu'> <menu action='file-menu'> - <placeholder name='mail-send-receiver'> -#if !EXPRESS - <menuitem action='send-receive'/> -#endif - </placeholder> <placeholder name='file-actions'> <menuitem action='contact-open'/> <menuitem action='contact-save-as'/> @@ -54,8 +49,6 @@ </menubar> <toolbar name='main-toolbar'> #if !EXPRESS - <toolitem action='send-receive'/> - <separator/> <toolitem action='address-book-print'/> #endif <toolitem action='delete-selection'/> diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui index d158cf862b..6a9c9616f7 100644 --- a/ui/evolution-mail.ui +++ b/ui/evolution-mail.ui @@ -2,7 +2,7 @@ <menubar name='main-menu'> <menu action='file-menu'> <placeholder name='mail-send-receiver'> - <menuitem action='send-receive'/> + <menuitem action='mail-send-receive-submenu'/> </placeholder> <placeholder name='long-running-actions'> <menuitem action='mail-global-expunge'/> @@ -62,7 +62,7 @@ </menubar> <toolbar name='main-toolbar'> <placeholder name='toolbar-actions'> - <toolitem action='send-receive'/> + <placeholder name='mail-send-receiver'/> <separator/> #if EXPRESS <toolitem action='new-addressbook-window'/> diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui index f2f188a8ca..54d173dbfb 100644 --- a/ui/evolution-memos.ui +++ b/ui/evolution-memos.ui @@ -1,11 +1,6 @@ <ui> <menubar name='main-menu'> <menu action='file-menu'> - <placeholder name='mail-send-receiver'> -#if !EXPRESS - <menuitem action='send-receive'/> -#endif - </placeholder> <placeholder name='file-actions'> <menuitem action='memo-open'/> </placeholder> @@ -34,10 +29,6 @@ </menu> </menubar> <toolbar name='main-toolbar'> -#if !EXPRESS - <toolitem action='send-receive'/> - <separator/> -#endif <toolitem action='cut-clipboard'/> <toolitem action='copy-clipboard'/> <toolitem action='paste-clipboard'/> diff --git a/ui/evolution-tasks.ui b/ui/evolution-tasks.ui index 432ebfadaf..62d9f023b7 100644 --- a/ui/evolution-tasks.ui +++ b/ui/evolution-tasks.ui @@ -1,11 +1,6 @@ <ui> <menubar name='main-menu'> <menu action='file-menu'> - <placeholder name='mail-send-receiver'> -#if !EXPRESS - <menuitem action='send-receive'/> -#endif - </placeholder> <placeholder name='file-actions'> <menuitem action='task-open'/> </placeholder> @@ -44,10 +39,6 @@ </placeholder> </menubar> <toolbar name='main-toolbar'> -#if !EXPRESS - <toolitem action='send-receive'/> - <separator/> -#endif <toolitem action='cut-clipboard'/> <toolitem action='copy-clipboard'/> <toolitem action='paste-clipboard'/> |