- obj = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_object_free, smart);
- smart->real = evas_object_smart_add (e->real, *s);
+ /* check whether the smart object has been created already */
+ smart = rb_const_get (klass, id_smart_object);
+ if (!NIL_P (smart))
+ Data_Get_Struct (smart, Evas_Smart *, s);
+ else {
+ name = rb_class_path (klass);
+
+ smart = Data_Make_Struct (rb_cObject, Evas_Smart *, NULL, NULL, s);
+
+ *s = evas_smart_new (StringValuePtr (name),
+ NULL, on_delete, on_layer_set,
+ on_raise, on_lower, on_stack_above,
+ on_stack_below, on_move, on_resize,
+ on_show, on_hide, on_color_set,
+ on_clip_set, on_clip_unset, NULL);
+
+ rb_mod_remove_const(klass, ID2SYM (id_smart_object));
+ rb_const_set (klass, id_smart_object, smart);
+ }