2005-02-13 [colin] 1.0.1cvs5.2
[claws.git] / src / textview.c
index 8b2194e33161eb5e9a25f5bf47a7341135f2701a..831242566ec0c5a8cd78450b67dd958a4c76e811 100644 (file)
@@ -198,6 +198,9 @@ static void add_uri_to_addrbook_cb          (TextView       *textview,
 static void mail_to_uri_cb                     (TextView       *textview, 
                                                 guint           action, 
                                                 void           *data);
+static void copy_mail_to_uri_cb                        (TextView       *textview,
+                                                guint           action,
+                                                void           *data);
 
 static GtkItemFactoryEntry textview_link_popup_entries[] = 
 {
@@ -209,6 +212,7 @@ static GtkItemFactoryEntry textview_mail_popup_entries[] =
 {
        {N_("/_Add to addressbook"),    NULL, add_uri_to_addrbook_cb, 0, NULL},
        {N_("/_Email"),                 NULL, mail_to_uri_cb, 0, NULL},
+       {N_("/_Copy"),                  NULL, copy_mail_to_uri_cb, 0, NULL},
 };
 
 
@@ -981,7 +985,7 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
                        && (((bp_ + 1) < ep_)    && isalnum(*(bp_ + 1)))) {
                                /* hyphens are allowed, but only in
                                   between alnums */
-                       } else if (!ispunct(*bp_)) {
+                       } else if (!strchr(",;:=?./+<>!&", *bp_)) {
                                /* but anything not being a punctiation
                                   is ok */
                        } else {
@@ -2199,4 +2203,15 @@ static void mail_to_uri_cb (TextView *textview, guint action, void *data)
        compose_new(account, uri->uri + 7, NULL);
 }
 
+static void copy_mail_to_uri_cb        (TextView *textview, guint action, void *data)
+{
+       RemoteURI *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
+                                          "menu_button");
+       if (uri == NULL)
+               return;
+
+       gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), uri->uri + 7, -1);
+       g_object_set_data(G_OBJECT(textview->mail_popup_menu), "menu_button",
+                         NULL);
+}