Blob Blame History Raw
diff -up evolution-3.12.11/addressbook/gui/widgets/e-addressbook-selector.c.contacts-drag-drop-vcard evolution-3.12.11/addressbook/gui/widgets/e-addressbook-selector.c
--- evolution-3.12.11/addressbook/gui/widgets/e-addressbook-selector.c.contacts-drag-drop-vcard	2014-07-17 12:48:07.000000000 +0200
+++ evolution-3.12.11/addressbook/gui/widgets/e-addressbook-selector.c	2015-06-08 12:56:07.117848545 +0200
@@ -57,7 +57,7 @@ enum {
 };
 
 static GtkTargetEntry drag_types[] = {
-	{ (gchar *) "text/x-source-vcard", 0, 0 }
+	{ (gchar *) "text/x-source-vcard", 0, 1 }
 };
 
 G_DEFINE_TYPE (
@@ -297,6 +297,7 @@ addressbook_selector_data_dropped (ESour
 	MergeContext *merge_context;
 	EAddressbookModel *model;
 	EBookClient *source_client;
+	ESource *source_source = NULL;
 	ESourceRegistry *registry;
 	GSList *list;
 	const gchar *string;
@@ -310,16 +311,32 @@ addressbook_selector_data_dropped (ESour
 
 	registry = e_source_selector_get_registry (selector);
 
-	eab_source_and_contact_list_from_string (
-		registry, string, NULL, &list);
+	if (info == drag_types[0].info)
+		eab_source_and_contact_list_from_string (
+			registry, string, &source_source, &list);
+	else
+		list = eab_contact_list_from_string (string);
 
-	if (list == NULL)
+	if (list == NULL) {
+		g_clear_object (&source_source);
 		return FALSE;
+	}
 
 	model = e_addressbook_view_get_model (priv->current_view);
 	source_client = e_addressbook_model_get_client (model);
 	g_return_val_if_fail (E_IS_BOOK_CLIENT (source_client), FALSE);
 
+	if (remove_from_source && source_source &&
+	    !e_source_equal (source_source, e_client_get_source (E_CLIENT (source_client)))) {
+		g_warning ("%s: Source book '%s' doesn't match the view client '%s', skipping drop",
+			G_STRFUNC, e_source_get_uid (source_source),
+			e_source_get_uid (e_client_get_source (E_CLIENT (source_client))));
+		g_clear_object (&source_source);
+		return FALSE;
+	}
+
+	g_clear_object (&source_source);
+
 	merge_context = merge_context_new (
 		registry, g_object_ref (source_client), NULL, list);
 	merge_context->remove_from_source = remove_from_source;
diff -up evolution-3.12.11/addressbook/gui/widgets/e-minicard-view.c.contacts-drag-drop-vcard evolution-3.12.11/addressbook/gui/widgets/e-minicard-view.c
--- evolution-3.12.11/addressbook/gui/widgets/e-minicard-view.c.contacts-drag-drop-vcard	2014-03-24 10:25:23.000000000 +0100
+++ evolution-3.12.11/addressbook/gui/widgets/e-minicard-view.c	2015-06-08 12:56:07.117848545 +0200
@@ -106,7 +106,7 @@ e_minicard_view_drag_data_get (GtkWidget
 		EBookClient *book_client = NULL;
 		gchar *value;
 
-		g_object_get (view->adapter, "book_client", &book_client, NULL);
+		g_object_get (view->adapter, "client", &book_client, NULL);
 		value = eab_book_and_contact_list_to_string (book_client, view->drag_list);
 
 		gtk_selection_data_set (
@@ -140,8 +140,6 @@ e_minicard_view_drag_begin (EAddressbook
 
 	view->drag_list = e_minicard_view_get_card_list (view);
 
-	g_print ("dragging %d card(s)\n", g_slist_length (view->drag_list));
-
 	target_list = gtk_target_list_new (drag_types, G_N_ELEMENTS (drag_types));
 
 	context = gtk_drag_begin (
diff -up evolution-3.12.11/e-util/e-selection.c.contacts-drag-drop-vcard evolution-3.12.11/e-util/e-selection.c
--- evolution-3.12.11/e-util/e-selection.c.contacts-drag-drop-vcard	2014-03-24 10:25:23.000000000 +0100
+++ evolution-3.12.11/e-util/e-selection.c	2015-06-08 12:56:07.118848545 +0200
@@ -807,7 +807,7 @@ e_drag_dest_add_calendar_targets (GtkWid
 
 	g_return_if_fail (GTK_IS_WIDGET (widget));
 
-	target_list = gtk_drag_source_get_target_list (widget);
+	target_list = gtk_drag_dest_get_target_list (widget);
 	if (target_list != NULL)
 		gtk_target_list_ref (target_list);
 	else
@@ -824,7 +824,7 @@ e_drag_dest_add_directory_targets (GtkWi
 
 	g_return_if_fail (GTK_IS_WIDGET (widget));
 
-	target_list = gtk_drag_source_get_target_list (widget);
+	target_list = gtk_drag_dest_get_target_list (widget);
 	if (target_list != NULL)
 		gtk_target_list_ref (target_list);
 	else
@@ -841,7 +841,7 @@ e_drag_dest_add_html_targets (GtkWidget
 
 	g_return_if_fail (GTK_IS_WIDGET (widget));
 
-	target_list = gtk_drag_source_get_target_list (widget);
+	target_list = gtk_drag_dest_get_target_list (widget);
 	if (target_list != NULL)
 		gtk_target_list_ref (target_list);
 	else