int64 sofar;
int64 total;
bool running;
+ uint source_id;
unowned IMDbSqlite sqlite;
string[] mirrors = {
"ftp.fu-berlin.de/pub/misc/movies/database/",
return;
}
running = true;
+ if (source_id != 0) {
+ Source.remove (source_id);
+ }
+
message ("Download started (%x).", flags);
progress (0);
download_imdb_async.begin ("ftp://anonymous@" + mirror, flags, Priority.DEFAULT_IDLE);
m = yield movies.find_enclosing_mount_async(io_priority, cancellable);
} else {
running = false;
+ timeout_quit ();
return;
}
} catch (Error e1) {
critical ("Failed to mount: %s\n", e1.message);
running = false;
+ timeout_quit ();
return;
}
}
sqlite = null;
running = false;
- // FIXME - use a timeout?
- loop.quit ();
+ timeout_quit ();
+ }
+
+ private void timeout_quit () {
+ source_id = Timeout.add (3000, quit);
}
+ private bool quit () {
+ loop.quit ();
+
+ // One-shot only
+ return false;
+ }
+
async void download_async (File f, LineParser parser, int io_priority) throws Error {
int percent = 0;
unowned string line = null;