Add include stdlib.h for free()
[platform/core/api/system-settings.git] / src / sst_font.c
index e14f709..89b81c9 100644 (file)
@@ -16,6 +16,7 @@
 #include "sst_font.h"
 
 #include <libxml/tree.h>
+#include <stdlib.h>
 #include <vconf.h>
 #include "sst.h"
 #include "sst_utils_wrapper.h"
@@ -162,6 +163,27 @@ int sst_font_set_type(sst_interface *iface, const char *font_name)
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
+int sst_font_get_type(sst_interface *iface, char **value)
+{
+       RETV_IF(NULL == iface, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == iface->vconf_key, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       char *result = vconf_get_str(iface->vconf_key);
+       if (NULL == result) {
+               ERR("vconf_get_str(%s) Fail(NULL)", iface->vconf_key);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       if (SST_EQUAL == strcmp(result, "Default")) {
+               free(result);
+               return sst_font_get_default_type(iface, value);
+       } else {
+               *value = result;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
 int sst_font_get_default_type(sst_interface *iface, char **value)
 {
        char *font_name = sstu_get_default_font();