#include <errno.h>
#include <time.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <systemd/sd-login.h>
-#include <fcntl.h>
-
-#define EFL_CONFIG_SOCK_PATH "/run/user_ext/%d"
-#define EFL_CONFIG_SOCKET_FILE ".efl-config.sock"
-
#include <regex.h>
#include <dlog.h>
#include <system_settings_util.h>
#include <system_settings_font.h>
+#include <efl_extension_config.h>
+
#ifdef TIZEN_WEARABLE
#define SMALL_FONT_DPI (-90)
#endif
return __get_main_font_family_name_by_alias(SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS);
}
-bool _is_in_system_session()
-{
- SETTING_TRACE_BEGIN;
- int ret = 0;
- char *slice = NULL;
-
- ret = sd_pid_get_slice(getpid(), &slice);
- if (0 <= ret && slice) {
- if (0 == strncmp(slice, "system.slice", strlen("system.slice"))) {
- free(slice);
- return true;
- }
- } else {
- SETTING_TRACE("sd_pid_get_slice() Fail(%d)", ret);
- }
-
- free(slice);
- return false;
-}
-
-bool _get_active_uid(uid_t *uid)
-{
- SETTING_TRACE_BEGIN;
- int active_user_count = 0;
- uid_t *active_user_list = NULL;
-
- active_user_count = sd_get_active_uids(&active_user_list);
- /* the number of active users is 1 in tizen3.0 */
- if (1 == active_user_count && active_user_list) {
- *uid = active_user_list[0];
- SETTING_TRACE("active uid = %d", *uid);
- } else {
- SETTING_TRACE("sd_get_active_uids() Fail(%d)", active_user_count);
- free(active_user_list);
- return false;
- }
-
- return true;
-}
-
-bool
-_efl_config_set(char *msg)
-{
- SETTING_TRACE_BEGIN;
- int fd;
- char sock_file[1024] = {0};
- uid_t active_uid = getuid();
- bool ret = false;
-
- if (_is_in_system_session() == true) {
- if (_get_active_uid(&active_uid) == false) {
- SETTING_TRACE("get active uid fail");
- return ret;
- }
- }
-
- snprintf(sock_file, sizeof(sock_file), EFL_CONFIG_SOCK_PATH"/%s",
- active_uid,
- EFL_CONFIG_SOCKET_FILE);
-
- do {
- int r, size, flags;
- struct sockaddr_un server_addr;
-
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
- SETTING_TRACE("socket[%d] error :%d", fd, errno);
- break;
- }
-
- flags = fcntl(fd, F_GETFL, 0);
- if (flags == -1)
- flags = 0;
- r = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
- if (0 != r)
- SETTING_TRACE("fcntl fail : %d", errno);
-
- bzero(&server_addr, sizeof(server_addr));
- server_addr.sun_family = AF_UNIX;
- snprintf(server_addr.sun_path, sizeof(server_addr.sun_path), "%s",
- sock_file);
-
- r = connect(fd, (struct sockaddr *)&server_addr, sizeof(server_addr));
- if (r != 0) {
- SETTING_TRACE("connect error : %d, %d", r, errno);
- close(fd);
- break;
- }
-
- size = write(fd, msg, strlen(msg));
- if (size <= 0) {
- SETTING_TRACE("write fail : %d", errno);
- } else {
- ret = true;
- }
- close(fd);
- } while (0);
-
- return ret;
-}
/* LCOV_EXCL_START */
bool font_config_set(char *font_name)
{
SETTING_TRACE_BEGIN;
- char buf[255] = { 0 };
int font_size = __font_size_get();
- bool ret;
-
- snprintf(buf, sizeof(buf), "font_name: %s, font_size: %d", font_name, font_size);
- ret = _efl_config_set(buf);
-
- return ret;
+ return eext_config_font_set(font_name, font_size);
}
/* LCOV_EXCL_STOP */
void __font_size_set()
{
SETTING_TRACE_BEGIN;
- char buf[255] = { 0 };
int font_size = __font_size_get();
char *font_name = NULL;
-
font_name = vconf_get_str(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME);
- snprintf(buf, sizeof(buf), "font_name: %s, font_size: %d", font_name, font_size);
- _efl_config_set(buf);
+ eext_config_font_set(font_name, font_size);
g_free(font_name);
}