add 'set language function', fontlist, fontsize with buf fix. 47/68247/1
authorMyoungJune Park <mj2004.park@samsung.com>
Fri, 22 Jan 2016 07:10:26 +0000 (16:10 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Tue, 3 May 2016 06:30:56 +0000 (15:30 +0900)
Change-Id: Ia7eef787cc15f3c8b9b86a8c6d220addeac6d31a
Signed-off-by: MyoungJune Park <mj2004.park@samsung.com>
13 files changed:
data/tizen-config-fw.xml
plugin_model/config_header.xsl
plugin_model/config_impl.xsl
plugin_model/config_manager.c
plugin_model/config_table.c
plugin_model/config_table.h
plugin_model/config_table.xml
plugin_model/plugin1/CMakeLists.txt
plugin_model/plugin3/CMakeLists.txt
plugin_model/plugin_hello/CMakeLists.txt
plugin_model/plugin_hello/fontlist_plugin.c [new file with mode: 0644]
plugin_model/plugin_hello/fontsize_plugin.c [new file with mode: 0644]
plugin_model/plugin_hello/langlist_plugin.c

index dfd195a..21fbd9b 100644 (file)
@@ -16,6 +16,8 @@
          <require name="elementary"/>                  <!-- for plugins -->
          <require name="libxml-2.0"/>                  <!-- for plugins -->
          <require name="glib-2.0"/>                    <!-- for plugins -->
+         <require name="capi-system-system-settings"/>         <!-- for plugins -->
+
   </dependancy>
 
   <build>
index 644c8c5..4c6eed7 100644 (file)
@@ -62,6 +62,13 @@ char* <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, char* value);<xsl:text>&#xa;</xsl:text>
 <xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
                </xsl:when>
+
+        <xsl:when test="./@type='list'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, char* value);<xsl:text>&#xa;</xsl:text>
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*callback)(int,void* , void*), void* data);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
+               </xsl:when>
+
 </xsl:choose>
 <!-- end choose STRING-->
        </xsl:when>
@@ -133,8 +140,8 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
 <!-- end choose FLOAT -->
        </xsl:when>
 
+       <!--
        <xsl:when test="../../@type='list'">
-<!-- begin choose LIST -->
 <xsl:choose>
         <xsl:when test="./@type='init'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>();<xsl:text>&#xa;</xsl:text>
@@ -148,14 +155,12 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>();<xsl
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*callback)(int,void* , void*), void* data);<xsl:text>&#xa;</xsl:text>
                </xsl:when>
 
-               <!-- <xsl:when test="./@type='set'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, float value);<xsl:text>&#xa;</xsl:text>
 <xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
-               </xsl:when> -->
+               </xsl:when>
 </xsl:choose>
-<!-- end choose LIST -->
        </xsl:when>
-
+       -->
 
 </xsl:choose>
 
index b04957a..e16a3c0 100644 (file)
@@ -82,6 +82,23 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
        return 0;
 }
                </xsl:when>
+
+        <xsl:when test="./@type='list'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*tcf_iterator)(int,void*, void*), void* data)<xsl:text>&#xa;</xsl:text>
+{
+       PluginTizenConfig* (*fn)(int *);
+       fn = config_manager(<xsl:value-of select="../../@name"/>_plugin_path(), "<xsl:value-of select="../@name"/>");
+       int val = config_manager_get_list(fn, key, tcf_iterator, data);
+       config_manager_close();
+       return val;
+}
+               </xsl:when>
+
+
+
+
+
+
 </xsl:choose>
 <!-- end choose STRING-->
        </xsl:when>
@@ -211,8 +228,8 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
 <!-- end choose FLOAT -->
        </xsl:when>
 
+       <!--
 <xsl:when test="../../@type='list'">
-<!-- begin choose LIST -->
 <xsl:choose>
         <xsl:when test="./@type='init'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>()<xsl:text>&#xa;</xsl:text>
@@ -228,7 +245,7 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>()<xsl:
 }
                </xsl:when>
 
