]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) #2625 "ability to create a magnet link" -- fix "Copy Magnet Link to Clipb...
authorCharles Kerr <charles@transmissionbt.com>
Wed, 9 Dec 2009 01:42:04 +0000 (01:42 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Wed, 9 Dec 2009 01:42:04 +0000 (01:42 +0000)
gtk/main.c

index 0137959860f4e7c68e056116cbe4b4ee541961b6..2805237079429441aaa62e5a4f7ca2efde5f328f 100644 (file)
@@ -1495,9 +1495,20 @@ copyMagnetLinkToClipboard( GtkWidget * w, tr_torrent * tor )
 {
     char * magnet = tr_torrentGetMagnetLink( tor );
     GdkDisplay * display = gtk_widget_get_display( w );
-    GdkAtom selection = GDK_SELECTION_CLIPBOARD;
-    GtkClipboard * clipboard = gtk_clipboard_get_for_display( display, selection );
+    GdkAtom selection;
+    GtkClipboard * clipboard;
+
+    /* this is The Right Thing for copy/paste... */
+    selection = GDK_SELECTION_CLIPBOARD;
+    clipboard = gtk_clipboard_get_for_display( display, selection );
+    gtk_clipboard_set_text( clipboard, magnet, -1 );
+
+    /* ...but people using plain ol' X need this instead */
+    selection = GDK_SELECTION_PRIMARY;
+    clipboard = gtk_clipboard_get_for_display( display, selection );
     gtk_clipboard_set_text( clipboard, magnet, -1 );
+
+    /* cleanup */
     tr_free( magnet );
 }