require X-Gadget-Version field for sandbox gadget .desktops

This commit is contained in:
Mike Blumenkrantz 2018-01-22 15:42:05 -05:00
parent 83041e4815
commit 69c570104a
1 changed files with 13 additions and 5 deletions

View File

@ -103,12 +103,9 @@ static char *
sandbox_name(const char *filename)
Efreet_Desktop *ed = eina_hash_find(sandbox_gadgets, filename);
char *version, buf[1024];
char buf[1024];
if (!ed->x) return strdup(ed->name);
version = eina_hash_find(ed->x, "X-Gadget-Version");
if (!version) return strdup(ed->name);
snprintf(buf, sizeof(buf), "%s (v%s)", ed->name, version);
snprintf(buf, sizeof(buf), "%s (v%s)", ed->name, (char*)eina_hash_find(ed->x, "X-Gadget-Version"));
return strdup(buf);
@ -995,6 +992,17 @@ gadget_dir_add(const char *filename)
if ((!ed->x) || (!eina_hash_find(ed->x, "X-Gadget-Version")))
char str[4096];
snprintf(str, sizeof(str), _("A gadget .desktop file was found,</ps>"
"but [X-Gadget-Version] is missing!</ps>"
"%s"), buf);
/* FIXME: maybe don't use notification here? T6630 */
e_notification_util_send(_("Gadget Error"), str);
eina_hash_add(sandbox_gadgets, filename, ed);
e_gadget_external_type_add("runner_sandbox", filename, sandbox_create, NULL);
e_gadget_external_type_name_cb_set("runner_sandbox", filename, sandbox_name);