----- "andres" <[EMAIL PROTECTED]> ha scritto: > El Wednesday 16 April 2008 18:05:40 Dave Andreoli escribió: > > ----- "andres" <[EMAIL PROTECTED]> ha scritto: > > > Hey, I want to check if a given part's type is SWALLOW before > using it > > > to swallow an object. > > > > Why you need to do this check? edje_object_part_swallow do it for > you ;) > > > Edje's swallow function doesn't check that the swallower is actually a > SWALLOW > part, AFIK it will fail silently.
EAPI void edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow) { Edje *ed; Edje_Real_Part *rp; ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(ed, (char *)part); if (!rp) return; if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return; *********** _edje_real_part_swallow(rp, obj_swallow); } > So other than using edje_object_part_swallow_get and checking the > object > returned is the same you tried to swallow there is no way to know if > the > swallowing was successful or why did it fail. > > We could put checks like this in edje_object_part_swallow. But I can't > help to > think was programmed to work this way for a reason I ignore. All ELFs are written in this way, without error checking and reporting, i think it's for performance reason and I like it :) We can simply modify the function to return 1 on success or 0 on error in this way: EAPI unsigned char ******* edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow) { Edje *ed; Edje_Real_Part *rp; ed = _edje_fetch(obj); if ((!ed) || (!part)) return 0; ***** rp = _edje_real_part_recursive_get(ed, (char *)part); if (!rp) return 0; ****** if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return 0; *********** _edje_real_part_swallow(rp, obj_swallow); return 1; ****** } then you can use: if (!edje_object_part_swallow(...)) printf("ERROR"); It's not a 100% safe check but I think it fit your need. Dave > > In a completely unrelated note I spiced up the plain edje viewer (and > removed > the loony CFLAGS this time). > Now you can set the size of the viewed object to the size of the > window with > something that looks like an arrow next to the minimap. > http://andresblanc.googlepages.com/plain_edje_viewer.tar.gz > > bye > > > > > I couldn't find a way to do it without using Edje_Edit.h. Sice > this is > > > for the > > > Edje book I wouldn't want to encourage Edje_Edit for regular > > > application > > > development. Or is promoting the usage of Edje_Edit in > applications a > > > good > > > idea? > > > > no, no, no, it's not a good idea. > > > > > My approach was to add a new function to Edje that return the > part > > > type as an > > > unsigned char (like Edje_Edit does) and to move the macros > > > EDJE_PART_TYPE_* > > > from edje_private.h to Edje.h . > > > > This is ok for me > > > > > I attached a patch showing the changes. > > > Thanks and good bye. > > > > The patch is good and simple ... if we really need it :) > > > > Bye > > Dave > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > > > Don't miss this year's exciting event. There's still time to save > > > $100. > > > Use priority code J8TL2D2. > > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/ja > > >vaone _______________________________________________ > > > enlightenment-devel mailing list > > > enlightenment-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel