#include <widgets/modest-attachments-view.h>
#include <modest-runtime.h>
#include <tny-simple-list.h>
+#include <tny-merge-folder.h>
#include <widgets/modest-recpt-editor.h>
#include <gtkhtml/gtkhtml.h>
#include <modest-runtime.h>
static gboolean _send_receive_in_progress (ModestWindow *win);
static gboolean _msgs_send_in_progress (void);
static gboolean _all_msgs_in_sending_status (ModestHeaderView *header_view) G_GNUC_UNUSED;
+static gboolean _forbid_outgoing_xfers (ModestWindow *window);
static DimmedState *
_define_main_window_dimming_state (ModestMainWindow *window)
folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
-
+ if (folder_view) {
+ TnyFolderStore *selected = modest_folder_view_get_selected ((ModestFolderView *)folder_view);
+ if (selected) {
+ TnyAccount *account = NULL;
+
+ if (TNY_IS_ACCOUNT (selected)) {
+ account = g_object_ref (selected);
+ } else if (!TNY_IS_MERGE_FOLDER (selected)){
+ account = tny_folder_get_account (TNY_FOLDER (selected));
+ }
+ if (account) {
+ ModestProtocolType protocol_type;
+
+ protocol_type = modest_tny_account_get_protocol_type (account);
+ dimmed = modest_protocol_registry_protocol_type_has_tag
+ (modest_runtime_get_protocol_registry (),
+ protocol_type,
+ MODEST_PROTOCOL_REGISTRY_STORE_FORBID_OUTGOING_XFERS);
+
+ g_object_unref (account);
+ }
+ g_object_unref (selected);
+ }
+ }
+
/* Check diming rules for folders transfer */
- if (folder_view && gtk_widget_is_focus (folder_view)) {
+ if (!dimmed && folder_view && gtk_widget_is_focus (folder_view)) {
TnyFolderType types[5];
-
+
types[0] = TNY_FOLDER_TYPE_DRAFTS;
types[1] = TNY_FOLDER_TYPE_OUTBOX;
types[2] = TNY_FOLDER_TYPE_SENT;
if (!dimmed) {
if (!(folder_view && gtk_widget_is_focus (folder_view)))
dimmed = _invalid_msg_selected (MODEST_MAIN_WINDOW(win), FALSE, user_data);
-
+
}
if (!dimmed) {
dimmed = _selected_msg_sent_in_progress (win);
if (dimmed)
modest_dimming_rule_set_notification (rule, _("sfil_ib_unable_to_move_selected_items"));
}
-
+
+ return dimmed;
+}
+
+static gboolean
+_forbid_outgoing_xfers (ModestWindow *window)
+{
+ const gchar *account_name;
+ TnyAccount *account;
+ gboolean dimmed = FALSE;
+
+ account_name = modest_window_get_active_account (window);
+ account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
+ account_name,
+ TNY_ACCOUNT_TYPE_STORE);
+
+ if (account) {
+ ModestProtocolType protocol_type;
+
+ protocol_type = modest_tny_account_get_protocol_type (account);
+ dimmed = modest_protocol_registry_protocol_type_has_tag
+ (modest_runtime_get_protocol_registry (),
+ protocol_type,
+ MODEST_PROTOCOL_REGISTRY_STORE_FORBID_OUTGOING_XFERS);
+
+ g_object_unref (account);
+ }
return dimmed;
}
}
/* Check dimmed rule */
-
dimmed = _transfer_mode_enabled (win);
if (dimmed)
- modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
+ modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
+
+ if (!dimmed)
+ dimmed = _forbid_outgoing_xfers (win);
+
if (!dimmed) {
dimmed = modest_window_get_dimming_state (win)->any_marked_as_deleted;
if (dimmed) {
g_free (msg);
}
}
-
+
if (!dimmed) {
dimmed = _selected_msg_sent_in_progress (win);
if (dimmed)
dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW (win));
}
}
-
if (dimmed)
modest_dimming_rule_set_notification (rule, _("emev_nc_unabletomove_item"));
}
if (dimmed)
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
+ if (!dimmed)
+ dimmed = _forbid_outgoing_xfers (win);
+
if (!dimmed) {
GtkWidget *header_view;
TnyFolder *folder;
if (dimmed)
modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading"));
+ if (!dimmed)
+ dimmed = _forbid_outgoing_xfers (win);
+
if (MODEST_IS_FOLDER_WINDOW (win)) {
ModestFolderView *folder_view;
folder_view = modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (win));