]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/Timeout_pimpl.C
A lean, clean and working start to the new, improved gnome frontend.
[lyx.git] / src / frontends / gnome / Timeout_pimpl.C
1 /**
2  * \file gnome/Timeout_pimpl.C
3  * Copyright 2001 LyX Team
4  * Read COPYING
5  *
6  * \author Baruch Even
7  * \author Michael Koziarski
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include <gnome--/main.h>
17 #include "Timeout_pimpl.h"
18 #include "debug.h"
19
20
21 Timeout::Pimpl::Pimpl(Timeout * owner)
22         : owner_(owner)
23 {
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_ = Gnome::Main::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 gint Timeout::Pimpl::timeoutEvent()
60 {
61         owner_->emit();
62         return 0; // discontinue emitting timeouts.
63 }