void *install_thread_f(gpointer data) { Installer* inst = (Installer*) data; std::vector<Job*>& jobs = inst->GetJobs(); try { for (size_t i = 0; i < jobs.size(); i++) { Job *j = jobs.at(i); inst->SetCurrentJob(j); j->Unzip(); } } catch (std::exception& e) { std::string message = e.what(); inst->SetError(message); } catch (std::string& e) { inst->SetError(e); } catch (...) { std::string message = "Unknown error"; inst->SetError(message); } inst->SetRunning(false); inst->SetCurrentJob(NULL); return NULL; }
static gboolean watcher(gpointer data) { Installer *i = (Installer*) data; if (i->DownloadFinished() && i->IsRunning()) { i->StartInstalling(); } if (!i->IsRunning()) { i->ShowError(); gtk_main_quit(); } else if (i->IsCancelled()) { i->SetError(std::string("Package installation cancelled")); i->ShowError(); gtk_main_quit(); } else { i->UpdateProgress(); } return i->IsRunning(); }
void *install_thread_f(gpointer data) { Installer* inst = (Installer*) data; std::vector<Job*>& jobs = Installer::instance->GetJobs(); try { for (size_t i = 0; i < jobs.size(); i++) { Job *j = jobs.at(i); inst->SetCurrentJob(j); j->Unzip(); // Wait for an unzip job to finish before actually cancelling if (inst->GetStage() == Installer::CANCEL_REQUEST) { inst->SetStage(Installer::CANCELLED); return NULL; } } } catch (std::exception& e) { std::string message = e.what(); inst->SetError(message); return NULL; } catch (std::string& e) { inst->SetError(e); return NULL; } catch (...) { std::string message = "Unknown error"; inst->SetError(message); return NULL; } inst->SetStage(Installer::SUCCESS); return NULL; }