allow gadgets to return a null object for demo objects

this indicates the gadget should not be advertised for the given demo
purpose
This commit is contained in:
Mike Blumenkrantz 2017-06-23 17:41:39 -04:00
parent 97c3db5ab1
commit 6a1d0226ed
1 changed files with 14 additions and 1 deletions

View File

@ -356,8 +356,15 @@ _gadget_object_create(E_Gadget_Config *zgc)
/* if id is < 0, gadget creates dummy config for demo use
* if id is 0, gadget creates new config and returns id
* otherwise, config of `id` is applied to created object
*
* a gadget should return NULL for any demo instance where it
* should not be shown
*/
g = t->cb(zgc->site->layout, &zgc->id, zgc->site->orient);
if (zgc->id < 0)
{
if (!g) return EINA_FALSE;
}
EINA_SAFETY_ON_NULL_RETURN_VAL(g, EINA_FALSE);
added = 1;
@ -2124,7 +2131,13 @@ e_gadget_editor_add(Evas_Object *parent, Evas_Object *site)
it = e_gadget_type_iterator_get();
/* FIXME: no types available */
EINA_ITERATOR_FOREACH(it, type)
e_gadget_site_gadget_add(tempsite, type, 1);
{
E_Gadget_Config *zgc;
e_gadget_site_gadget_add(tempsite, type, 1);
ZGS_GET(tempsite);
zgc = eina_list_last_data_get(zgs->gadgets);
if (!zgc->gadget) _gadget_remove(zgc);
}
eina_iterator_free(it);
gadgets = e_gadget_site_gadgets_list(tempsite);