[Goodies-commits] r4568 - in xfce4-dict/trunk: . panel-plugin

Enrico Troeger enrico at xfce.org
Mon Apr 14 20:47:34 CEST 2008


Author: enrico
Date: 2008-04-14 18:47:34 +0000 (Mon, 14 Apr 2008)
New Revision: 4568

Modified:
   xfce4-dict/trunk/ChangeLog
   xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
Log:
Set entry text in the main window if text was dragged onto the panel button or into the panel entry.


Modified: xfce4-dict/trunk/ChangeLog
===================================================================
--- xfce4-dict/trunk/ChangeLog	2008-04-14 18:47:30 UTC (rev 4567)
+++ xfce4-dict/trunk/ChangeLog	2008-04-14 18:47:34 UTC (rev 4568)
@@ -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>

Modified: xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
===================================================================
--- xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-04-14 18:47:30 UTC (rev 4567)
+++ xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-04-14 18:47:34 UTC (rev 4568)
@@ -315,6 +315,21 @@
 }
 
 
+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 @@
 	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."));
 }




More information about the Goodies-commits mailing list