add parsing for X-Gadget-Orientations in sandboxed gadgets

specify all supported orientations with semicolons for separators
This commit is contained in:
Mike Blumenkrantz 2017-11-01 13:01:45 -04:00
parent 1a2d94810a
commit 054b72912b
1 changed files with 25 additions and 0 deletions

View File

@ -701,6 +701,31 @@ sandbox_create(Evas_Object *parent, const char *type, int *id, E_Gadget_Site_Ori
if (*id > 0) ci = _conf_item_get(id); if (*id > 0) ci = _conf_item_get(id);
if ((*id < 0) || (ci && ci->inst)) if ((*id < 0) || (ci && ci->inst))
{ {
if (ed->x)
{
const char *orients = eina_hash_find(ed->x, "X-Gadget-Orientations");
if (orients)
{
const char *ostring[] =
{
"None",
"Horizontal",
"Vertical",
};
char *v, *val = strdup(orients);
Eina_Bool found = EINA_FALSE;
for (v = strtok(val, ";"); v; v = strtok(NULL, ";"))
if (!strcmp(v, ostring[orient]))
{
found = EINA_TRUE;
break;
}
free(val);
if (!found) return NULL;
}
}
if (ed->icon) if (ed->icon)
{ {
int w, h; int w, h;