From e3d93e8cb70498b2727c6e9f6c96c5d57df6509b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Enrico=20Tr=C3=83=C2=B6ger?= <enrico@xfce.org>
Date: Mon, 14 Apr 2008 18:47:34 +0000
Subject: [PATCH] Set entry text in the main window if text was dragged onto
 the panel button or into the panel entry.

(Old svn revision: 4568)
---
 ChangeLog                        |  2 ++
 panel-plugin/xfce4-dict-plugin.c | 19 +++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3196d30..af53357 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
 	* Connect to "drag-data-received" signal in library as it is equal for
 	  panel plugin and standalone code.
 	* Move signal handling code for networkign code completely into lib/dictd.c.
+	* Set entry text in the main window if text was dragged onto the panel
+	  button or into the panel entry.
 
 
 2008-04-03  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
diff --git a/panel-plugin/xfce4-dict-plugin.c b/panel-plugin/xfce4-dict-plugin.c
index 0be290a..b53a755 100644
--- a/panel-plugin/xfce4-dict-plugin.c
+++ b/panel-plugin/xfce4-dict-plugin.c
@@ -315,6 +315,21 @@ static void dict_plugin_panel_entry_activate_cb(GtkEntry *entry, DictPanelData *
 }
 
 
+static void dict_plugin_drag_data_received(GtkWidget *widget, GdkDragContext *drag_context,
+		gint x, gint y, GtkSelectionData *data, guint info, guint ltime, DictPanelData *dpd)
+{
+	if ((data != NULL) && (data->length >= 0) && (data->format == 8))
+	{
+		if (widget == dpd->panel_button || widget == dpd->dd->panel_entry)
+		{
+			gtk_entry_set_text(GTK_ENTRY(dpd->dd->main_entry), (const gchar*) data->data);
+		}
+
+		dict_drag_data_received(widget, drag_context, x, y, data, info, ltime, dpd->dd);
+	}
+}
+
+
 static void dict_plugin_construct(XfcePanelPlugin *plugin)
 {
 	DictPanelData *dpd = g_new0(DictPanelData, 1);
@@ -389,8 +404,8 @@ static void dict_plugin_construct(XfcePanelPlugin *plugin)
 	gtk_drag_dest_set(GTK_WIDGET(dpd->panel_button), GTK_DEST_DEFAULT_ALL,
 		NULL, 0, GDK_ACTION_COPY | GDK_ACTION_MOVE);
 	gtk_drag_dest_add_text_targets(GTK_WIDGET(dpd->panel_button));
-	g_signal_connect(dpd->panel_button, "drag-data-received", G_CALLBACK(dict_drag_data_received), dpd->dd);
-	g_signal_connect(dpd->dd->panel_entry, "drag-data-received", G_CALLBACK(dict_drag_data_received), dpd->dd);
+	g_signal_connect(dpd->panel_button, "drag-data-received", G_CALLBACK(dict_plugin_drag_data_received), dpd);
+	g_signal_connect(dpd->dd->panel_entry, "drag-data-received", G_CALLBACK(dict_plugin_drag_data_received), dpd);
 
 	dict_gui_status_add(dpd->dd, _("Ready."));
 }
-- 
GitLab