[evolution-patches] patch to enable 'copy email address' on right-click menu for email addresses



Hey,

So now I'm subscribed, no need to CC:-me. I've also got this other patch
that adds a 'copy email address' to the right-click menu for email
addresses. This has been a small problem for me and some friends for
some time, as it's much easier to simply right click the email and use
the copy menu item than it is to aim the edges of the link with the
mouse.

The patch is at the bugzilla's bug I opened (#69512) and also attached
to this message.

Thanks,

-- 
kov debian org: Gustavo Noronha <http://people.debian.org/~kov>
Debian:  <http://www.debian.org>  *  <http://www.debian-br.org>

--- em-popup.c~	2004-11-17 01:50:24 -0200
+++ em-popup.c	2004-11-17 01:50:28 -0200
@@ -33,6 +33,7 @@
 #include <gtk/gtkmenuitem.h>
 #include <gtk/gtkimagemenuitem.h>
 #include <gtk/gtkcheckmenuitem.h>
+#include <gtk/gtkclipboard.h>
 #include <gtk/gtkradiomenuitem.h>
 #include <gtk/gtkseparatormenuitem.h>
 #include <gtk/gtklabel.h>
@@ -855,10 +856,28 @@
 	camel_url_free(url);
 }
 
+static void
+emp_uri_popup_address_copy(GtkWidget *w, EMPopupTarget *t)
+{
+	GtkClipboard *cb;
+	gchar **uri_components = NULL;
+	gchar *address = NULL;
+
+	uri_components = g_strsplit (t->data.uri, ":", 2);
+	if (uri_components && (!strcmp ("mailto", uri_components[0])) && uri_components[1])
+		address = uri_components[1];
+	else
+		address = t->data.uri;
+
+	cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+	gtk_clipboard_set_text (cb, address, -1);
+}
+
 static EMPopupItem emp_standard_uri_popups[] = {
 	{ EM_POPUP_ITEM, "00.uri.00", N_("_Open Link in Browser"), G_CALLBACK(emp_uri_popup_link_open), NULL, NULL, EM_POPUP_URI_NOT_MAILTO },
 	{ EM_POPUP_ITEM, "00.uri.10", N_("Se_nd message to..."), G_CALLBACK(emp_uri_popup_address_send), NULL, NULL, EM_POPUP_URI_MAILTO },
 	{ EM_POPUP_ITEM, "00.uri.20", N_("_Add to Addressbook"), G_CALLBACK(emp_uri_popup_address_add), NULL, NULL, EM_POPUP_URI_MAILTO },
+	{ EM_POPUP_ITEM, "00.uri.30", N_("_Copy e-mail address"), G_CALLBACK(emp_uri_popup_address_copy), NULL, NULL, EM_POPUP_URI_MAILTO },
 };
 
 /* ********************************************************************** */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]