On Tue, Mar 25, 2008 at 10:39 PM, Santiago Aguiar
<[EMAIL PROTECTED]> wrote:
> Hi everyone!
>
>  I started working with edje yesterday (always a lover of e, but I was
>  amazed in Dave Andreoli's presentation at bossa conference!) and second
>  thing I wanted to do was to include a group as a swallowed object of a
>  part :) . I thought it was a good way to reuse the group multiple times,
>  and for example define a button bar and use it in multiple places, but
>  constrained by the swallowing part geometry.

Ah, great to hear Bossa is bringing new people to the project :-)


>  I couldn't find how to do it using edje+embryo, but I was able to do it
>  using python-efl. So I wrote a patch to add a part_swallow function to
>  the edje exported embryo functions as a way to do this directly without
>  external code. Now I can do something like:
>
>  program {
>     name, "init";
>     signal, "load";
>     script {
>         part_swallow(PART:"button_bar", "Group_Button_Bar");
>     }
>  }

Maybe we can find out some other use case for this function (ie:
select which part based on some runtime parameter, like time, signals,
messages...), but for instance the code you did there can be avoided
by use of parts of "type: GROUP" using "source: "button_bar"", see
http://docs.enlightenment.org/api/edje/html/edcref.html but it should
look like:

 part {
    type: GROUP;
    source: "part_name";
    description { ... }
}


>  I don't really know if it might be useful or even if there aren't tons
>  of side effects, since I'm not 100% familiar with the codebase, but
>  maybe it is or someone can explain what's wrong and I end up learning
>  something!

+   ed = embryo_program_data_get(ep);
+
+   rp = ed->table_parts[part_id % ed->table_parts_size];
+   if (!rp || rp->part->type != EDJE_PART_TYPE_SWALLOW) return 0;

no, see below.


+   new_obj =  edje_object_add(ed->evas);
+   if (!new_obj) return 0;
+
+   if (!edje_object_file_set(new_obj, ed->file->path, group_name))
+     {

fine.


+        evas_object_smart_member_del(new_obj);
+        return 0;
+     }
+
+   _edje_real_part_swallow(rp, new_obj);

This is not ok. The first statement should be a simple
evas_object_del(new_obj), the second should be
evas_object_part_swallow(), this also remove the need of
embryo_program_data_get() and working with table_parts and like...
They're not really wrong, as it will work, but it's not good as it's
too intrusive, let's use the public api and have just one place to
work on the internals.


>  It might be a good idea to be able to swallow another part directly
>  without the use of a program, which would involve changing edje syntax.
>  If it sounds good, I'm willing to do it.

Maybe it can be done with "type: GROUP"?

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi
Embedded Systems
--------------------------------------
MSN: [EMAIL PROTECTED]
Skype: gsbarbieri
Mobile: +55 (81) 9927 0010

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to