[Xfce4-commits] <terminal:master> Don't add mailto when copying to clipboard (bug #7909).

Nick Schermer noreply at xfce.org
Fri Aug 26 11:08:01 CEST 2011


Updating branch refs/heads/master
         to ef00597472ae2cf25f502885f3cf52720a1a4e98 (commit)
       from e14fab288af3d582341fda786c348e7f1ac11188 (commit)

commit ef00597472ae2cf25f502885f3cf52720a1a4e98
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Aug 26 11:05:38 2011 +0200

    Don't add mailto when copying to clipboard (bug #7909).

 terminal/terminal-widget.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index 7087516..3eed37c 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -231,12 +231,20 @@ terminal_widget_context_menu_copy (TerminalWidget *widget,
   GtkClipboard *clipboard;
   const gchar  *wlink;
   GdkDisplay   *display;
+  gchar        *modified_wlink = NULL;
 
   wlink = g_object_get_data (G_OBJECT (item), "terminal-widget-link");
   if (G_LIKELY (wlink != NULL))
     {
       display = gtk_widget_get_display (GTK_WIDGET (widget));
 
+      /* strip mailto from links, bug #7909 */
+      if (g_str_has_prefix (wlink, "mailto:"))
+        {
+          modified_wlink = g_strdup (wlink + 7);
+          wlink = modified_wlink;
+        }
+
       /* copy the URI to "CLIPBOARD" */
       clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
       gtk_clipboard_set_text (clipboard, wlink, -1);
@@ -244,6 +252,8 @@ terminal_widget_context_menu_copy (TerminalWidget *widget,
       /* copy the URI to "PRIMARY" */
       clipboard = gtk_clipboard_get_for_display (display, GDK_SELECTION_PRIMARY);
       gtk_clipboard_set_text (clipboard, wlink, -1);
+
+      g_free (modified_wlink);
     }
 }
 


More information about the Xfce4-commits mailing list