From: Hugo Camboulive <hugo.camboulive@gmail.com>
authorHugo Camboulive <hugo.camboulive@gmail.com>
Tue, 27 Jul 2010 10:08:40 +0000 (10:08 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Jul 2010 10:08:40 +0000 (10:08 +0000)
Subject: [E-devel] [E-Devel] [Patch] Edje Message - add the callback
recursively

When you send a message from an edje subgroup (part { type: GROUP
...}), the
message callback isn't called because it tries to reach
ed->message.func,
which is only defined for the top edje part.
This patches adds the callback and data to all the subgroups
recursively.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@50538 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_message_queue.c

index c7f22ba..e7aec81 100644 (file)
@@ -211,8 +211,19 @@ _edje_message_shutdown(void)
 void
 _edje_message_cb_set(Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data)
 {
+   int i;
+
    ed->message.func = func;
    ed->message.data = data;
+   for (i = 0 ; i < ed->table_parts_size ; i++) {
+      Edje_Real_Part *rp;
+      rp = ed->table_parts[i];
+      if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object) {
+         Edje *edj2 = _edje_fetch(rp->swallowed_object);
+         if (!edj2) continue;
+        _edje_message_cb_set(edj2, func, data);
+      }
+   }
 }
 
 Edje_Message *