-        <xsl:when test="./@type='get'">
+        <xsl:when test="./@type='list'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*tcf_iterator)(int,void*, void*), void* data)<xsl:text>&#xa;</xsl:text>
 {
        PluginTizenConfig* (*fn)(int *);
@@ -238,23 +255,9 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(c
        return val;
 }
                </xsl:when>
-               <!--
-        <xsl:when test="./@type='set'">
-int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, float value)<xsl:text>&#xa;</xsl:text>
-{
-       PluginTizenConfig* (*fn)(int *);
-       fn = config_manager(<xsl:value-of select="../../@name"/>_plugin_path(), "<xsl:value-of select="../@name"/>");
-       config_manager_set_float(fn, key, value);
-       config_manager_close();
-       return 0;
-}
-               </xsl:when>
-               -->
 </xsl:choose>
-<!-- end choose LIST -->
        </xsl:when>
-
-
+-->
 
 </xsl:choose>
 
index 594558c..56de0f4 100644 (file)
@@ -108,7 +108,6 @@ int config_manager_set_float(PluginTizenConfig* (*fn)(),char* key, float value)
        return 0;
 }
 
-
 int config_manager_get_list(PluginTizenConfig* (*fn)(),char* key, void tcf_iterator(void (*callback)(int,void*, void*)), void* data)
 {
        PluginTizenConfig* pt_table = (*fn)();
@@ -137,5 +136,6 @@ int config_manager_set_float(PluginTizenConfig* (*fn)(),char* key, float value)
 void config_manager_close()
 {
        dlclose(lib_handle);
+       lib_handle = NULL;
 }
 
index f2d6251..c6da0ed 100644 (file)
@@ -58,42 +58,121 @@ char *get_simple_text_get(char *key)
     return val;
 }
 
-char *get_language_list_version_plugin_path()
+char *get_font_list_version_plugin_path()
 {
     return "/usr/lib/libhelloworld_plugin.so";
 }
 
-int get_language_list_version_get_list(char *key, void (*tcf_iterator) (int,
+char *get_font_list_version_get(char *key)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_font_list_version_plugin_path(),
+        "get_plugin_font_object");
+    char *val = config_manager_get(fn, key);
+
+    config_manager_close();
+    return val;
+}
+
+int get_font_list_version_set(char *key, char *value)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_font_list_version_plugin_path(),
+        "get_plugin_font_object");
+    config_manager_set(fn, key, value);
+    config_manager_close();
+    return 0;
+}
+
+int get_font_list_version_list_list(char *key, void (*tcf_iterator) (int,
         void *, void *), void *data)
 {
     PluginTizenConfig *(*fn) (int *);
 
-    fn = config_manager(get_language_list_version_plugin_path(),
-        "get_plugin_langlist_object");
+    fn = config_manager(get_font_list_version_plugin_path(),
+        "get_plugin_font_object");
     int val = config_manager_get_list(fn, key, tcf_iterator, data);
 
     config_manager_close();
     return val;
 }
 
-char *get_list_version_plugin_path()
+char *get_font_size_version_plugin_path()
+{
+    return "/usr/lib/libhelloworld_plugin.so";
+}
+
+int get_font_size_version_get(char *key)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_font_size_version_plugin_path(),
+        "get_plugin_fontsize_object");
+    int val = config_manager_get_int(fn, key);
+
+    config_manager_close();
+    return val;
+}
+
+int get_font_size_version_set(char *key, int value)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_font_size_version_plugin_path(),
+        "get_plugin_fontsize_object");
+    config_manager_set_int(fn, key, value);
+    config_manager_close();
+    return 0;
+}
+
+char *get_language_list_version_plugin_path()
 {
     return "/usr/lib/libhelloworld_plugin.so";
 }
 
