Skip to content
Permalink
Browse files
Add bundle with delay and retry
As discussed in SL#4841, when installing activities via system
packages there is no guarantee that diretory contents are available
yet even if the GFileMonitor has detected the directory creation.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Signed-off-by: James Cameron <quozl@laptop.org>
  • Loading branch information
tchx84 authored and quozl committed Jun 25, 2015
1 parent b9c4cfd commit d3c0474
Showing 1 changed file with 9 additions and 1 deletion.
@@ -137,10 +137,18 @@ def __desktop_view_icons_changed_cb(self, model):
def __file_monitor_changed_cb(self, monitor, one_file, other_file,
event_type):
if event_type == Gio.FileMonitorEvent.CREATED:
self.add_bundle(one_file.get_path(), set_favorite=True)
# XXX SL4841 we can't guarantee the contents are all set yet
GLib.timeout_add(100, self.__timeout_add_cb, one_file.get_path())
elif event_type == Gio.FileMonitorEvent.DELETED:
self.remove_bundle(one_file.get_path())

def __timeout_add_cb(self, bundle_path):
try:
self.add_bundle(bundle_path, set_favorite=True)
return False
except:
return True

def _load_mime_defaults(self):
defaults = {}

0 comments on commit d3c0474

Please sign in to comment.