Class instantiation fixes.
[ruby-evas.git] / src / rb_evas_object.c
index 22b03153f88988d5006940df84fd99239b16f914..a35477ab340b74070b0d34ae4ce5e46a4c6f07ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_evas_object.c 350 2006-02-08 21:13:34Z tilman $
+ * $Id: rb_evas_object.c 354 2006-02-10 18:14:08Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -66,6 +66,19 @@ void c_evas_object_free (RbEvasObject *e, bool free_mem)
                free (e);
 }
 
+static void c_free (RbEvasObject *e)
+{
+       c_evas_object_free (e, true);
+}
+
+static VALUE c_alloc (VALUE klass)
+{
+       RbEvasObject *e;
+
+       return Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
+                                c_free, e);
+}
+
 /* :nodoc: */
 static VALUE c_init (VALUE self, VALUE parent)
 {
@@ -565,8 +578,7 @@ void Init_EvasObject (void)
        cEvasObject = rb_define_class_under (mEvas, "EvasObject",
                                             rb_cObject);
 
-       rb_define_private_method (rb_singleton_class (cEvasObject),
-                                 "new", NULL, 0);
+       rb_define_alloc_func (cEvasObject, c_alloc);
        rb_define_method (cEvasObject, "initialize", c_init, 1);
        rb_define_method (cEvasObject, "inspect", c_inspect, 0);
        rb_define_method (cEvasObject, "type", c_type_get, 0);