]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/Timeout_pimpl.C
applying Martin Craig's gnome patch. Upgrading to gtkmm-2.0+ from the 1.3 developmen...
[lyx.git] / src / frontends / gnome / Timeout_pimpl.C
1 /**
2  * \file gnome/Timeout_pimpl.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Baruch Even
7  * \author Michael Koziarski
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include <glibmm/main.h>
19 #include "Timeout_pimpl.h"
20 #include "debug.h"
21
22 Timeout::Pimpl::Pimpl(Timeout * owner)
23   : owner_(owner)
24 {
25 }
26
27 void Timeout::Pimpl::reset()
28 {
29         stop();
30 }
31
32 bool Timeout::Pimpl::running() const
33 {
34         return running_;
35 }
36
37 void Timeout::Pimpl::start()
38 {
39         if (conn_.connected()) {
40                 lyxerr << "Timeout::start: already running!" << std::endl;
41                 stop();
42         }
43
44         conn_ = Glib::signal_timeout().connect(
45                          SigC::slot(*this, &Timeout::Pimpl::timeoutEvent),
46                          owner_->timeout_ms
47                         );
48         running_ = true;
49 }
50
51
52 void Timeout::Pimpl::stop()
53 {
54         conn_.disconnect();
55         running_ = false;
56 }
57
58
59 bool Timeout::Pimpl::timeoutEvent()
60 {
61         owner_->emit();
62         return false; // discontinue emitting timeouts.
63 }