X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore%2Frb_ecore.c;h=0d18a9a3a3ea502e40d00de17d665a8b7a1d0d3c;hp=f950f7e0079f3a0e2fac96a50fb77b0b400e00da;hb=0f8d24c745efc1057f8d25ada1375c88a1ab2ed7;hpb=2188c2d3c4358727b204a81de3799ff970a43527 diff --git a/src/ecore/rb_ecore.c b/src/ecore/rb_ecore.c index f950f7e..0d18a9a 100644 --- a/src/ecore/rb_ecore.c +++ b/src/ecore/rb_ecore.c @@ -1,6 +1,4 @@ /* - * $Id: rb_ecore.c 109 2004-09-01 20:33:15Z tilman $ - * * Copyright (C) 2004 ruby-ecore team (see AUTHORS) * * This library is free software; you can redistribute it and/or @@ -25,7 +23,9 @@ #define __RB_ECORE_C #include "rb_ecore.h" #include "rb_timer.h" +#include "rb_animator.h" #include "rb_idler.h" +#include "rb_idle_enterer.h" #include "rb_event_handler.h" #include "rb_fd_handler.h" @@ -70,6 +70,12 @@ static VALUE m_main_loop_quit (VALUE self) return Qnil; } +static VALUE m_time_get (VALUE self) +{ + return rb_float_new (ecore_time_get ()); +} + +#if 0 static VALUE c_ev_exe_exit_init (VALUE self, VALUE event) { VALUE c = CLASS_OF (self); @@ -89,6 +95,7 @@ static VALUE c_ev_exe_exit_init (VALUE self, VALUE event) return self; } +#endif static VALUE c_ev_sig_user_init (VALUE self, VALUE event) { @@ -128,10 +135,19 @@ static VALUE c_ev_sig_rt_init (VALUE self, VALUE event) return self; } +static void at_exit () +{ + ecore_shutdown (); +} + void Init_ecore (void) { VALUE c; + ecore_init (); + + atexit (at_exit); + mEcore = rb_define_module ("Ecore"); rb_define_module_function (mEcore, "main_loop_begin", @@ -140,39 +156,42 @@ void Init_ecore (void) m_main_loop_iterate, 0); rb_define_module_function (mEcore, "main_loop_quit", m_main_loop_quit, 0); + rb_define_module_function (mEcore, "time", m_time_get, 0); Init_Timer (); + Init_Animator (); Init_Idler (); + Init_IdleEnterer (); Init_EventHandler (); Init_FdHandler (); /* SIGNAL_HUP */ - ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_HUP, - "SignalHup", c); - rb_define_private_method (c, "initialize", c_ev_generic_init, 1); + ADD_EVENT (mEcore, ECORE_EVENT_SIGNAL_HUP, + "SignalHupEvent", c); /* SIGNAL_POWER */ - ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_POWER, - "SignalPower", c); - rb_define_private_method (c, "initialize", c_ev_generic_init, 1); + ADD_EVENT (mEcore, ECORE_EVENT_SIGNAL_POWER, + "SignalPowerEvent", c); +#if 0 /* EXE_EXIT */ - ADD_EVENT (mEcore, ECORE_EVENT_, EXE_EXIT, "ExeExit", c); + ADD_EVENT (mEcore, ECORE_EVENT_EXE_EXIT, "ExeExitEvent", c); rb_define_private_method (c, "initialize", c_ev_exe_exit_init, 1); +#endif /* SIGNAL_USER */ - ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_USER, - "SignalUser", c); + ADD_EVENT (mEcore, ECORE_EVENT_SIGNAL_USER, + "SignalUserEvent", c); rb_define_private_method (c, "initialize", c_ev_sig_user_init, 1); /* SIGNAL_EXIT */ - ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_EXIT, - "SignalExit", c); + ADD_EVENT (mEcore, ECORE_EVENT_SIGNAL_EXIT, + "SignalExitEvent", c); rb_define_private_method (c, "initialize", c_ev_sig_exit_init, 1); /* SIGNAL_REALTIME */ - ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_REALTIME, - "SignalRealtime", c); + ADD_EVENT (mEcore, ECORE_EVENT_SIGNAL_REALTIME, + "SignalRealtimeEvent", c); rb_define_private_method (c, "initialize", c_ev_sig_rt_init, 1); }