From 504be8ba421045a16c60bd11dbe9e334a1576f0b Mon Sep 17 00:00:00 2001 From: raphael0202 Date: Sun, 20 Mar 2016 17:19:56 +0100 Subject: [Bug #1558160] Move Script::file_listener methods to script.cpp source file. Fixed bugs: - https://launchpad.net/bugs/1558160 (bzr r14727) --- src/extension/implementation/script.h | 45 +++-------------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) (limited to 'src/extension/implementation/script.h') diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 4cf33c989..684719895 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -85,49 +85,10 @@ private: }; bool isDead () { return _dead; } - - // TODO move these definitions into script.cpp - void init (int fd, Glib::RefPtr main) { - _channel = Glib::IOChannel::create_from_fd(fd); - _channel->set_encoding(); - _conn = main->get_context()->signal_io().connect(sigc::mem_fun(*this, &file_listener::read), _channel, Glib::IO_IN | Glib::IO_HUP | Glib::IO_ERR); - _main_loop = main; - - return; - }; - - bool read (Glib::IOCondition condition) { - if (condition != Glib::IO_IN) { - _main_loop->quit(); - return false; - } - - Glib::IOStatus status; - Glib::ustring out; - status = _channel->read_line(out); - _string += out; - - if (status != Glib::IO_STATUS_NORMAL) { - _main_loop->quit(); - _dead = true; - return false; - } - - return true; - }; - + void init(int fd, Glib::RefPtr main); + bool read(Glib::IOCondition condition); Glib::ustring string (void) { return _string; }; - - bool toFile (const Glib::ustring &name) { - try { - Glib::RefPtr stdout_file = Glib::IOChannel::create_from_file(name, "w"); - stdout_file->set_encoding(); - stdout_file->write(_string); - } catch (Glib::FileError &e) { - return false; - } - return true; - }; + bool toFile(const Glib::ustring &name); }; int execute (const std::list &in_command, -- cgit v1.2.3