Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions src/FolderManager/FolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Scratch.FolderManager {
private bool has_dummy;
private Code.Widgets.SourceList.Item dummy; /* Blank item for expanded empty folders */

public bool loading_required {
private bool loading_required {
get {
return !children_loaded && n_children <= 1 && file.children.size > 0;
}
Expand Down Expand Up @@ -64,29 +64,33 @@ namespace Scratch.FolderManager {


public void load_children () {
if (loading_required) {
foreach (var child in file.children) {
add_child (child);
}
lock (loading_required) {
if (loading_required) {
foreach (var child in file.children) {
add_child (child);
}

after_children_loaded ();
after_children_loaded ();
}
}
}

private async void load_children_async () {
if (loading_required) {
foreach (var child in file.children) {
Idle.add (() => {
add_child (child);
load_children_async.callback ();
return Source.REMOVE;
});

yield;
lock (loading_required) {
if (loading_required) {
foreach (var child in file.children) {
Idle.add (() => {
add_child (child);
load_children_async.callback ();
return Source.REMOVE;
});

yield;
}
}
}

after_children_loaded ();
after_children_loaded ();
}
}

private void add_child (File child) {
Expand Down