Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/copy-tool/ChangeLog,v
retrieving revision 1.10
diff -u -p -r1.10 ChangeLog
--- ChangeLog	30 Nov 2005 08:07:58 -0000	1.10
+++ ChangeLog	19 May 2006 12:51:41 -0000
@@ -1,3 +1,8 @@
+2006-05-19  Hiroyuki Ikezoe  <poincare@ikezoe.net>
+
+	** Fixes bug #322771
+	* copy-tool.c: Use GtkClipboard instead of GtkInvisible.
+
 2005-11-30  Simon Zheng  <Simon.Zheng@Sun.Com>
 
 	Fix for 322733.
Index: copy-tool.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/copy-tool/copy-tool.c,v
retrieving revision 1.3
diff -u -p -r1.3 copy-tool.c
--- copy-tool.c	30 Nov 2005 08:07:58 -0000	1.3
+++ copy-tool.c	19 May 2006 12:51:41 -0000
@@ -13,78 +13,41 @@
 
 #include <glib/gi18n-lib.h>
 #include <string.h>
-#include <stdio.h>
 
 #include "mail/em-popup.h"
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtkselection.h>
+#include <gtk/gtkclipboard.h>
 
 #include "camel/camel-internet-address.h"
 #include "camel/camel-url.h"
 
-static GtkWidget *invisible;
-static char *address_uri;
-
 void org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t);
 
 void
 org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t)
 {
-	g_free(address_uri);
-	address_uri = g_strdup(t->uri);
-
-	gtk_selection_owner_set(invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
-	gtk_selection_owner_set(invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
-}
-
-static void
-ct_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, void *dummy)
-{
-	if (address_uri && (strncmp (address_uri, "mailto:", 7) == 0)) {
+	if  (t->uri) {
 		CamelInternetAddress *cia = camel_internet_address_new();
 		CamelURL *curl;
+		GtkClipboard *clipboard;
 		char *addr;
 		const char *tmp;
 
-		curl = camel_url_new(address_uri, NULL);
+		curl = camel_url_new(t->uri, NULL);
 		camel_address_decode((CamelAddress *)cia, curl->path);
 		/* should it perhaps use address format? */
 		addr = camel_address_encode((CamelAddress *)cia);
-		tmp = addr && addr[0] ? addr : address_uri + 7;
+		tmp = addr && addr[0] ? addr : t->uri + 7;
 
-		gtk_selection_data_set(data, data->target, 8, tmp, strlen(tmp));
-		g_free(addr);
-		camel_url_free(curl);
-		camel_object_unref(cia);
-	}
-}
+		clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
 
-static void
-ct_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, void *dummy)
-{
-	g_free(address_uri);
-	address_uri = NULL;
-}
-
-int e_plugin_lib_enable(EPluginLib *ep, int enable);
+		gtk_clipboard_set_text (clipboard, tmp, strlen (tmp));
 
-int
-e_plugin_lib_enable(EPluginLib *ep, int enable)
-{
-	if (enable) {
-		invisible = gtk_invisible_new();
-		g_signal_connect(invisible, "selection_get", G_CALLBACK(ct_selection_get), NULL);
-		g_signal_connect(invisible, "selection_clear_event", G_CALLBACK(ct_selection_clear_event), NULL);
-		gtk_selection_add_target(invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
-		gtk_selection_add_target(invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
-	} else {
-		g_free(address_uri);
-		address_uri = NULL;
-		gtk_widget_destroy(invisible);
-		invisible = NULL;
-	}
+		clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+		gtk_clipboard_set_text (clipboard, tmp, strlen (tmp));
 
-	return 0;
+		g_free(addr);
+		camel_url_free(curl);
+		camel_object_unref(cia);
+	}	
 }
