projects
/
ruby-ecore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added .gitignore.
[ruby-ecore.git]
/
src
/
ecore
/
rb_idler.c
diff --git
a/src/ecore/rb_idler.c
b/src/ecore/rb_idler.c
index d03a5ba8f0abe34c7c65e0cd039f3b1f5315d6ca..41f1cb30711f46892a2fb70a054f0bbd3cd57e70 100644
(file)
--- a/
src/ecore/rb_idler.c
+++ b/
src/ecore/rb_idler.c
@@
-1,6
+1,4
@@
/*
/*
- * $Id: rb_idler.c 154 2004-12-09 18:49:18Z tilman $
- *
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
* This library is free software; you can redistribute it and/or
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
* This library is free software; you can redistribute it and/or
@@
-62,6
+60,15
@@
static void c_free (RbIdler *idler)
free (idler);
}
free (idler);
}
+static VALUE c_alloc (VALUE klass)
+{
+ RbIdler *idler;
+
+ ecore_init ();
+
+ return Data_Make_Struct (klass, RbIdler, c_mark, c_free, idler);
+}
+
/*
* call-seq:
* Ecore::Idler.new { block } => idler
/*
* call-seq:
* Ecore::Idler.new { block } => idler
@@
-70,24
+77,17
@@
static void c_free (RbIdler *idler)
* When Ecore is idle, the specified block will be called.
* If the block returns false, the idler is deleted.
*/
* When Ecore is idle, the specified block will be called.
* If the block returns false, the idler is deleted.
*/
-static VALUE c_
new (VALUE klass
)
+static VALUE c_
init (VALUE self
)
{
{
- VALUE self;
- RbIdler *idler;
+ GET_OBJ (self, RbIdler, idler);
if (!rb_block_given_p ())
if (!rb_block_given_p ())
- return Qnil;
-
- self = Data_Make_Struct (klass, RbIdler, c_mark, c_free, idler);
-
- ecore_init ();
+ rb_raise (rb_eStandardError, "block missing");
idler->callback = rb_block_proc ();
idler->deleted = false;
idler->real = ecore_idler_add (on_idler, idler);
idler->callback = rb_block_proc ();
idler->deleted = false;
idler->real = ecore_idler_add (on_idler, idler);
- rb_obj_call_init (self, 0, NULL);
-
return self;
}
return self;
}
@@
-115,6
+115,7
@@
void Init_Idler (void)
{
VALUE c = rb_define_class_under (mEcore, "Idler", rb_cObject);
{
VALUE c = rb_define_class_under (mEcore, "Idler", rb_cObject);
- rb_define_singleton_method (c, "new", c_new, 0);
+ rb_define_alloc_func (c, c_alloc);
+ rb_define_method (c, "initialize", c_init, 0);
rb_define_method (c, "delete", c_delete, 0);
}
rb_define_method (c, "delete", c_delete, 0);
}