lib: Move idle function setup into lib/

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-09-12 08:06:44 -04:00
parent bc5e53a423
commit 0b5478c591
3 changed files with 7 additions and 1 deletions

View File

@ -120,7 +120,7 @@ bool on_idle()
void enable_idle()
{
Glib::signal_idle().connect(sigc::ptr_fun(on_idle));
lib :: idle(on_idle);
}

View File

@ -14,6 +14,7 @@ namespace lib
const std::string share_file(const std::string &);
Glib::RefPtr<Gtk::Builder> &get_builder();
const std::string key_name(GdkEventKey *);
void idle(bool (*)());
void schedule(bool (*)(), unsigned int);
template <class T>

View File

@ -43,6 +43,11 @@ const std::string lib :: key_name(GdkEventKey *event)
return key;
}
void lib :: idle(bool (*func)())
{
Glib :: signal_idle().connect(sigc::ptr_fun(func));
}
void lib :: schedule(bool (*func)(), unsigned int milliseconds)
{
Glib :: signal_timeout().connect(sigc::ptr_fun(func), milliseconds);