2001-03-28 11:14:05 +00:00
|
|
|
/**
|
2002-03-11 22:47:41 +00:00
|
|
|
* \file gnome/Timeout_pimpl.C
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-28 11:14:05 +00:00
|
|
|
*
|
|
|
|
* \author Baruch Even
|
2002-03-14 14:03:54 +00:00
|
|
|
* \author Michael Koziarski
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-28 11:14:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-06-02 04:15:33 +00:00
|
|
|
#include <gtkmm/main.h>
|
2001-03-28 11:14:05 +00:00
|
|
|
#include "Timeout_pimpl.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
Timeout::Pimpl::Pimpl(Timeout * owner)
|
|
|
|
: owner_(owner)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::reset()
|
|
|
|
{
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
2002-03-14 14:03:54 +00:00
|
|
|
bool Timeout::Pimpl::running() const
|
|
|
|
{
|
2002-03-21 21:21:28 +00:00
|
|
|
return running_;
|
2002-03-14 14:03:54 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-03-28 11:14:05 +00:00
|
|
|
void Timeout::Pimpl::start()
|
|
|
|
{
|
|
|
|
if (conn_.connected()) {
|
|
|
|
lyxerr << "Timeout::start: already running!" << std::endl;
|
|
|
|
stop();
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-06-02 04:15:33 +00:00
|
|
|
conn_ = Gtk::Main::signal_timeout().connect(
|
|
|
|
SigC::slot(*this, &Timeout::Pimpl::timeoutEvent),
|
2001-03-28 11:14:05 +00:00
|
|
|
owner_->timeout_ms
|
|
|
|
);
|
2002-03-14 14:03:54 +00:00
|
|
|
running_ = true;
|
2001-03-28 11:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Timeout::Pimpl::stop()
|
|
|
|
{
|
|
|
|
conn_.disconnect();
|
2002-03-14 14:03:54 +00:00
|
|
|
running_ = false;
|
2001-03-28 11:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-02 04:15:33 +00:00
|
|
|
bool Timeout::Pimpl::timeoutEvent()
|
2001-03-28 11:14:05 +00:00
|
|
|
{
|
|
|
|
owner_->emit();
|
2002-06-02 04:15:33 +00:00
|
|
|
return false; // discontinue emitting timeouts.
|
2001-03-28 11:14:05 +00:00
|
|
|
}
|