X-Git-Url: http://git.code-monkey.de/?p=ruby-evas.git;a=blobdiff_plain;f=src%2Frb_evas_object.c;h=6e93a8fe3bec6fc5eaae14243988e7d918171d40;hp=c2d39af4f9c7661dd90e69a6638e98f80620cdf6;hb=e012a51b703ddd23c407d308602246d07ff73d2e;hpb=500e6a3cfce4f63197eed8805f206d0fb825daaa diff --git a/src/rb_evas_object.c b/src/rb_evas_object.c index c2d39af..6e93a8f 100644 --- a/src/rb_evas_object.c +++ b/src/rb_evas_object.c @@ -1,5 +1,5 @@ /* - * $Id: rb_evas_object.c 302 2005-03-22 17:41:35Z tilman $ + * $Id: rb_evas_object.c 304 2005-03-22 17:51:51Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -52,6 +52,9 @@ void c_evas_object_mark (RbEvasObject *e) if (!NIL_P (e->callbacks)) rb_gc_mark (e->callbacks); + + if (!NIL_P (e->userdata)) + rb_gc_mark (e->userdata); } void c_evas_object_free (RbEvasObject *e, bool free_mem) @@ -489,6 +492,16 @@ static VALUE c_below_get (VALUE self) return TO_EVAS_OBJECT (evas_object_below_get (e->real)); } +static VALUE c_userdata_get (VALUE self) +{ + GET_OBJ (self, RbEvasObject, e); + + if (NIL_P (e->userdata)) + e->userdata = rb_hash_new (); + + return e->userdata; +} + void Init_EvasObject (void) { cEvasObject = rb_define_class_under (mEvas, "EvasObject", @@ -526,4 +539,5 @@ void Init_EvasObject (void) rb_define_method (cEvasObject, "stack_below", c_stack_below, 1); rb_define_method (cEvasObject, "above", c_above_get, 0); rb_define_method (cEvasObject, "below", c_below_get, 0); + rb_define_method (cEvasObject, "userdata", c_userdata_get, 0); }