Code

Extensions. Fix for Bug #668895 (Extensions with <check> tags fail to load).
[inkscape.git] / src / extension / timer.h
1 /*
2  * Here is where the extensions can get timed on when they load and
3  * unload.  All of the timing is done in here.
4  *
5  * Authors:
6  *   Ted Gould <ted@gould.cx>
7  *
8  * Copyright (C) 2004 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifndef INKSCAPE_EXTENSION_TIMER_H__
14 #define INKSCAPE_EXTENSION_TIMER_H__
16 #include <sigc++/sigc++.h>
17 #include <glibmm/timeval.h>
18 #include "extension-forward.h"
20 namespace Inkscape {
21 namespace Extension {
23 class ExpirationTimer {
24     /** \brief Circularly linked list of all timers */
25     static ExpirationTimer * timer_list;
26     /** \brief Which timer was on top when we started the idle loop */
27     static ExpirationTimer * idle_start;
28     /** \brief What the current timeout is */
29     static long timeout;
30     /** \brief Has the timer been started? */
31     static bool timer_started;
33     /** \brief Is this extension locked from being unloaded? */
34     int locked;
35     /** \brief Next entry in the list */
36     ExpirationTimer * next;
37     /** \brief When this timer expires */
38     Glib::TimeVal expiration;
39     /** \brief What extension this function relates to */
40     Extension * extension;
42     bool expired(void) const;
44     static bool idle_func (void);
45     static bool timer_func (void);
47 public:
48     ExpirationTimer(Extension * in_extension);
49     virtual ~ExpirationTimer(void);
51     void touch (void);
52     void lock (void)   { locked++;  };
53     void unlock (void) { locked--; };
55     /** \brief Set the timeout variable */
56     static void set_timeout (long in_seconds) { timeout = in_seconds; };
57 };
59 }; }; /* namespace Inkscape, Extension */
61 #endif /* INKSCAPE_EXTENSION_TIMER_H__ */
63 /*
64   Local Variables:
65   mode:c++
66   c-file-style:"stroustrup"
67   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
68   indent-tabs-mode:nil
69   fill-column:99
70   End:
71 */
72 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :