goodmind / sunflower-fm

Automatically exported from code.google.com/p/sunflower-fm
GNU General Public License v3.0
1 stars 0 forks source link

Incorrect display spaces and non-ASCII characters in the names of system bookmarks #273

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Append system bookmark with spaces or not ascii symbols in path (for 
example, using nautilus for directory: "/tmp/Directory name with spaces")
2. Enable system bookmarks in settings.

What is the expected output? What do you see instead?

For example, if append in system bookmarks: "Directory name with spaces", in 
bookmark menu will show "Directory%20name%20with%20spaces".

$ cat ~/.gtk-bookmarks
file:///tmp/Directory%20name%20with%20spaces
file:///tmp/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%BE%D1%8F%D0%B7%D1%8B%D1%87%D0%BD%D
0%BE%D0%B5%20%D0%B8%D0%BC%D1%8F%20%D0%BF%D0%B0%D0%BF%D0%BA%D0%B8

Sunflower 0.1a (54)

$ uname -a
Linux 3.5.0-030500-generic #201207211835 SMP Sat Jul 21 22:43:08 UTC 2012 i686 
athlon i386 GNU/Linux

$ nautilus --version
GNOME nautilus 3.4.2

The proposed solution (for Sunflower 0.1a (54)):

--- /tmp/Sunflower/application/gui/main_window.py
+++ /tmp/Sunflower_patched/application/gui/main_window.py
@@ -10,6 +10,7 @@
 import shlex
 import subprocess
 import glib
+import urllib

 from menus import MenuManager
 from mounts import MountsManager
@@ -773,7 +774,7 @@

                except:
                    uri = line.strip()
-                   name = os.path.basename(uri)
+                   name = os.path.basename(uri if not '://' in uri else 
urllib.unquote(uri.split('://', 1)[1]))

                # add entry
                self.bookmarks.add_bookmark(name, 'folder', uri, system=True)

Original issue reported on code.google.com by y.ponomaryov on 26 Feb 2013 at 10:55

GoogleCodeExporter commented 9 years ago
Thanks for your reply and patch. :) I changed it a bit to fit coding style.

Original comment by MeanEYE.rcf on 26 Feb 2013 at 3:12