def do_gtk_bookmarks( self ):
if self.showGtkBookmarks:
bookmarksFile = os.path.join(GLib.get_user_config_dir(), "gtk-3.0", "bookmarks")
if not os.path.exists(bookmarksFile):
bookmarksFile = os.path.join(GLib.get_home_dir(), ".gtk-bookmarks")
if not os.path.exists(bookmarksFile):
return
bookmarks = []
with open(bookmarksFile, "r") as f:
for line in f:
#line = line.replace('file://', '')
line = line.rstrip()
if not line:
continue
parts = line.split(' ', 1)
if len(parts) == 2:
path, name = parts
elif len(parts) == 1:
path = parts[0]
name = os.path.basename(os.path.normpath(path))
bookmarks.append((name, path))
for name, path in bookmarks:
name = unquote(name)
currentbutton = easyButton( "folder", self.iconsize, [name], -1, -1 )
currentbutton.connect( "clicked", self.launch_gtk_bookmark, path )
currentbutton.show()
self.placesBtnHolder.pack_start( currentbutton, False, False, 0)
评论列表
文章目录