Re: Nautilus location bar



В Чтв, 04/01/2007 в 18:52 +0100, Tom Parker пишет:
> On Thu, 04 Jan 2007 18:53:55 +0300, Виталий  Ищенко <betalb gmail com>
>  wrote: > I've tried to replace gnome_vfs_make_uri_from_input with >
>  gnome_vfs_make_uri_from_input_with_dirs(..., >
>  GNOME_VFS_MAKE_URI_DIR_CURRENT) (only in src/nautilus-location-bar.c)
> > but it's not suitable for autocomplete feature (whitespaces at the
>  end) > & it always fallback to $HOME as current directory, so it's a
>  bad fix. > It seems that g_get_current_dir() always returns $HOME > >
>  I tried to find similar bug in bugzilla, but failed. If there is any,
> > I'll add my comment, if not -- create new
> 
> This is http://bugzilla.gnome.org/show_bug.cgi?id=321592. I've attached a
> partial patch a while back, but it also needs an extended version of
> gnome_vfs_make_uri_from_input_with_trailing_ws (see bug for more details)
> before any more progress can be made.
> 
Thanks

Few remarks:
I've debugged GnomeVFS and nautilus a bit, and found, that it is
functional only for home directory. And when we change directory to some
other place it stops working, because g_get_current_dir() call in
gnome_vfs_make_uri_form_input_with_dirs(...) always returns $HOME.

I've attached my patch (only for location bar -- browser mode)

IMO relative paths should work not only for file://. But it seems that
all series of functions gnome_vfs_make_uri_from_input... cope only with
local paths, so they should be changed first.

If it's all OK with patch, I will add this functionality to
nautilus-location-dialog

> Tom Parker
> 
> -- 
> nautilus-list mailing list
> nautilus-list gnome org
> http://mail.gnome.org/mailman/listinfo/nautilus-list
--- nautilus-2.16.3.old/src/nautilus-location-bar.c	2006-10-18 17:12:07.000000000 +0400
+++ nautilus-2.16.3/src/nautilus-location-bar.c	2007-01-04 23:18:57.000000000 +0300
@@ -538,12 +538,26 @@
 nautilus_location_bar_get_location (NautilusNavigationBar *navigation_bar) 
 {
 	NautilusLocationBar *bar;
+	int chdir_status;
+	char *last_location;
+	char *current_dir;
 	char *user_location, *best_uri;
 
 	bar = NAUTILUS_LOCATION_BAR (navigation_bar);
 	
 	user_location = gtk_editable_get_chars (GTK_EDITABLE (bar->details->entry), 0, -1);
-	best_uri = gnome_vfs_make_uri_from_input (user_location);
+	last_location = gnome_vfs_get_local_path_from_uri (bar->details->last_location);
+	chdir_status = -1;
+	if (last_location != NULL) {
+		current_dir = g_get_current_dir ();
+		chdir_status = g_chdir (last_location);
+		g_free (last_location);
+	}
+	best_uri = gnome_vfs_make_uri_from_input_with_dirs (user_location, GNOME_VFS_MAKE_URI_DIR_CURRENT);
+	if (chdir_status == 0) {
+		g_chdir (current_dir);
+		g_free (current_dir);
+	}
 	g_free (user_location);
 	return best_uri;
 }


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