X-Git-Url: http://git.code-monkey.de/?p=ruby-edje.git;a=blobdiff_plain;f=src%2Frb_edje.c;h=25be7482d724d756ebbf58dc1341c14b0edd8308;hp=4b76cce71a771229b01f52254012c3852ecf2224;hb=887790d08e623c56ce01230fb2889b2555f21ed2;hpb=ba313b5cb6ebd3d8eae9c551fac8504651251bb9 diff --git a/src/rb_edje.c b/src/rb_edje.c index 4b76cce..25be748 100644 --- a/src/rb_edje.c +++ b/src/rb_edje.c @@ -1,5 +1,5 @@ /* - * $Id: rb_edje.c 96 2004-08-23 15:21:41Z tilman $ + * $Id: rb_edje.c 139 2004-10-30 09:41:17Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -28,6 +28,7 @@ #include "rb_edje.h" #include "rb_edje_main.h" #include "rb_part.h" +#include "rb_messages.h" VALUE cEdje; @@ -382,6 +383,38 @@ static VALUE c_animation_set (VALUE self, VALUE val) return Qnil; } +static VALUE c_data_get (VALUE self, VALUE key) +{ + const char *s; + + GET_OBJ (self, RbEdje, e); + + Check_Type (key, T_STRING); + + s = edje_object_data_get (e->real.real, StringValuePtr (key)); + + return s ? rb_str_new2 (s) : Qnil; +} + +static VALUE c_send_message (VALUE self, VALUE msg) +{ + VALUE m; + Edje_Message_Type type; + int id; + + GET_OBJ (self, RbEdje, e); + + CHECK_CLASS (msg, cMsg); + + type = NUM2INT (rb_iv_get (msg, "@type")); + id = NUM2INT (rb_iv_get (msg, "@id")); + m = rb_funcall (msg, rb_intern ("serialize"), 0, NULL); + + edje_object_message_send (e->real.real, type, id, (void *) m); + + return Qnil; +} + void Init_Edje (void) { cEdje = rb_define_class_under (mEdje, "Edje", cEvasObject); @@ -401,4 +434,6 @@ void Init_Edje (void) rb_define_method (cEdje, "play=", c_play_set, 1); rb_define_method (cEdje, "animation?", c_animation_get, 0); rb_define_method (cEdje, "animation=", c_animation_set, 1); + rb_define_method (cEdje, "data", c_data_get, 1); + rb_define_method (cEdje, "send_message", c_send_message, 1); }