Fix crash on non-existing favorites
Corner case when rebuilding favs from scratch
This commit is contained in:
parent
89f9071bd4
commit
3ad195599b
@ -1223,20 +1223,13 @@ class pluginclass(object):
|
|||||||
# For Folders and Network Shares
|
# For Folders and Network Shares
|
||||||
location = "".join(location.split("%20"))
|
location = "".join(location.split("%20"))
|
||||||
|
|
||||||
# TODO: Do we still need this?
|
|
||||||
#For Special locations
|
|
||||||
if location == "x-nautilus-desktop:///computer":
|
|
||||||
location = "/usr/share/applications/nautilus-computer.desktop"
|
|
||||||
elif location == "x-nautilus-desktop:///home":
|
|
||||||
location = "/usr/share/applications/nautilus-home.desktop"
|
|
||||||
elif location == "x-nautilus-desktop:///network":
|
|
||||||
location = "/usr/share/applications/network-scheme.desktop"
|
|
||||||
elif location.startswith("x-nautilus-desktop:///"):
|
|
||||||
location = "/usr/share/applications/nautilus-computer.desktop"
|
|
||||||
|
|
||||||
if location.startswith("file://"):
|
if location.startswith("file://"):
|
||||||
location = location[7:]
|
location = location[7:]
|
||||||
|
|
||||||
|
if not os.path.exists(location):
|
||||||
|
print("%s does not exist, skipping." % location)
|
||||||
|
return None
|
||||||
|
|
||||||
# Don't add a location twice
|
# Don't add a location twice
|
||||||
for fav in self.favorites:
|
for fav in self.favorites:
|
||||||
if fav.type == "location" and fav.desktopFile == location:
|
if fav.type == "location" and fav.desktopFile == location:
|
||||||
@ -1278,6 +1271,7 @@ class pluginclass(object):
|
|||||||
position = 0
|
position = 0
|
||||||
|
|
||||||
for app in applicationsList:
|
for app in applicationsList:
|
||||||
|
try:
|
||||||
app = app.strip()
|
app = app.strip()
|
||||||
|
|
||||||
if app[0:9] == "location:":
|
if app[0:9] == "location:":
|
||||||
@ -1304,6 +1298,9 @@ class pluginclass(object):
|
|||||||
favButton.connect("drag-data-get", self.on_drag_data_get)
|
favButton.connect("drag-data-get", self.on_drag_data_get)
|
||||||
favButton.connect("drag-data-received", self.on_drag_data_received)
|
favButton.connect("drag-data-received", self.on_drag_data_received)
|
||||||
position += 1
|
position += 1
|
||||||
|
except Exception as e:
|
||||||
|
print("Can't add favorite: %s" % app)
|
||||||
|
print (e)
|
||||||
|
|
||||||
self.favoritesSave()
|
self.favoritesSave()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user