summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-05-28 16:53:10 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-05-28 16:53:27 +0300
commit6c10b6bb60e3578c7752c2b271f901a37efba2ab (patch)
tree87e96a753f236d4a522bddf45d814a907d860b1e
parent48f2323f89a4c172d712171c976752a9c0e2d41e (diff)
Large ResMan-Sequences refactoring
!!!Important: if you have any projects, change "Sequences" section in Resource JSON. Now sequences are resources which have only names, no values. So Resources JSON for sequences is an array of names. Parsing and generation were fixed in order to parse/generate proper JSON. Resource Manager -> Sequences: - fixed all fields, which are needed to add/display/edit sequences
-rw-r--r--src/bin/egui_gui/egui_layout_c.json44
-rw-r--r--src/bin/egui_gui/egui_layout_h.json1
-rw-r--r--src/bin/egui_gui/propview.c2
-rw-r--r--src/bin/egui_gui/rmview.c207
-rw-r--r--src/lib/generator.c26
-rw-r--r--src/lib/gui_parser.c59
6 files changed, 262 insertions, 77 deletions
diff --git a/src/bin/egui_gui/egui_layout_c.json b/src/bin/egui_gui/egui_layout_c.json
index ad87e9f..37f4362 100644
--- a/src/bin/egui_gui/egui_layout_c.json
+++ b/src/bin/egui_gui/egui_layout_c.json
@@ -18,17 +18,17 @@ static Eo *main_win;
18 "res_canvas_bg":"src/data/images/canvas_bg.jpg" 18 "res_canvas_bg":"src/data/images/canvas_bg.jpg"
19 }, 19 },
20 "Sequences": 20 "Sequences":
21 { 21 [
22 "BigBang":"__BigBang__", 22 "BigBang",
23 "fs_win_show":"_sequence_fs_win_show_execute", 23 "fs_win_show",
24 "rm_win_show":"_sequence_rm_win_show_execute", 24 "rm_win_show",
25 "settings_win_show":"_sequence_settings_win_show_execute", 25 "settings_win_show",
26 "graphviz_button_clicked":"_sequence_graphviz_button_clicked_execute", 26 "graphviz_button_clicked",
27 "itemview_item_add_but_clicked":"__itemview_item_add_but_clicked", 27 "itemview_item_add_but_clicked",
28 "itemview_item_nested_add_but_clicked":"__itemview_item_nested_add_but_clicked", 28 "itemview_item_nested_add_but_clicked",
29 "itemview_separator_add_but_clicked":"__itemview_separator_add_but_clicked", 29 "itemview_separator_add_but_clicked",
30 "itemview_item_del_but_clicked":"__itemview_item_del_but_clicked" 30 "itemview_item_del_but_clicked"
31 }, 31 ],
32 "Eo_Callbacks": 32 "Eo_Callbacks":
33 { 33 {
34 "_itemview_item_add_but_clicked_cb":"_itemview_item_add_but_clicked_cb", 34 "_itemview_item_add_but_clicked_cb":"_itemview_item_add_but_clicked_cb",
@@ -419,6 +419,7 @@ _create_rm_win()
419 Eo *rm_alias_entry; 419 Eo *rm_alias_entry;
420 Eo *rm_value_entry; 420 Eo *rm_value_entry;
421 Eo *rm_cb_type_hoversel; 421 Eo *rm_cb_type_hoversel;
422 Eo *rm_seq_pub_check;
422 Eo *rm_button_add; 423 Eo *rm_button_add;
423 424
424/* @egui 425/* @egui
@@ -721,6 +722,27 @@ _create_rm_win()
721 eo_do(rm_cb_type_hoversel, elm_obj_hoversel_hover_parent_set(rm_win)); 722 eo_do(rm_cb_type_hoversel, elm_obj_hoversel_hover_parent_set(rm_win));
722/* @egui 723/* @egui
723{ 724{
725 "rm_seq_pub_check":
726 {
727 "Desc":
728 {
729 "parent":"rm_buttons_box",
730 "class":"Elm_Check",
731 "public":true,
732 "type":"widget"
733 },
734 "Properties":
735 {
736 }
737 }
738 }
739@!egui */
740 rm_seq_pub_check = eo_add(ELM_OBJ_CHECK_CLASS, rm_buttons_box);
741 eo_unref(rm_seq_pub_check);
742 pub_widgets.rm_seq_pub_check = rm_seq_pub_check;
743 eo_do(rm_cb_type_hoversel, elm_obj_hoversel_hover_parent_set(rm_win));
744/* @egui
745{
724 "rm_button_add": 746 "rm_button_add":
725 { 747 {
726 "Desc": 748 "Desc":
diff --git a/src/bin/egui_gui/egui_layout_h.json b/src/bin/egui_gui/egui_layout_h.json
index f8c1cb6..e3683e1 100644
--- a/src/bin/egui_gui/egui_layout_h.json
+++ b/src/bin/egui_gui/egui_layout_h.json
@@ -14,6 +14,7 @@ typedef struct
14 Eo *rm_alias_entry; 14 Eo *rm_alias_entry;
15 Eo *rm_value_entry; 15 Eo *rm_value_entry;
16 Eo *rm_cb_type_hoversel; 16 Eo *rm_cb_type_hoversel;
17 Eo *rm_seq_pub_check;
17 Eo *rm_button_add; 18 Eo *rm_button_add;
18 Eo *main_win; 19 Eo *main_win;
19 Eo *canvas_bg; 20 Eo *canvas_bg;
diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c
index d121484..0140e87 100644
--- a/src/bin/egui_gui/propview.c
+++ b/src/bin/egui_gui/propview.c
@@ -151,7 +151,7 @@ _property_item_content_get(It_Data *it_data, Eo *box)
151 } 151 }
152 else 152 else
153 { 153 {
154 eo_do(obj, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER, _view_cbs->property_update_cb_func, NULL)); 154 eo_do(obj, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED, _view_cbs->property_update_cb_func, NULL));
155 } 155 }
156 } 156 }
157 } 157 }
diff --git a/src/bin/egui_gui/rmview.c b/src/bin/egui_gui/rmview.c
index df4b4be..c0a4ed1 100644
--- a/src/bin/egui_gui/rmview.c
+++ b/src/bin/egui_gui/rmview.c
@@ -32,6 +32,7 @@ typedef struct
32 Eo *en2; 32 Eo *en2;
33 Eo *bt_save; 33 Eo *bt_save;
34 int ref_count; 34 int ref_count;
35 unsigned int changed;
35} Rmview_Item_Data; 36} Rmview_Item_Data;
36 37
37/* Struct to hold idx of element in line. */ 38/* Struct to hold idx of element in line. */
@@ -108,27 +109,68 @@ _rmview_button_add(Eo *parent, const char* str)
108 return bt; 109 return bt;
109} 110}
110 111
112static Eo *
113_rmview_check_add(Eo *parent, Eina_Bool state)
114{
115 Eo *ck = eo_add(ELM_OBJ_CHECK_CLASS, parent);
116 eo_unref(ck);
117 eo_do(ck,
118 evas_obj_visibility_set(EINA_TRUE),
119 elm_obj_check_state_set(state));
120 return ck;
121}
122
111/* Callback on entry change. 123/* Callback on entry change.
112 * Used to enable/disable SAVE button. */ 124 * Used to enable/disable SAVE button. */
113static void 125static Eina_Bool
114_res_changed(void *data EINA_UNUSED, Eo *obj, void *event_info EINA_UNUSED) 126_res_changed(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
115{ 127{
116 Rmview_Field_Data *f_data; 128 Rmview_Field_Data *f_data;
117 eo_do(obj, f_data = eo_key_data_get(_STR_RMVIEW)); 129 eo_do(obj, f_data = eo_key_data_get(_STR_RMVIEW));
118 Eo *field; 130 Eo *entry_field = NULL;
119 const char *res_str = NULL; 131 const char *res_str = NULL, *str;
120 switch (f_data->idx) 132 switch (f_data->idx)
121 { 133 {
122 case 0: 134 case 0:
123 { 135 {
124 field = f_data->it_data->en1; 136 entry_field = f_data->it_data->en1;
137 eo_do(entry_field, str = elm_obj_widget_part_text_get(NULL));
125 res_str = resource_name_get(f_data->it_data->res); 138 res_str = resource_name_get(f_data->it_data->res);
139 /* Set bit, in order to know if change needed */
140 if (strcmp(str, res_str))
141 {
142 f_data->it_data->changed |= (1 << 0);
143 }
144 else
145 {
146 f_data->it_data->changed &= ~(1 << 0);
147 }
148
126 break; 149 break;
127 } 150 }
128 case 1: 151 case 1:
129 { 152 {
130 field = f_data->it_data->en2; 153 Gui_Resource_Type res_type = resource_type_get(f_data->it_data->res);
131 res_str = resource_value_get(f_data->it_data->res); 154 if (res_type == RESOURCE_SEQUENCE)
155 {
156 /* Toggle bit, in order to know if change needed */
157 f_data->it_data->changed ^= (1 << 1);
158 }
159 else
160 {
161 entry_field = f_data->it_data->en2;
162 eo_do(entry_field, str = elm_obj_widget_part_text_get(NULL));
163 res_str = resource_value_get(f_data->it_data->res);
164 /* Set bit, in order to know if change needed */
165 if (strcmp(str, res_str))
166 {
167 f_data->it_data->changed |= (1 << 1);
168 }
169 else
170 {
171 f_data->it_data->changed &= ~(1 << 1);
172 }
173 }
132 break; 174 break;
133 } 175 }
134 default: 176 default:
@@ -136,16 +178,9 @@ _res_changed(void *data EINA_UNUSED, Eo *obj, void *event_info EINA_UNUSED)
136 ERR("switch - default: %d", f_data->idx); 178 ERR("switch - default: %d", f_data->idx);
137 } 179 }
138 } 180 }
139 const char *str; 181
140 eo_do(field, str = elm_obj_widget_part_text_get(NULL)); 182 eo_do(f_data->it_data->bt_save, elm_obj_widget_disabled_set(!f_data->it_data->changed));
141 if (!strcmp(str, res_str)) 183 return EO_CALLBACK_CONTINUE;
142 {
143 eo_do(f_data->it_data->bt_save, elm_obj_widget_disabled_set(EINA_TRUE));
144 }
145 else
146 {
147 eo_do(f_data->it_data->bt_save, elm_obj_widget_disabled_set(EINA_FALSE));
148 }
149} 184}
150 185
151static Eina_Bool 186static Eina_Bool
@@ -156,6 +191,8 @@ _bt_save_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
156 Eina_Bool status = EINA_TRUE; 191 Eina_Bool status = EINA_TRUE;
157 eo_do(obj, f_data = eo_key_data_get(_STR_RMVIEW)); 192 eo_do(obj, f_data = eo_key_data_get(_STR_RMVIEW));
158 Gui_Resource *res = f_data->it_data->res; 193 Gui_Resource *res = f_data->it_data->res;
194 Gui_Resource_Type res_type = resource_type_get(res);
195 const Gui_Context *ctx = resource_context_get(res);
159 196
160 eo_do(f_data->it_data->en1, str = elm_obj_widget_part_text_get(NULL)); 197 eo_do(f_data->it_data->en1, str = elm_obj_widget_part_text_get(NULL));
161 res_name = resource_name_get(res); 198 res_name = resource_name_get(res);
@@ -169,10 +206,22 @@ _bt_save_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
169 status = EINA_FALSE; 206 status = EINA_FALSE;
170 } 207 }
171 } 208 }
172 eo_do(f_data->it_data->en2, str = elm_obj_widget_part_text_get(NULL)); 209
173 if (strlen(str)) 210 if (res_type == RESOURCE_SEQUENCE)
174 { 211 {
175 resource_value_set(res, str); 212 Eina_Bool state;
213 eo_do(f_data->it_data->en2, state = elm_obj_check_state_get());
214 Dep_Id seq_id = gui_context_dep_data_get_id_by_name(ctx, resource_name_get(res));
215 Gui_Sequence *seq = sequence_get(ctx, seq_id);
216 sequence_public_set(seq, state);
217 }
218 else
219 {
220 eo_do(f_data->it_data->en2, str = elm_obj_widget_part_text_get(NULL));
221 if (strlen(str))
222 {
223 resource_value_set(res, str);
224 }
176 } 225 }
177 226
178 if (status) 227 if (status)
@@ -237,8 +286,8 @@ _rmview_build(Rmview_Resource_Type type)
237 } 286 }
238 case RMVIEW_SEQUENCE: 287 case RMVIEW_SEQUENCE:
239 { 288 {
240 header1 = "Alias"; 289 header1 = "Sequence name";
241 header2 = "Sequence name"; 290 header2 = "Public";
242 type_start = RESOURCE_SEQUENCE; 291 type_start = RESOURCE_SEQUENCE;
243 type_end = RESOURCE_SEQUENCE + 1; 292 type_end = RESOURCE_SEQUENCE + 1;
244 break; 293 break;
@@ -291,14 +340,7 @@ _rmview_build(Rmview_Resource_Type type)
291 data = RMVIEW_FIELD_DATA_BUILD(0, it_data); 340 data = RMVIEW_FIELD_DATA_BUILD(0, it_data);
292 341
293 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free)); 342 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
294 evas_object_smart_callback_add(en, "changed", _res_changed, NULL); 343 eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER, _res_changed, NULL));
295
296 en = _rmview_entry_add(g->rm_table, value);
297 it_data->en2 = en;
298 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1));
299 data = RMVIEW_FIELD_DATA_BUILD(1, it_data);
300 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
301 evas_object_smart_callback_add(en, "changed", _res_changed, NULL);
302 344
303 switch (res_type) 345 switch (res_type)
304 { 346 {
@@ -306,6 +348,13 @@ _rmview_build(Rmview_Resource_Type type)
306 case RESOURCE_EVAS_CALLBACK: 348 case RESOURCE_EVAS_CALLBACK:
307 case RESOURCE_EVAS_SMART_CALLBACK: 349 case RESOURCE_EVAS_SMART_CALLBACK:
308 { 350 {
351 en = _rmview_entry_add(g->rm_table, value);
352 it_data->en2 = en;
353 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1));
354 data = RMVIEW_FIELD_DATA_BUILD(1, it_data);
355 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
356 eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER, _res_changed, NULL));
357
309 if (res_type == RESOURCE_EO_CALLBACK) 358 if (res_type == RESOURCE_EO_CALLBACK)
310 value = EO_CALLBACK_STR; 359 value = EO_CALLBACK_STR;
311 if (res_type == RESOURCE_EVAS_CALLBACK) 360 if (res_type == RESOURCE_EVAS_CALLBACK)
@@ -317,9 +366,40 @@ _rmview_build(Rmview_Resource_Type type)
317 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1)); 366 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1));
318 break; 367 break;
319 } 368 }
320 case RESOURCE_STRING:
321 case RESOURCE_IMAGE: 369 case RESOURCE_IMAGE:
370 {
371 en = _rmview_entry_add(g->rm_table, value);
372 it_data->en2 = en;
373 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1));
374 data = RMVIEW_FIELD_DATA_BUILD(1, it_data);
375 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
376 eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER, _res_changed, NULL));
377 break;
378 }
322 case RESOURCE_SEQUENCE: 379 case RESOURCE_SEQUENCE:
380 {
381 Dep_Id seq_id = gui_context_dep_data_get_id_by_name(ctx, res_name);
382 Gui_Sequence *seq = sequence_get(ctx, seq_id);
383 Eina_Bool state = sequence_public_get(seq);
384
385 Eo *ck = _rmview_check_add(g->rm_table, state);
386 it_data->en2 = ck;
387 data = RMVIEW_FIELD_DATA_BUILD(1, it_data);
388 eo_do(ck, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
389 eo_do(g->rm_table, elm_obj_table_pack(ck, table_col++, table_line, 1, 1));
390 eo_do(ck, eo_event_callback_add(ELM_CHECK_EVENT_CHANGED, _res_changed, NULL));
391 break;
392 }
393 case RESOURCE_STRING:
394 {
395 en = _rmview_entry_add(g->rm_table, value);
396 it_data->en2 = en;
397 eo_do(g->rm_table, elm_obj_table_pack(en, table_col++, table_line, 1, 1));
398 data = RMVIEW_FIELD_DATA_BUILD(1, it_data);
399 eo_do(en, eo_key_data_set(_STR_RMVIEW, data, _field_data_free));
400 eo_do(en, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER, _res_changed, NULL));
401 break;
402 }
323 case RESOURCE_SENTINEL: 403 case RESOURCE_SENTINEL:
324 { 404 {
325 break; 405 break;
@@ -365,16 +445,49 @@ _rmview_toolbar_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_in
365 return; 445 return;
366 _rmview_toolbar_selected_type = type; 446 _rmview_toolbar_selected_type = type;
367 447
368 if (_rmview_toolbar_selected_type == RMVIEW_CALLBACK) 448
369 { 449
370 eo_do(_g->rm_cb_type_hoversel, evas_obj_visibility_set(EINA_TRUE)); 450 eo_do(_g->rm_buttons_box, elm_obj_box_unpack_all());
371 eo_do(_g->rm_buttons_box, elm_obj_box_pack_after(_g->rm_cb_type_hoversel, _g->rm_value_entry)); 451 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_alias_entry));
372 } 452 eo_do(_g->rm_value_entry, evas_obj_visibility_set(EINA_TRUE));
373 else 453
454
455 eo_do(_g->rm_seq_pub_check, evas_obj_visibility_set(EINA_FALSE));
456 eo_do(_g->rm_cb_type_hoversel, evas_obj_visibility_set(EINA_FALSE));
457
458 switch (_rmview_toolbar_selected_type )
374 { 459 {
375 eo_do(_g->rm_cb_type_hoversel, evas_obj_visibility_set(EINA_FALSE)); 460 case RMVIEW_IMAGE:
376 eo_do(_g->rm_buttons_box, elm_obj_box_unpack(_g->rm_cb_type_hoversel)); 461 {
462 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_value_entry));
463 break;
464 }
465 case RMVIEW_CALLBACK:
466 {
467 eo_do(_g->rm_cb_type_hoversel, evas_obj_visibility_set(EINA_TRUE));
468 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_value_entry));
469 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_cb_type_hoversel));
470 break;
471 }
472 case RMVIEW_SEQUENCE:
473 {
474 eo_do(_g->rm_seq_pub_check, evas_obj_visibility_set(EINA_TRUE));
475 eo_do(_g->rm_value_entry, evas_obj_visibility_set(EINA_FALSE));
476 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_seq_pub_check));
477 break;
478 }
479 case RMVIEW_STRING:
480 {
481 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_value_entry));
482 break;
483 }
484 default:
485 {
486 ERR("switch - default: %d", _rmview_toolbar_selected_type);
487 }
377 } 488 }
489
490 eo_do(_g->rm_buttons_box, elm_obj_box_pack_end(_g->rm_button_add));
378 _rmview_build(type); 491 _rmview_build(type);
379} 492}
380 493
@@ -389,7 +502,7 @@ _rm_add_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Eve
389 eo_do(_g->rm_alias_entry, alias_str = elm_obj_widget_part_text_get(NULL)); 502 eo_do(_g->rm_alias_entry, alias_str = elm_obj_widget_part_text_get(NULL));
390 eo_do(_g->rm_value_entry, value_str = elm_obj_widget_part_text_get(NULL)); 503 eo_do(_g->rm_value_entry, value_str = elm_obj_widget_part_text_get(NULL));
391 504
392 if (!strlen(alias_str) || !strlen(value_str)) 505 if (!strlen(alias_str) || (!strlen(value_str) && _rmview_toolbar_selected_type != RMVIEW_SEQUENCE))
393 return EO_CALLBACK_CONTINUE; 506 return EO_CALLBACK_CONTINUE;
394 507
395 if (gui_context_dep_data_get_id_by_name(ctx, alias_str)) 508 if (gui_context_dep_data_get_id_by_name(ctx, alias_str))
@@ -447,15 +560,23 @@ _rm_add_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Eve
447 ERR("Cannot create resource of type: %d", res_type); 560 ERR("Cannot create resource of type: %d", res_type);
448 return EO_CALLBACK_CONTINUE; 561 return EO_CALLBACK_CONTINUE;
449 } 562 }
450 resource_value_set(gui_res, value_str);
451 563
452 _rmview_build(_rmview_toolbar_selected_type);
453 if (res_type == RESOURCE_SEQUENCE) 564 if (res_type == RESOURCE_SEQUENCE)
454 { 565 {
455 Dep_Id dep_id = gui_context_dep_data_get_id_by_name(ctx, alias_str); 566 Dep_Id dep_id = gui_context_dep_data_get_id_by_name(ctx, alias_str);
456 sequence_new(ctx, dep_id); 567 Gui_Sequence *seq = sequence_new(ctx, dep_id);
568 Eina_Bool state;
569 eo_do(_g->rm_seq_pub_check, state = elm_obj_check_state_get());
570 sequence_public_set(seq, state);
457 seqview_fill(ctx); 571 seqview_fill(ctx);
458 } 572 }
573 else
574 {
575 resource_value_set(gui_res, value_str);
576 }
577
578 _rmview_build(_rmview_toolbar_selected_type);
579 eo_do(_g->rm_seq_pub_check, elm_obj_check_state_set(EINA_FALSE));
459 eo_do(_g->rm_alias_entry, elm_obj_widget_part_text_set(NULL, NULL)); 580 eo_do(_g->rm_alias_entry, elm_obj_widget_part_text_set(NULL, NULL));
460 eo_do(_g->rm_value_entry, elm_obj_widget_part_text_set(NULL, NULL)); 581 eo_do(_g->rm_value_entry, elm_obj_widget_part_text_set(NULL, NULL));
461 return EO_CALLBACK_CONTINUE; 582 return EO_CALLBACK_CONTINUE;
diff --git a/src/lib/generator.c b/src/lib/generator.c
index f405e53..7dad05f 100644
--- a/src/lib/generator.c
+++ b/src/lib/generator.c
@@ -669,14 +669,28 @@ _resources_to_json(const Gui_Context *ctx)
669 { 669 {
670 Eina_List *lst = (Eina_List *) gui_context_resource_list_get(ctx, type); 670 Eina_List *lst = (Eina_List *) gui_context_resource_list_get(ctx, type);
671 if (!lst) continue; 671 if (!lst) continue;
672 cur = eina_json_object_new(); 672
673 EINA_LIST_FOREACH(lst, itr, res) 673 if (type == RESOURCE_SEQUENCE)
674 {
675 cur = eina_json_array_new();
676 EINA_LIST_FOREACH(lst, itr, res)
677 {
678 const char *res_name = resource_name_get(res);
679 eina_json_array_append(cur, eina_json_string_new(res_name));
680 }
681 }
682 else
674 { 683 {
675 const char *res_name, *value; 684 cur = eina_json_object_new();
676 res_name = resource_name_get(res); 685 EINA_LIST_FOREACH(lst, itr, res)
677 value = resource_value_get(res); 686 {
678 eina_json_object_append(cur, res_name, eina_json_string_new(value)); 687 const char *res_name, *value;
688 res_name = resource_name_get(res);
689 value = resource_value_get(res);
690 eina_json_object_append(cur, res_name, eina_json_string_new(value));
691 }
679 } 692 }
693
680 eina_json_object_append(obj, resource_section_name_get(type), cur); 694 eina_json_object_append(obj, resource_section_name_get(type), cur);
681 } 695 }
682 696
diff --git a/src/lib/gui_parser.c b/src/lib/gui_parser.c
index 689061e..7423424 100644
--- a/src/lib/gui_parser.c
+++ b/src/lib/gui_parser.c
@@ -731,28 +731,55 @@ _resource_parse(Gui_Context *gui_ctx, const char *res_name EINA_UNUSED, Eina_Jso
731 Eina_Json_Value *tmp = EINA_JSON_OBJECT_VALUE_GET(res_js, section_name); 731 Eina_Json_Value *tmp = EINA_JSON_OBJECT_VALUE_GET(res_js, section_name);
732 if (tmp) 732 if (tmp)
733 { 733 {
734 Eina_Iterator *it = eina_json_object_iterator_new(tmp); 734 Eina_Iterator *it = NULL;
735 Eina_Json_Value *j; 735 Eina_Json_Value *j;
736 EINA_ITERATOR_FOREACH(it, j) 736 if (res_type == RESOURCE_SEQUENCE)
737 { 737 {
738 const char *id = NULL, *value = NULL; 738 it = eina_json_array_iterator_new(tmp);
739 id = eina_json_pair_name_get(j); 739 EINA_ITERATOR_FOREACH(it, j)
740 Eina_Json_Value *cur = eina_json_pair_value_get(j);
741 if (eina_json_type_get(cur) != EINA_JSON_TYPE_STRING)
742 {
743 ERR("Json Value is not string");
744 }
745 else
746 { 740 {
747 value = eina_json_string_get(cur); 741 const char *id = NULL;
742 Eina_Json_Value *cur = j;
743 if (eina_json_type_get(cur) != EINA_JSON_TYPE_STRING)
744 {
745 ERR("Json Value is not string");
746 }
747 else
748 {
749 id = eina_json_string_get(cur);
750 }
751 Gui_Resource *gui_res = gui_context_resource_new(gui_ctx, res_type, id);
752 if (!gui_res)
753 {
754 ERR("Cannot create RESOURCE: type: %s, id: %s", section_name, id);
755 continue;
756 }
748 } 757 }
749 Gui_Resource *gui_res = gui_context_resource_new(gui_ctx, res_type, id); 758 }
750 if (!gui_res) 759 else
760 {
761 it = eina_json_object_iterator_new(tmp);
762 EINA_ITERATOR_FOREACH(it, j)
751 { 763 {
752 ERR("Cannot create RESOURCE: type: %s, id: %s", section_name, id); 764 const char *id = NULL, *value = NULL;
753 continue; 765 id = eina_json_pair_name_get(j);
766 Eina_Json_Value *cur = eina_json_pair_value_get(j);
767 if (eina_json_type_get(cur) != EINA_JSON_TYPE_STRING)
768 {
769 ERR("Json Value is not string");
770 }
771 else
772 {
773 value = eina_json_string_get(cur);
774 }
775 Gui_Resource *gui_res = gui_context_resource_new(gui_ctx, res_type, id);
776 if (!gui_res)
777 {
778 ERR("Cannot create RESOURCE: type: %s, id: %s", section_name, id);
779 continue;
780 }
781 resource_value_set(gui_res, value);
754 } 782 }
755 resource_value_set(gui_res, value);
756 } 783 }
757 eina_iterator_free(it); 784 eina_iterator_free(it);
758 } 785 }