added ecore_job wrapper implementation

SVN revision: 48529
This commit is contained in:
Andreas Volz 2010-05-01 20:42:51 +00:00
parent 908d062498
commit 541bab2c07
5 changed files with 88 additions and 2 deletions

View File

@ -12,6 +12,7 @@
#include "EvasWindow.h"
#include "Timer.h"
#include "XWindow.h"
#include "Job.h"
#endif // ECOREXX_H

View File

@ -0,0 +1,46 @@
#ifndef ECORE_JOB_H
#define ECORE_JOB_H
/* EFL */
#include <Ecore.h>
#include <sigc++/sigc++.h>
namespace Ecorexx {
class Job
{
public:
/*!
* Add a job to the event queue.
*/
Job ();
/*!
* Delete a queued job that has not yet been executed.
*/
virtual ~Job ();
/*!
* Starts the job
*/
void start ();
/*!
* Cancels the job if not yet runned
*/
void cancel ();
sigc::signal <void> signalCall;
private:
static void callback (void *data);
private:
Ecore_Job *mJob;
bool mCalled;
};
} // end namespace Ecorexx
#endif // ECORE_JOB_H

View File

@ -5,7 +5,8 @@ libecorexx_HEADERS = \
XWindow.h \
Animator.h \
Timer.h \
Ecorexx.h
Ecorexx.h \
Job.h
libecorexxdir = \
$(pkgincludedir)

37
ecorexx/src/Job.cpp Normal file
View File

@ -0,0 +1,37 @@
/* Project */
#include "../include/ecorexx/Job.h"
namespace Ecorexx {
Job::Job () :
mJob (NULL),
mCalled (false)
{
}
Job::~Job ()
{
}
void Job::start ()
{
mJob = ecore_job_add (Job::callback, this);
mCalled = false;
}
void Job::cancel ()
{
if (mJob && !mCalled)
{
ecore_job_del (mJob);
}
}
void Job::callback (void *data)
{
Job *job = static_cast <Job*> (data);
job->signalCall.emit ();
job->mCalled = true;
}
} // end namespace Ecorexx

View File

@ -20,7 +20,8 @@ libecorexx_la_SOURCES = \
EvasWindow.cpp \
XWindow.cpp \
Animator.cpp \
Timer.cpp
Timer.cpp \
Job.cpp
libecorexx_la_LIBADD = \
$(EFL_LIBS)