X-Git-Url: http://git.code-monkey.de/?p=ruby-esmart.git;a=blobdiff_plain;f=src%2Fesmart_container%2Frb_esmart_container.c;fp=src%2Fesmart_container%2Frb_esmart_container.c;h=85b9fdc79f35d5d44a9803104edf1ebd24165212;hp=45e13f8958173a7ba5a93518cef1dedb8e7b936f;hb=f48bba2d3cf64903ab176f6f957589a0a9ffa660;hpb=d801ea49773d7c98540d1c01be877b17c52f1fb6 diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index 45e13f8..85b9fdc 100644 --- a/src/esmart_container/rb_esmart_container.c +++ b/src/esmart_container/rb_esmart_container.c @@ -1,5 +1,5 @@ /* - * $Id: rb_esmart_container.c 317 2005-04-25 21:48:10Z tilman $ + * $Id: rb_esmart_container.c 356 2006-02-10 18:27:31Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -45,20 +45,23 @@ static void c_free (RbContainer *e) free (e); } -static VALUE c_new (VALUE klass, VALUE evas) +static VALUE c_alloc (VALUE klass) { - VALUE self, argv[1]; - RbContainer *cont; + RbContainer *cont = NULL; + return Data_Make_Struct (klass, RbContainer, c_mark, + c_free, cont); +} + +static VALUE c_init (VALUE self, VALUE evas) +{ CHECK_CLASS (evas, cEvas); GET_OBJ (evas, RbEvas, e); + GET_OBJ (self, RbContainer, cont); - self = Data_Make_Struct (klass, RbContainer, c_mark, - c_free, cont); cont->real.real = esmart_container_new (e->real); - argv[0] = evas; - rb_obj_call_init (self, 1, argv); + rb_call_super (1, &evas); cont->elements = rb_ary_new (); @@ -280,7 +283,8 @@ void Init_esmart_container (void) c = rb_define_class_under (mEsmart, "Container", cEvasObject); - rb_define_singleton_method (c, "new", c_new, 1); + rb_define_alloc_func (c, c_alloc); + rb_define_method (c, "initialize", c_init, 1); rb_define_method (c, "direction", c_direction_get, 0); rb_define_method (c, "direction=", c_direction_set, 1); rb_define_method (c, "spacing", c_spacing_get, 0);