-int get_list_version_get_list(char *key, void (*tcf_iterator) (int, void *,
-        void *), void *data)
+char *get_language_list_version_get(char *key)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_language_list_version_plugin_path(),
+        "get_plugin_langlist_object");
+    char *val = config_manager_get(fn, key);
+
+    config_manager_close();
+    return val;
+}
+
+int get_language_list_version_set(char *key, char *value)
 {
     PluginTizenConfig *(*fn) (int *);
 
-    fn = config_manager(get_list_version_plugin_path(),
-        "get_plugin_hellolist_object");
+    fn = config_manager(get_language_list_version_plugin_path(),
+        "get_plugin_langlist_object");
+    config_manager_set(fn, key, value);
+    config_manager_close();
+    return 0;
+}
+
+int get_language_list_version_list_list(char *key, void (*tcf_iterator) (int,
+        void *, void *), void *data)
+{
+    PluginTizenConfig *(*fn) (int *);
+
+    fn = config_manager(get_language_list_version_plugin_path(),
+        "get_plugin_langlist_object");
     int val = config_manager_get_list(fn, key, tcf_iterator, data);
 
     config_manager_close();
     return val;
 }
 
+char *get_list_version_plugin_path()
+{
+    return "/usr/lib/libhelloworld_plugin.so";
+}
+
 char *get_float_version_plugin_path()
 {
     return "/usr/lib/libhelloworld_plugin.so";
index a1d3035..1961c99 100644 (file)
@@ -32,12 +32,22 @@ char *get_complex_string_plugin_path();
 char *get_complex_string_get(char *key);
 char *get_simple_text_plugin_path();
 char *get_simple_text_get(char *key);
+char *get_font_list_version_plugin_path();
+char *get_font_list_version_get(char *key);
+int get_font_list_version_set(char *key, char *value);
+int get_font_list_version_list(char *key, char *value);
+int get_font_list_version_list_list(char *key, void (*callback) (int, void *,
+        void *), void *data);
+char *get_font_size_version_plugin_path();
+int get_font_size_version_get(char *key);
+int get_font_size_version_set(char *key, int value);
 char *get_language_list_version_plugin_path();
-int get_language_list_version_get_list(char *key, void (*callback) (int,
+char *get_language_list_version_get(char *key);
+int get_language_list_version_set(char *key, char *value);
+int get_language_list_version_list(char *key, char *value);
+int get_language_list_version_list_list(char *key, void (*callback) (int,
         void *, void *), void *data);
 char *get_list_version_plugin_path();
-int get_list_version_get_list(char *key, void (*callback) (int, void *,
-        void *), void *data);
 char *get_float_version_plugin_path();
 float get_float_version_get(char *key);
 int get_float_version_set(char *key, float value);
index 5feccfe..280029c 100644 (file)
                <desc>simple text example</desc>
        </config>
 
-       <config name="get_language_list_version" type="list">
+       <config name="get_font_list_version" type="string">
+               <plugin name="get_plugin_font_object" path="/usr/lib/libhelloworld_plugin.so">
+                       <function type="get"/>
+                       <function type="set"/>
+                       <function type="list"/>
+               </plugin>
+               <desc>get_plugin_fontlist_object</desc>
+       </config>
+
+       <config name="get_font_size_version" type="int">
+               <plugin name="get_plugin_fontsize_object" path="/usr/lib/libhelloworld_plugin.so">
+                       <function type="get"/>
+                       <function type="set"/>
+                       <function type="list"/>
+               </plugin>
+               <desc>get_plugin_fontsize_object</desc>
+       </config>
+
+
+       <config name="get_language_list_version" type="string">
                <plugin name="get_plugin_langlist_object" path="/usr/lib/libhelloworld_plugin.so">
                        <function type="get"/>
+                       <function type="set"/>
+                       <function type="list"/>
                </plugin>
                <desc>get_plugin_langlist_object</desc>
        </config>
index f1a5fad..64e2a94 100644 (file)
@@ -18,4 +18,5 @@ SET(PLUGIN1_VERSION_MINOR 1)
 SET(PLUGIN1_VERSION_PATCH 0)
 SET(PLUGIN1_VERSION_STR ${PLUGIN1_VERSION_MAJOR}.${PLUGIN1_VERSION_MINOR}.${PLUGIN1_VERSION_PATCH})
 SET_TARGET_PROPERTIES(plugin1 PROPERTIES VERSOIN ${PLUGIN1_VERSION_STR} SOVERSION ${PLUGIN1_VERSION_STR})
+TARGET_LINK_LIBRARIES(plugin1 ${pkgs_plugin1_LDFLAGS})
 INSTALL(TARGETS plugin1 DESTINATION ${DEST_PATH})
index febce3c..05b04e1 100644 (file)
@@ -18,4 +18,5 @@ SET(PLUGIN3_VERSION_MINOR 1)
 SET(PLUGIN3_VERSION_PATCH 0)
 SET(PLUGIN3_VERSION_STR ${PLUGIN3_VERSION_MAJOR}.${PLUGIN3_VERSION_MINOR}.${PLUGIN3_VERSION_PATCH})
 SET_TARGET_PROPERTIES(plugin3 PROPERTIES VERSOIN ${PLUGIN3_VERSION_STR} SOVERSION ${PLUGIN3_VERSION_STR})
+TARGET_LINK_LIBRARIES(plugin3 ${pkgs_plugin3_LDFLAGS})
 INSTALL(TARGETS plugin3 DESTINATION ${DEST_PATH})
index 1e49c77..e96be57 100644 (file)
@@ -3,7 +3,7 @@
 #-----------------------------------------------------------------------------------
 
 INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(pkgs_helloworld_plugin REQUIRED eina)
+PKG_CHECK_MODULES(pkgs_helloworld_plugin REQUIRED eina capi-system-system-settings vconf)
 
 FOREACH(flag ${pkgs_helloworld_plugin_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -19,6 +19,8 @@ ADD_LIBRARY(helloworld_plugin SHARED
                        hellofloat_plugin.c
                        hellolist_plugin.c
                        langlist_plugin.c
+                       fontlist_plugin.c
+                       fontsize_plugin.c
 )
 SET(PLUGIN1_VERSION_MAJOR 1)
 SET(PLUGIN1_VERSION_MINOR 1)
@@ -31,4 +33,6 @@ SET (LIBNAME "libhelloworld_plugin.so")
 
 SET(PLUGIN1_VERSION_STR ${PLUGIN1_VERSION_MAJOR}.${PLUGIN1_VERSION_MINOR}.${PLUGIN1_VERSION_PATCH})
 SET_TARGET_PROPERTIES(helloworld_plugin PROPERTIES VERSOIN ${PLUGIN1_VERSION_STR} SOVERSION ${PLUGIN1_VERSION_STR})
+#TARGET_LINK_LIBRARIES(${SETTING_DISPLAY_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
+TARGET_LINK_LIBRARIES(helloworld_plugin ${pkgs_helloworld_plugin_LDFLAGS})
 INSTALL(TARGETS helloworld_plugin DESTINATION ${DEST_PATH})
diff --git a/plugin_model/plugin_hello/fontlist_plugin.c b/plugin_model/plugin_hello/fontlist_plugin.c
new file mode 100644 (file)
index 0000000..2111397
--- /dev/null
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <plugin1.h>
+
+#include <glib.h>
+#include <Eina.h>
+
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include <system_settings.h>
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+static int fontlist_init()
+{
+       printf("fontlist_init \n");
+       return 0;
+}
+
+static int fontlist_destroy()
+{
+       printf("fontlist_destroy \n");
+       return 0;
+}
+
+static char* get_config_font(char* key)
+{
+       return NULL;
+}
+
+static int set_config_font(char* key, char* value)
+{
+
+       return 0;
+}
+
+static int get_config_font_list(char * key, void tcf_iterator(int, void*, void* ), void* data)
+{
+       return 0;
+}
+
+static PluginTizenConfig config = {
+       .init = fontlist_init,
+       .get_config_str = get_config_font,
+       .set_config_str = set_config_font,
+       .get_config_list = get_config_font_list,
+       .destroy = fontlist_destroy
+};
+
+PluginTizenConfig* get_plugin_fontlist_object()
+{
+       return &config;
+}
+
+
+
diff --git a/plugin_model/plugin_hello/fontsize_plugin.c b/plugin_model/plugin_hello/fontsize_plugin.c
new file mode 100644 (file)
index 0000000..fa2c1ad
--- /dev/null
@@ -0,0 +1,60 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <plugin1.h>
+
+#include <glib.h>
+#include <Eina.h>
+
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include <system_settings.h>
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+static int fontsize_init()
+{
+       printf("fontsize_init \n");
+       return 0;
+}
+
+static int fontsize_destroy()
+{
+       printf("fontsize_destroy \n");
+       return 0;
+}
+
+static int get_config_fontsize(char* key)
+{
+       /* SET SEARCHBAR AREA SIZE */
+       int value = 0;
+       int ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &value);
+       return value;
+}
+
+static int set_config_font(char* key, char* value)
+{
+
+       return 0;
+}
+
+static int get_config_font_list(char * key, void tcf_iterator(int, void*, void* ), void* data)
+{
+       return 0;
+}
+
+static PluginTizenConfig config = {
+       .init = fontsize_init,
+       .get_config_int = get_config_fontsize,
+       .set_config_int = set_config_font,
+       .get_config_list = get_config_font_list,
+       .destroy = fontsize_destroy
+};
+
+PluginTizenConfig* get_plugin_fontsize_object()
+{
+       return &config;
+}
+
+
+
index 241ad89..227f7c5 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <unistd.h>
 #include <plugin1.h>
 
 #include <glib.h>
@@ -8,6 +9,8 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
+#include <system_settings.h>
+
 #define LANGLIST_FILE_PATH             "/usr/apps/org.tizen.setting/def_config/langlist.xml"
 
 #define __FREE(del, arg) do { \
@@ -37,7 +40,6 @@ static int _langlist_load(char *path)
 {
        //SETTING_TRACE_BEGIN;
        //SETTING_TRACE("language list path: %s ", path);
-
        if (!s_langlist) {
                _parseLangListXML(path);
        }
@@ -143,15 +145,6 @@ static int _langlist_destroy()
        return 0;
 }
 
-#if 0
-void  setting_get_language_list_destroy()
-{
-       _langlist_destroy();
-}
-#endif
-
-
-
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 static int langlist_init()
 {
@@ -165,6 +158,38 @@ static int langlist_destroy()
        return 0;
 }
 
+static char* get_config_lang(char* key)
+{
+       char* localeLanguage = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &localeLanguage);
+
+       if (key != NULL) {
+               if (strcmp(key, "region") == 0) {
+                       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &localeLanguage);
+               } else if (strcmp(key, "language") == 0){
+                       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &localeLanguage);
+               } else {
+                       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &localeLanguage);
+               }
+       }
+
+       return localeLanguage;
+}
+
+static char* set_config_lang(char* key, char* value)
+{
+
+       if (key != NULL) {
+               if (strcmp(key, "region") == 0) {
+                       system_settings_set_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, value);
+               } else if (strcmp(key, "language") == 0){
+                       system_settings_set_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, value);
+               } else {
+                       system_settings_set_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, value);
+               }
+       }
+       return 0;
+}
 
 static int get_config_lang_list(char * key, void tcf_iterator(int, void*, void* ), void* data)
 {
@@ -195,9 +220,10 @@ static int get_config_lang_list(char * key, void tcf_iterator(int, void*, void*
        return 0;
 }
 
-
 static PluginTizenConfig config = {
        .init = langlist_init,
+       .get_config_str = get_config_lang,
+       .set_config_str = set_config_lang,
        .get_config_list = get_config_lang_list,
        .destroy = langlist_destroy
 };