aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment-view.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-05-12 11:59:57 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-05-12 11:59:57 +0800
commit4abf496f28e91caeb434b0d13259434302acade7 (patch)
treec486c3f0b7e415b80b4a81f55e28ff024ad0ba27 /widgets/misc/e-attachment-view.c
parentbb0209061c1c3d9947a769015b204d0d5d6c9ec0 (diff)
downloadgsoc2013-evolution-4abf496f28e91caeb434b0d13259434302acade7.tar.gz
gsoc2013-evolution-4abf496f28e91caeb434b0d13259434302acade7.tar.zst
gsoc2013-evolution-4abf496f28e91caeb434b0d13259434302acade7.zip
Bug 615291 - Preview pane's attachment bar accepts drop
Diffstat (limited to 'widgets/misc/e-attachment-view.c')
-rw-r--r--widgets/misc/e-attachment-view.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index d9c45fb13c..3b90941d85 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -825,7 +825,6 @@ e_attachment_view_init (EAttachmentView *view)
attachment_view_init_handlers (view);
e_attachment_view_drag_source_set (view);
- e_attachment_view_drag_dest_set (view);
/* Connect built-in drag and drop handlers. */
@@ -926,6 +925,11 @@ e_attachment_view_set_editable (EAttachmentView *view,
priv = e_attachment_view_get_private (view);
priv->editable = editable;
+ if (editable)
+ e_attachment_view_drag_dest_set (view);
+ else
+ e_attachment_view_drag_dest_unset (view);
+
g_object_notify (G_OBJECT (view), "editable");
}
@@ -1314,6 +1318,11 @@ e_attachment_view_drag_begin (EAttachmentView *view,
{
g_return_if_fail (E_IS_ATTACHMENT_VIEW (view));
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ /* Prevent the user from dragging and dropping to
+ * the same attachment view, which would duplicate
+ * the attachment. */
+ e_attachment_view_drag_dest_unset (view);
}
void
@@ -1322,6 +1331,10 @@ e_attachment_view_drag_end (EAttachmentView *view,
{
g_return_if_fail (E_IS_ATTACHMENT_VIEW (view));
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ /* Restore the previous drag destination state. */
+ if (e_attachment_view_get_editable (view))
+ e_attachment_view_drag_dest_set (view);
}
static void
@@ -1464,10 +1477,6 @@ e_attachment_view_drag_drop (EAttachmentView *view,
g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), FALSE);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE);
- /* Disallow drops if we're not editable. */
- if (!e_attachment_view_get_editable (view))
- return FALSE;
-
return TRUE;
}