Skip to content
Permalink
Browse files
Add bundle with delay
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>
  • Loading branch information
tchx84 committed Jun 24, 2015
1 parent b9c4cfd commit 2b5c81e
Showing 1 changed file with 6 additions and 1 deletion.
@@ -137,10 +137,15 @@ 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(5000, 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):
self.add_bundle(bundle_path, set_favorite=True)
return False

def _load_mime_defaults(self):
defaults = {}

0 comments on commit 2b5c81e

Please sign in to comment.