]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) #2608 "Add URLs by drag-and-drop" - add support for dragging magnet URLs...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 26 Nov 2009 04:57:26 +0000 (04:57 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 26 Nov 2009 04:57:26 +0000 (04:57 +0000)
gtk/main.c

index 022e554f5452d21f29d5e974fc0e30e6aa8c616b..0065b61ae43dc998ac8c17f7fa5a032998c8dac3 100644 (file)
@@ -806,25 +806,18 @@ gotdrag( GtkWidget         * widget UNUSED,
                 continue;
 
             /* walk past "file://", if present */
-            if( g_str_has_prefix( filename, "file:" ) )
-            {
+            if( g_str_has_prefix( filename, "file:" ) ) {
                 filename += 5;
                 while( g_str_has_prefix( filename, "//" ) )
                     ++filename;
             }
 
-            /* if the file doesn't exist, the first part
-               might be a hostname ... walk past it. */
-            if( !g_file_test( filename, G_FILE_TEST_EXISTS ) )
-            {
-                char * pch = strchr( filename + 1, '/' );
-                if( pch != NULL )
-                    filename = pch;
-            }
+            g_debug( "got from drag: [%s]", filename );
 
-            /* finally, add it to the list of torrents to try adding */
             if( g_file_test( filename, G_FILE_TEST_EXISTS ) )
                 paths = g_slist_prepend( paths, g_strdup( filename ) );
+            else
+                tr_core_add_from_url( data->core, filename );
         }
 
         /* try to add any torrents we found */