-
-ConvProcess::ConvProcess(string const & script_file,
- string const & script_command,
- string const & to_file, SignalTypePtr on_finish)
- : script_file_(script_file), to_file_(to_file), on_finish_(on_finish)
-{
- Forkedcall::SignalTypePtr convert_ptr;
- convert_ptr.reset(new Forkedcall::SignalType);
-
- convert_ptr->connect(SigC::slot(this, &ConvProcess::converted));
-
- Forkedcall call;
- int retval = call.startscript(script_command, convert_ptr);
- if (retval > 0) {
- // Unable to even start the script, so clean-up the mess!
- converted(string(), 0, 1);
- }
-}
-
-
-void ConvProcess::converted(string /* cmd */, pid_t /* pid */, int retval)
-{
- // Clean-up behind ourselves
- lyx::unlink(script_file_);
-
- if (retval > 0) {
- lyx::unlink(to_file_);
- to_file_.erase();
- }
-
- if (on_finish_.get()) {
- on_finish_->emit(to_file_);
- }
-
- grfx::GConverter::get().erase(this);
-}
-
-
-} // namespace grfx