7
bookmarks_index = deskbar.indexer.Index()
10
def load_gtk_bookmarks():
11
bookmarks_index.clear()
14
for line in file(deskbar.HOME_DIR + "/.gtk-bookmarks"):
15
line = line.replace("%20", " ").strip()
16
if gnomevfs.exists(line):
17
if line.startswith("file://"):
19
if line.startswith(deskbar.HOME_DIR):
20
line = "~" + line[len(deskbar.HOME_DIR):]
21
sorted_lines.append(line)
23
for path in sorted_lines:
24
head, tail = os.path.split(path)
25
bookmarks_index.add(tail, (path, tail))
31
def add_to_completions(self, text, completions, handler_icon, check_can_handle=True):
33
for (path, tail) in bookmarks_index.look_up(text):
34
d = "Open the bookmark <b>%s</b> (%s)" % \
35
(deskbar.escape_markup(tail), deskbar.escape_markup(path))
36
completions.append([d, name, path, deskbar.FOLDER_BOOKMARK_IMAGE.get_pixbuf()])
41
return "Handler_Gtk_Bookmarks"
44
def can_handle(self, text):
48
def handle(self, text, check_can_handle=True):
49
deskbar.run_command("gnome-open \"%s\"", text)