GNOME Bugzilla – Bug 132500
Location entry should do tilde expansion
Last modified: 2008-05-14 02:22:52 UTC
Open gedit with a blank document; type in "asdf" into the box. Proceed with a "File=>Save As" In the "Filename:" box, type "~/asdf " Click "Save" Await a dialog stating: Could not save the file "/home/matt/~/asdf". This behavior seems quite strange, for I can use "." and ".." in the "Filename:" box.
I'm moving this to gtk+ (GtkFileChoser) since also eog seems to not be able to save an image as ~/my_image.png.
Now that the file chooser uses an auxiliary dialog for the location entry, I'm retitling this bug. The location entry should support tilde expansion, as in typing "~/foo.txt", "~username/foo.txt".
*** Bug 136167 has been marked as a duplicate of this bug. ***
*** Bug 136770 has been marked as a duplicate of this bug. ***
Created attachment 25784 [details] [review] Patch with fix, untested for the VFS backend
The attached patch fixes this, and works fine with the Unix backend. I haven't tested it with the gnome-vfs backend; will do so after lunch.
Attaching another patch. This one puts the expansion logic in GtkFileSystem::parse, and makes GtkFileChooserEntry have the necessary checks for an "invalid" intermediate state.
Created attachment 25810 [details] [review] Updated patch.
JRB, can you please take a look at this?
It looked good to me -- I like the fact that you moved the ~ expansion code totally to the filesystem. Two quick thoughts 1) it needs to be ported to the libgnomeui backend too 2) you need a g_return_if_fail (str !=NULL) in gtk_file_system_parse().
Thanks, committed. It turns out that the VFS backend already did tilde expansion on its own.
/me brings out the evil eye... Is there a reason it disallows "~" or "~foo"? And why does it specifically allow "~nouser/oink"? Finally, I don't think it returns the expected value if the home directory is "/". (And what if it isn't absolute?)
Let's try to do this for 2.4.2. I'm not sure we can do it with the current GtkFileSystem API. I'm lowering the priority because although those cases don't work, you *can* still access those folders by other means --- type "~/" or "~foo/", or hit Alt-Home in the first case.
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as Matthias said he was trying to do himself on IRC and was asking for help with. If you see this message, it means I was successful at fixing the borken-ness in bugzilla :) Sorry for the spam; just query on this message and delete all emails you get with this message, since there will probably be a lot.