From df33c633ee19e9420f7d8f660cac71d71bea90c3 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Tue, 22 Jun 2010 14:29:28 -0400
Subject: Use an appropriate icon when dragging attachments.

---
 widgets/misc/e-attachment-button.c | 44 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

(limited to 'widgets/misc/e-attachment-button.c')

diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c
index d1b02c09f3..a248cf6ca4 100644
--- a/widgets/misc/e-attachment-button.c
+++ b/widgets/misc/e-attachment-button.c
@@ -246,6 +246,18 @@ attachment_button_expand_clicked_cb (EAttachmentButton *button)
 	e_attachment_button_set_expanded (button, !expanded);
 }
 
+static void
+attachment_button_expand_drag_begin_cb (EAttachmentButton *button,
+                                        GdkDragContext *context)
+{
+	EAttachmentView *view;
+
+	view = e_attachment_button_get_view (button);
+
+	attachment_button_select_path (button);
+	e_attachment_view_drag_begin (view, context);
+}
+
 static void
 attachment_button_expand_drag_data_get_cb (EAttachmentButton *button,
                                            GdkDragContext *context,
@@ -255,14 +267,23 @@ attachment_button_expand_drag_data_get_cb (EAttachmentButton *button,
 {
 	EAttachmentView *view;
 
-	attachment_button_select_path (button);
-
 	view = e_attachment_button_get_view (button);
 
 	e_attachment_view_drag_data_get (
 		view, context, selection, info, time);
 }
 
+static void
+attachment_button_expand_drag_end_cb (EAttachmentButton *button,
+                                      GdkDragContext *context)
+{
+	EAttachmentView *view;
+
+	view = e_attachment_button_get_view (button);
+
+	e_attachment_view_drag_end (view, context);
+}
+
 static gboolean
 attachment_button_toggle_button_press_event_cb (EAttachmentButton *button,
                                                 GdkEventButton *event)
@@ -578,21 +599,40 @@ attachment_button_init (EAttachmentButton *button)
 		button->priv->expand_button, "clicked",
 		G_CALLBACK (attachment_button_expand_clicked_cb), button);
 
+	g_signal_connect_swapped (
+		button->priv->expand_button, "drag-begin",
+		G_CALLBACK (attachment_button_expand_drag_begin_cb),
+		button);
+
 	g_signal_connect_swapped (
 		button->priv->expand_button, "drag-data-get",
 		G_CALLBACK (attachment_button_expand_drag_data_get_cb),
 		button);
 
+	g_signal_connect_swapped (
+		button->priv->expand_button, "drag-end",
+		G_CALLBACK (attachment_button_expand_drag_end_cb),
+		button);
+
 	g_signal_connect_swapped (
 		button->priv->toggle_button, "button-press-event",
 		G_CALLBACK (attachment_button_toggle_button_press_event_cb),
 		button);
 
+	g_signal_connect_swapped (
+		button->priv->toggle_button, "drag-begin",
+		G_CALLBACK (attachment_button_expand_drag_begin_cb),
+		button);
+
 	g_signal_connect_swapped (
 		button->priv->toggle_button, "drag-data-get",
 		G_CALLBACK (attachment_button_expand_drag_data_get_cb),
 		button);
 
+	g_signal_connect_swapped (
+		button->priv->toggle_button, "drag-end",
+		G_CALLBACK (attachment_button_expand_drag_end_cb),
+		button);
 }
 
 GType
-- 
cgit