Re: PATCH: make link creation from dragged URIs work



On Fri, 10 May 2002, Frank Worsley wrote:

> Hi all,
> 
> right now link creation from dragged URIs in Nautilus doesn't work.
> There are several easy ways to demonstrate this, my favourite example
> follows:
> 
> - run gnome-about
> - drag one of the link buttons onto your desktop
> - you will notice nautilus freezing and your net connection working
> - after a while nautilus comes back, but there is a weird "No name" link
> on your desktop that does nothing
> 
> Another example is to drag the label from the location bar to create a
> link. It wont work either.
> 
> The problem is caused by the fact that Nautilus tries to load a desktop
> item from the URI, even if the URI doesn't represent a desktop item.
> Even worse, it doesn't take non-local URIs into account - so in the case
> of the gnome-about buttons it actually downloads the document from the
> Gnome.org site!
> 
> The two attached patches, one for nautilus and one for
> gnome-desktop-item fix this. Somebody please review them and commit if
> ok.
> 
> Also, with these patches I don't pass in an icon for the link, so the
> default gnome icon for desktop items is used. This doesn't look very
> good because the default icon kinda sucks. A better solution might be to
> use the default icon for the MIME type as the icon for the link. If this
> patch is acceptable I will send a second patch implementing that.
> 

@@ -2332,12 +2332,22 @@
 		container_path = gnome_vfs_get_local_path_from_uri (container_uri_string);
 		for (node = real_uri_list; node != NULL; node = node->next) {
 			/* Make a link using the desktop file contents? */
-			uri = node->data;
-			entry = gnome_desktop_item_new_from_uri (uri, 0, NULL);
+			uri = gnome_vfs_get_local_path_from_uri (node->data);
+
+			if (uri != NULL) {
+				entry = gnome_desktop_item_new_from_uri (uri,
+									 GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
+									 NULL);
+			} else {
+				entry = NULL;
+				uri = g_strdup (node->data);
+			}
+			
 			if (entry != NULL) {
 				/* FIXME: Handle name conflicts? */
 				nautilus_link_local_create_from_gnome_entry (entry, container_path, &point);
 
+				g_free (uri);
 				gnome_desktop_item_unref (entry);
 				continue;
 			}



Hmm. Why are you passing a local filename to 
gnome_desktop_item_new_from_uri()? It's supposed to get a URI. 

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a deeply religious moralistic paranormal investigator with a passion for 
fast cars. She's a blind green-skinned mermaid trying to make a difference in 
a man's world. They fight crime! 




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