summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-05-22 16:05:23 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-05-22 16:05:23 +0300
commitb9758617cd0b57c3a2e507523e0ece0f82782390 (patch)
treea84b8a0faf7cebe8fb6569d5e6862b36bb777bf5
parent53cacc3757e33cf4dc093fbaa9c2409a7de28fc9 (diff)
add parsing of Settings section
-rw-r--r--src/lib/gui_parser.c55
1 files changed, 39 insertions, 16 deletions
diff --git a/src/lib/gui_parser.c b/src/lib/gui_parser.c
index e2b209f..b02c030 100644
--- a/src/lib/gui_parser.c
+++ b/src/lib/gui_parser.c
@@ -763,6 +763,23 @@ _resource_parse(Gui_Context *gui_ctx, const char *res_name EINA_UNUSED, Eina_Jso
763 return ret; 763 return ret;
764} 764}
765 765
766static Eina_Bool
767_settings_parse(Gui_Context *gui_ctx, const char *res_name EINA_UNUSED, Eina_Json_Value *res_js)
768{
769 Eina_Bool ret = EINA_FALSE;
770 /* Order is important. */
771
772 const char* project_name;
773 Eina_Json_Value *tmp = EINA_JSON_OBJECT_VALUE_GET(res_js, "Settings", "project");
774 if (tmp)
775 {
776 project_name = eina_json_string_get(tmp);
777 gui_context_project_name_set(gui_ctx, project_name);
778 }
779 ret = EINA_TRUE;
780 return ret;
781}
782
766Eina_List *widgets_lst = NULL, *seq_lst = NULL; 783Eina_List *widgets_lst = NULL, *seq_lst = NULL;
767 784
768typedef struct 785typedef struct
@@ -865,6 +882,11 @@ _gui_parser_register_name(Gui_Context *gui_ctx, char *_data)
865 parse_ret = _resource_parse(gui_ctx, name, c); 882 parse_ret = _resource_parse(gui_ctx, name, c);
866 eina_json_value_free(jv); 883 eina_json_value_free(jv);
867 } 884 }
885 else if (!strcmp(entity_type, "settings"))
886 {
887 parse_ret = _settings_parse(gui_ctx, name, c);
888 eina_json_value_free(jv);
889 }
868 } 890 }
869 } 891 }
870 892
@@ -878,6 +900,23 @@ Eina_Bool
878gui_parser_json_file_read(Gui_Context *ctx, const char *filename) 900gui_parser_json_file_read(Gui_Context *ctx, const char *filename)
879{ 901{
880 char *file_data = gui_parser_file_string_get(filename); 902 char *file_data = gui_parser_file_string_get(filename);
903
904 {
905 const char *project_name = NULL;
906 char *dir = NULL;
907 char **tok;
908 dir = ecore_file_dir_get(filename);
909 gui_context_project_path_set(ctx, dir);
910
911 project_name = ecore_file_file_get(filename);
912 tok = eina_str_split(project_name, ".", 0);
913
914 gui_context_project_name_set(ctx, tok[0]);
915
916 free(tok[0]);
917 free(tok);
918 free(dir);
919 }
881 if (file_data) 920 if (file_data)
882 { 921 {
883 Eina_List *lst, *l, *l_next; 922 Eina_List *lst, *l, *l_next;
@@ -959,21 +998,5 @@ gui_parser_json_file_read(Gui_Context *ctx, const char *filename)
959 free(file_data); 998 free(file_data);
960 file_data = NULL; 999 file_data = NULL;
961 } 1000 }
962 {
963 const char *project_name = NULL;
964 char *dir = NULL;
965 char **tok;
966 dir = ecore_file_dir_get(filename);
967 gui_context_project_path_set(ctx, dir);
968
969 project_name = ecore_file_file_get(filename);
970 tok = eina_str_split(project_name, ".", 0);
971
972 gui_context_project_name_set(ctx, tok[0]);
973
974 free(tok[0]);
975 free(tok);
976 free(dir);
977 }
978 return EINA_TRUE; 1001 return EINA_TRUE;
979} 1002}