Introduced TO_EVAS_OBJECT.
[ruby-evas.git] / src / rb_evas.c
index 3e333a59dd9c2c1847c29b157380419f8436522f..c581e4f12e1cd86f8453bd65db8b91ce781887fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_evas.c 58 2004-08-10 14:10:02Z tilman $
+ * $Id: rb_evas.c 68 2004-08-16 15:42:19Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -253,19 +253,13 @@ static VALUE c_image_cache_flush (VALUE self)
 static VALUE c_top_get (VALUE self)
 {
        Evas_Object *o;
-       void *obj;
 
        GET_OBJ (self, RbEvas, e);
 
        if (!(o = evas_object_top_get (e->real)))
                return Qnil;
 
-       if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
-               rb_raise (rb_eException, "EvasObject Ruby object key missing");
-               return Qnil;
-       }
-
-       return (VALUE) obj;
+       return TO_EVAS_OBJECT (o);
 }
 
 /*
@@ -277,19 +271,13 @@ static VALUE c_top_get (VALUE self)
 static VALUE c_bottom_get (VALUE self)
 {
        Evas_Object *o;
-       void *obj;
 
        GET_OBJ (self, RbEvas, e);
 
        if (!(o = evas_object_bottom_get (e->real)))
                return Qnil;
 
-       if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
-               rb_raise (rb_eException, "EvasObject Ruby object key missing");
-               return Qnil;
-       }
-
-       return (VALUE) obj;
+       return TO_EVAS_OBJECT (o);
 }
 
 /*
@@ -301,7 +289,6 @@ static VALUE c_bottom_get (VALUE self)
 static VALUE c_find_object (VALUE self, VALUE name)
 {
        Evas_Object *o;
-       void *obj;
 
        GET_OBJ (self, RbEvas, e);
 
@@ -310,12 +297,7 @@ static VALUE c_find_object (VALUE self, VALUE name)
        if (!(o = evas_object_name_find (e->real, StringValuePtr (name))))
                return Qnil;
 
-       if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
-               rb_raise (rb_eException, "EvasObject Ruby object key missing");
-               return Qnil;
-       }
-
-       return (VALUE) obj;
+       return TO_EVAS_OBJECT (o);
 }
 
 void Init_Evas (void)