aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2013-08-22 19:01:21 +0800
committerFabiano FidĂȘncio <fidencio@redhat.com>2013-08-27 07:52:02 +0800
commitaa255972359662e58c34db33320e0377060de1b0 (patch)
tree06d89e8aa506b25082ec752d1b102aeb7d19bbad /mail/em-folder-tree.c
parente56159372131bc4036d2d6339149db4617fbac41 (diff)
downloadgsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar.gz
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar.bz2
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar.lz
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar.xz
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.tar.zst
gsoc2013-evolution-aa255972359662e58c34db33320e0377060de1b0.zip
Bug #659715 - Reject folder copy/move in offline
Diffstat (limited to 'mail/em-folder-tree.c')
-rw-r--r--mail/em-folder-tree.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 195a09fad7..e2aa6d5e37 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1970,10 +1970,13 @@ ask_drop_folder (EMFolderTree *folder_tree,
EMailSession *session;
GSettings *settings;
gchar *set_value, *src_folder_name = NULL;
+ CamelProvider *src_provider, *des_provider;
+ CamelStore *src_store = NULL;
GError *error = NULL;
GtkWidget *widget;
GtkWindow *parent;
gint response;
+ gboolean src_store_is_local, des_store_is_local, session_is_online;
g_return_val_if_fail (folder_tree != NULL, FALSE);
g_return_val_if_fail (src_folder_uri != NULL, FALSE);
@@ -2000,7 +2003,7 @@ ask_drop_folder (EMFolderTree *folder_tree,
e_mail_folder_uri_parse (
CAMEL_SESSION (session),
- src_folder_uri, NULL, &src_folder_name, &error);
+ src_folder_uri, &src_store, &src_folder_name, &error);
if (error != NULL) {
g_warning (
@@ -2012,6 +2015,30 @@ ask_drop_folder (EMFolderTree *folder_tree,
return FALSE;
}
+ session_is_online = camel_session_get_online (CAMEL_SESSION (session));
+
+ src_provider = camel_service_get_provider (CAMEL_SERVICE (src_store));
+ src_store_is_local = (src_provider->flags & CAMEL_PROVIDER_IS_LOCAL) != 0;
+
+ des_provider = camel_service_get_provider (CAMEL_SERVICE (des_store));
+ des_store_is_local = (des_provider->flags & CAMEL_PROVIDER_IS_LOCAL) != 0;
+
+ if (!session_is_online && (!src_store_is_local || !des_store_is_local)) {
+ EAlertSink *alert_sink;
+
+ alert_sink = em_folder_tree_get_alert_sink (folder_tree);
+ e_alert_submit (
+ alert_sink,
+ "mail:online-operation",
+ src_store_is_local ? des_full_name : src_folder_name,
+ NULL);
+ g_free (src_folder_name);
+ g_object_unref (src_store);
+ g_object_unref (settings);
+
+ return FALSE;
+ }
+
parent = NULL;
widget = gtk_widget_get_toplevel (GTK_WIDGET (folder_tree));
if (widget && gtk_widget_is_toplevel (widget) && GTK_IS_WINDOW (widget))
@@ -2033,6 +2060,7 @@ ask_drop_folder (EMFolderTree *folder_tree,
g_settings_set_string (settings, key, "never");
g_free (src_folder_name);
+ g_object_unref (src_store);
g_object_unref (settings);
return response == GTK_RESPONSE_YES || response == GTK_RESPONSE_OK;