examples: refactor data to be tidier

edi-0.8
Andy Williams 5 years ago
parent ad12603941
commit 3497aee535
  1. 38
      data/extra/examples/examples.edc
  2. 19
      src/bin/screens/edi_welcome.c

@ -1,25 +1,15 @@
data {
item: "hellogui.title" "C EFL Beta Hello World";
item: "hellogui.directory" "tutorials/c/hellogui/";
item: "hellogui.description"
"Hello World using the EFL Beta APIs";
item: "life.title" "C EFL Beta Game of Life";
item: "life.directory" "apps/c/life/";
item: "life.description"
"Game of Life using the EFL Beta APIs";
item: "texteditor.title" "C EFL Beta Basic Text Editor";
item: "texteditor.directory" "apps/c/texteditor/";
item: "texteditor.description"
"A basic text editor app using the EFL Beta APIs";
}
collections {
group {
name: "hellogui";
max: 128 128;
data {
item: "title" "C EFL Beta Hello World";
item: "directory" "tutorials/c/hellogui/";
item: "description"
"Hello World using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
@ -35,6 +25,13 @@ collections {
name: "life";
max: 128 128;
data {
item: "title" "C EFL Beta Game of Life";
item: "directory" "apps/c/life/";
item: "description"
"Game of Life using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
@ -50,6 +47,13 @@ collections {
name: "texteditor";
max: 128 128;
data {
item: "title" "C EFL Beta Basic Text Editor";
item: "directory" "apps/c/texteditor/";
item: "description"
"A basic text editor app using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;

@ -279,20 +279,24 @@ _edi_templates_discover(const char *directory)
}
Edi_Example *
_edi_example_add(const char *examples, const char *group)
_edi_example_add(const char *examples, const char *groupname)
{
Edi_Example *e;
Evas_Object *group;
Ecore_Evas *evas; // TODO find a way to not need this!
e = malloc(sizeof(Edi_Example));
evas = ecore_evas_buffer_new(0, 0);
group = edje_object_add(ecore_evas_get(evas));
edje_object_file_set(group, examples, groupname);
printf("EXITS %s, %s\n", edje_file_data_get(examples, "title"),
edje_file_data_get(examples, eina_slstr_printf("%s.title", group)));
e->title = edje_file_data_get(examples, eina_slstr_printf("%s.title", group));
e->desc = edje_file_data_get(examples, eina_slstr_printf("%s.description", group));
e->example_path = edje_file_data_get(examples, eina_slstr_printf("%s.directory", group));
e->title = strdup(edje_object_data_get(group, "title"));
e->desc = strdup(edje_object_data_get(group, "description"));
e->example_path = strdup(edje_object_data_get(group, "directory"));
e->edje_path = strdup(examples);
e->edje_id = strdup(group);
e->edje_id = strdup(groupname);
ecore_evas_free(evas);
return e;
}
@ -324,7 +328,6 @@ _edi_examples_discover(const char *directory)
collection = edje_file_collection_list(path);
EINA_LIST_FOREACH(collection, list, groupname)
{
printf("Found group %s\n", groupname);
Edi_Example *example = _edi_example_add(path, groupname);
if (example)
_available_examples = eina_list_append(_available_examples, example);

Loading…
Cancel
Save