/*
- * $Id: rb_edje.c 19 2004-06-22 20:40:05Z tilman $
+ * $Id: rb_edje.c 21 2004-06-25 17:41:17Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
return Qnil;
}
+static void on_signal (void *data, Evas_Object *o,
+ const char *emission, const char *src) {
+ rb_funcall ((VALUE) data, rb_intern ("call"), 1,
+ rb_str_new2 (emission), rb_str_new2 (src));
+}
+
+static VALUE c_on_signal (VALUE self, VALUE signal, VALUE src)
+{
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ Check_Type (signal, T_STRING);
+ Check_Type (src, T_STRING);
+
+ if (!rb_block_given_p ())
+ return Qnil;
+
+ edje_object_signal_callback_add (*e, StringValuePtr (signal),
+ StringValuePtr (src), on_signal,
+ (void *) rb_block_proc ());
+
+ return Qnil;
+}
+
static VALUE c_play_get (VALUE self)
{
GET_OBJ (self, Evas_Object, e, "Edje");
rb_define_method (cEdje, "set_part_text", c_set_part_text, 2);
rb_define_method (cEdje, "on_text_changed", c_on_text_changed, 0);
rb_define_method (cEdje, "signal_emit", c_signal_emit, 1);
+ rb_define_method (cEdje, "on_signal", c_on_signal, 2);
rb_define_method (cEdje, "play?", c_play_get, 0);
rb_define_method (cEdje, "play=", c_play_set, 1);
rb_define_method (cEdje, "animation?", c_animation_get, 0);