[evolution/gnome-2-30] Bug 615291 - Preview pane's attachment bar accepts drop



commit 0a39131fdfb5ef87525d668751651a2c9d075ebf
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 11 22:59:57 2010 -0500

    Bug 615291 - Preview pane's attachment bar accepts drop

 widgets/misc/e-attachment-view.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index 9725604..5a5db57 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -826,7 +826,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. */
 
@@ -927,6 +926,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");
 }
 
@@ -1315,6 +1319,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
@@ -1323,6 +1332,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
@@ -1465,10 +1478,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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]