tasn pushed a commit to branch master. http://git.enlightenment.org/bindings/cxx/eflxx.git/commit/?id=7779b257d10f632669ba8849e291bce5e9b91031
commit 7779b257d10f632669ba8849e291bce5e9b91031 Author: Andreas Volz <[email protected]> Date: Sun Mar 6 08:32:46 2011 +0000 changed Timer API (I'm still not happy with this interface, I need to redesign it!) SVN revision: 57537 --- ecorexx/include/ecorexx/Application.h | 4 ---- ecorexx/include/ecorexx/Timer.h | 10 ++++++---- ecorexx/src/Application.cpp | 7 ------- ecorexx/src/Timer.cpp | 12 ++++++------ 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/ecorexx/include/ecorexx/Application.h b/ecorexx/include/ecorexx/Application.h index 0ef6252..993758d 100644 --- a/ecorexx/include/ecorexx/Application.h +++ b/ecorexx/include/ecorexx/Application.h @@ -63,10 +63,6 @@ public: static void processOneEvent(); static void quit(); - /* Timer */ - void startTimer( double seconds ); - virtual void timerEvent( Timer* ) {}; - /* Font */ /*EvasFont font(); EvasFont fixedFont(); diff --git a/ecorexx/include/ecorexx/Timer.h b/ecorexx/include/ecorexx/Timer.h index 301bac3..50b7efd 100644 --- a/ecorexx/include/ecorexx/Timer.h +++ b/ecorexx/include/ecorexx/Timer.h @@ -9,11 +9,13 @@ namespace Ecorexx { +// TODO: maybe change signal architecture back to callback architecture. Think about it! + class Timer { - typedef sigc::signal <void,Timer*> Signal; - typedef sigc::signal <void,Timer*> Loop; - typedef sigc::slot1 <void,Timer*> Slot; + typedef sigc::signal <void> Signal; + typedef sigc::signal <void> Loop; + //typedef sigc::slot1 <void, void> Slot; public: Timer( double seconds, bool singleshot = false ); @@ -21,7 +23,7 @@ public: //virtual void tick(); - static Timer* singleShot( double seconds, const Timer::Slot& ); // TODO: CountedPtr +// static Timer* singleShot( double seconds, const Timer::Slot& ); // TODO: CountedPtr void del (); diff --git a/ecorexx/src/Application.cpp b/ecorexx/src/Application.cpp index 11f8aa0..aad4cb7 100644 --- a/ecorexx/src/Application.cpp +++ b/ecorexx/src/Application.cpp @@ -104,13 +104,6 @@ void Application::quit() ecore_main_loop_quit(); } -void Application::startTimer( double seconds ) -{ - // FIXME: why is this needed? Who deletes this Timer object? - Timer* ecoretimer = new Timer( seconds ); - ecoretimer->timeout.connect( sigc::mem_fun( this, &Application::timerEvent ) ); -} - /*EvasFont Application::font() { assert( _font ); diff --git a/ecorexx/src/Timer.cpp b/ecorexx/src/Timer.cpp index e4a788b..5ebf9a4 100644 --- a/ecorexx/src/Timer.cpp +++ b/ecorexx/src/Timer.cpp @@ -24,12 +24,11 @@ Timer::~Timer() ecore_timer_del( _et ); } -Timer* Timer::singleShot( double seconds, const Timer::Slot& slot ) +/*Timer* Timer::singleShot( double seconds, const Timer::Slot& slot ) { Timer* ecoretimer = new Timer( seconds, true ); ecoretimer->timeout.connect( slot ); - return ecoretimer; -} +}*/ void Timer::del () { @@ -85,11 +84,12 @@ Eina_Bool Timer::__dispatcher( void* data ) { Timer* object = reinterpret_cast<Timer*>( data ); assert( object ); - object->timeout.emit( object ); + object->timeout.emit( ); //object->tick(); - bool singleshot = object->_ss; + /*bool singleshot = object->_ss; if ( singleshot ) delete object; - return singleshot? 0:1; + return singleshot? 0:1;*/ + return ECORE_CALLBACK_RENEW; } } // end namespace Ecorexx --
