rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=bf3eaed2e97029c39fb2d000656270765b04db1b

commit bf3eaed2e97029c39fb2d000656270765b04db1b
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Thu Sep 15 18:29:50 2016 +0300

    project manager2: move meta data get/set
    
    Change-Id: I93098bad08c3a14249bd25b0cfa414beec30a89d
---
 src/bin/project_manager/project_manager2.c | 66 ++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/src/bin/project_manager/project_manager2.c 
b/src/bin/project_manager/project_manager2.c
index 6a35a7c..eff6273 100644
--- a/src/bin/project_manager/project_manager2.c
+++ b/src/bin/project_manager/project_manager2.c
@@ -35,6 +35,8 @@
 #define PROJECT_KEY_LICENSE      "edje/license"
 #define PROJECT_KEY_COMMENT      "edje/comment"
 
+static Eet_Compression compess_level = EET_COMPRESSION_HI;
+
 struct _Project_Process_Data
 {
    /** The progress callback. See #PM_Project_Progress_Cb.*/
@@ -585,3 +587,67 @@ pm_project_save(Project *project,
    eina_file_copy(ppd->project->dev, ppd->project->saved_edj,
                   EINA_FILE_COPY_PERMISSION | EINA_FILE_COPY_XATTR, 
_copy_progress, ppd);
 }
+
+void
+pm_project_meta_data_get(Project *project,
+                         Eina_Stringshare **name,
+                         Eina_Stringshare **authors,
+                         Eina_Stringshare **version,
+                         Eina_Stringshare **license,
+                         Eina_Stringshare **comment)
+{
+   char *tmp;
+
+   assert(project != NULL);
+   assert(project->ef != NULL);
+
+#define DATA_READ(DATA, KEY) \
+   if (DATA) \
+     { \
+        tmp = eet_read(project->ef, KEY, NULL); \
+        *DATA = eina_stringshare_add(tmp); \
+        free(tmp); \
+     }
+
+   DATA_READ(name,    PROJECT_KEY_NAME);
+   DATA_READ(authors, PROJECT_KEY_AUTHORS);
+   DATA_READ(version, PROJECT_KEY_FILE_VERSION);
+   DATA_READ(license, PROJECT_KEY_LICENSE);
+   DATA_READ(comment, PROJECT_KEY_COMMENT);
+
+#undef DATA_READ
+}
+
+Eina_Bool
+pm_project_meta_data_set(Project *project,
+                         const char *name,
+                         const char *authors,
+                         const char *version,
+                         const char *license,
+                         const char *comment)
+{
+   int bytes, size;
+   Eina_Bool res;
+
+   assert(project != NULL);
+   assert(project->ef != NULL);
+
+   res = true;
+
+#define DATA_WRITE(DATA, KEY) \
+   if (DATA) \
+     { \
+        size = (strlen(DATA) + 1) * sizeof(char); \
+        bytes = eet_write(project->ef, KEY, DATA, size, compess_level); \
+        if (bytes <= 0 ) res = false; \
+     }
+
+   DATA_WRITE(name,    PROJECT_KEY_NAME);
+   DATA_WRITE(authors, PROJECT_KEY_AUTHORS);
+   DATA_WRITE(version, PROJECT_KEY_FILE_VERSION);
+   DATA_WRITE(license, PROJECT_KEY_LICENSE);
+   DATA_WRITE(comment, PROJECT_KEY_COMMENT);
+
+#undef DATA_WRITE
+   return res;
+}

-- 


Reply via email to