--- /dev/null
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in Makefile
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = src
--- /dev/null
+#!/bin/sh
+
+libtoolize
+autoreconf -ivf
--- /dev/null
+AC_PREREQ([2.68])
+AC_INIT([efl-config], [0.1], [jae.hwan.kim@samsung.com])
+AC_CONFIG_SRCDIR([src/efl_config.c])
+#AC_CONFIG_HEADERS([efl_config.h])
+
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE([foreign])
+# Checks for programs.
+AC_PROG_CC
+AC_CONFIG_MACRO_DIR([m4])
+# Checks for libraries.
+DESKTOP=0
+AC_CHECK_LIB([elementary])
+# Checks for header files.
+# Checks for typedefs, structures, and compiler characteristics.
+AC_LIBTOOL_DLOPEN
+LT_INIT
+AC_PROG_LIBTOOL
+# Checks for library functions.
+PKG_CHECK_MODULES([ELEMENTARY],[elementary])
+PKG_CHECK_MODULES([ECOREWAYLAND],[ecore-wayland])
+PKG_CHECK_MODULES([CAPISYSTEMINFO],[capi-system-info])
+
+AC_SUBST([DESKTOP])
+AC_DEFINE_UNQUOTED([DESKTOP],[${DESKTOP}],["Desktop build is enabled"])
+AC_SUBST(TZ_SYS_BIN)
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ packaging/efl-config.service
+ packaging/efl-config-post.service
+ packaging/efl-config-ondemand.service
+ ])
+AC_OUTPUT
--- /dev/null
+[Unit]
+Description=Change the efl configures.
+
+[Service]
+Type=simple
+ExecStart=@TZ_SYS_BIN@/efl_config --with-message
+EnvironmentFile=-/run/tizen-system-env
--- /dev/null
+[Unit]
+Description=Change the efl configures.
+
+[Service]
+Type=simple
+ExecStart=@TZ_SYS_BIN@/efl_config
+EnvironmentFile=-/run/tizen-system-env
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+[Unit]
+Description=Change the efl configures.
+DefaultDependencies=no
+Before=starter.service
+After=enlightenment-user.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/sh -c "while [ ! -f /run/.wm_ready ] ; do /usr/bin/sleep .1 ; done ; exec @TZ_SYS_BIN@/efl_config"
+EnvironmentFile=-/run/tizen-system-env
--- /dev/null
+[Unit]
+Description=EFL Config Service socket
+
+[Socket]
+ListenStream=/run/user_ext/%U/.efl-config.sock
+Service=efl-config-ondemand.service
+SocketMode=0777
+
+[Install]
+WantedBy=sockets.target
--- /dev/null
+%define alias efl-config
+Name: efl-config
+Summary: EFL Config daemon
+Version: 0.1
+Release: 0
+Provides: efl-config = %{version}-%{release}
+Group: System/Libraries
+License: Apache-2.0
+Source: %{name}-%{version}.tar.gz
+Source2: %{alias}.manifest
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore-wayland)
+BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(libsystemd)
+BuildRequires: pkgconfig(capi-system-info)
+
+%description
+EFL config daemon
+
+%prep
+%setup -q
+cp %{SOURCE2} .
+
+%build
+./autogen.sh
+TZ_SYS_BIN=%{TZ_SYS_BIN} ./configure --prefix %{_prefix}/
+
+export TZ_SYS_RO_SHARE="%{TZ_SYS_RO_SHARE}"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}%{_unitdir_user}/basic.target.wants
+mkdir -p %{buildroot}%{_unitdir_user}/default.target.wants
+mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
+
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}.service %{buildroot}%{_unitdir_user}/%{alias}.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-post.service %{buildroot}%{_unitdir_user}/%{alias}-post.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}-ondemand.service %{buildroot}%{_unitdir_user}/%{alias}-ondemand.service
+install -m 0644 %{_builddir}/%{name}-%{version}/packaging/%{alias}.socket %{buildroot}%{_unitdir_user}/%{alias}.socket
+
+ln -s ../%{alias}.service %{buildroot}%{_unitdir_user}/basic.target.wants/%{alias}.service
+ln -s ../%{alias}-post.service %{buildroot}%{_unitdir_user}/default.target.wants/%{alias}-post.service
+ln -s ../%{alias}.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/%{alias}.socket
+
+%post
+/sbin/ldconfig
+mkdir -p /opt/share/.elementary
+chmod -R 775 /opt/share/.elementary
+chown -R :users /opt/share/.elementary
+chsmack -a 'User::App::Shared' /opt/share/.elementary
+chsmack -t /opt/share/.elementary
+
+%postun
+/sbin/ldconfig
+rm -f %{buildroot}%{_unitdir_user}/basic.target.wants/%{alias}.service
+rm -f %{buildroot}%{_unitdir_user}/default.target.wants/%{alias}-post.service
+
+%files
+%defattr(-,root,root,-)
+%{TZ_SYS_BIN}/efl_config
+%{_unitdir_user}/%{alias}.service
+%{_unitdir_user}/%{alias}-post.service
+%{_unitdir_user}/%{alias}-ondemand.service
+%{_unitdir_user}/basic.target.wants/%{alias}.service
+%{_unitdir_user}/default.target.wants/%{alias}-post.service
+%{_unitdir_user}/sockets.target.wants/%{alias}.socket
+%{_unitdir_user}/%{alias}.socket
+%manifest %{alias}.manifest
--- /dev/null
+MAINTAINERCLEANFILES = Makefile.in Makefile
+
+bin_PROGRAMS = efl_config
+efl_config_SOURCES = efl_config.c
+
+efl_config_CFLAGS = $(ELEMENTARY_CFLAGS) $(ECOREWAYLAND_CFLAGS) $(CAPISYSTEMINFO_CFLAGS) -ggdb -I../lib -I../ -fPIE
+efl_config_LDADD = $(ELEMENTARY_LIBS) $(ECOREWAYLAND_LIBS) $(CAPISYSTEMINFO_LIBS) -lutil -ldl -lsystemd
+efl_config_LDFLAGS = -pie
--- /dev/null
+#include <Elementary.h>
+#include <Ecore_Wayland.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <systemd/sd-daemon.h>
+#include <fcntl.h>
+
+#define BUF_SIZE 512
+
+#define EFL_CONFIG_LOG_LEVEL "4"
+#define EFL_CONFIG_RUN_TIMER_TIME 0.2
+
+/* Determine Tizen profile at runtime */
+#include <system_info.h>
+
+typedef enum {
+ TIZEN_PROFILE_UNKNOWN = 0,
+ TIZEN_PROFILE_MOBILE = 0x1,
+ TIZEN_PROFILE_WEARABLE = 0x2,
+ TIZEN_PROFILE_TV = 0x4,
+ TIZEN_PROFILE_IVI = 0x8,
+ TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
+static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+
+static tizen_profile_t _get_tizen_profile()
+{
+ char *profileName;
+ int *ret;
+ ret = system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ if (ret != SYSTEM_INFO_ERROR_NONE)
+ {
+ EINA_LOG_ERR("efl-config :: fails to get profile, set as TIZEN_PROFILE_COMMON");
+ profile = TIZEN_PROFILE_COMMON;
+ return profile;
+ }
+
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = TIZEN_PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
+
+static inline tizen_profile_t get_tizen_profile()
+{
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+ return _get_tizen_profile();
+}
+
+static void
+_scale_set(void)
+{
+ Evas_Coord w, h;
+ float inch, scale = 0.0, saved_scale = 0.0, profile_factor = 1.0;
+ int dpi;
+
+ ecore_wl_sync();
+ dpi = ecore_wl_dpi_get();
+
+ tizen_profile_t prof = get_tizen_profile();
+ if (prof == TIZEN_PROFILE_MOBILE || prof == TIZEN_PROFILE_IVI || prof == TIZEN_PROFILE_COMMON)
+ {
+ ecore_wl_screen_size_get(&w, &h);
+
+ inch = floor(sqrt((w * w) + (h * h)) / dpi * 10 + 0.5) / 10;
+
+ if (inch <= 4.5) profile_factor = 0.7;
+ else profile_factor = 0.8;
+
+ scale = floor((double)dpi * profile_factor / 90.0 * 10 + 0.5) / 10;
+ }
+ else if (prof == TIZEN_PROFILE_WEARABLE)
+ {
+ profile_factor = 0.4;
+ scale = floor((double)dpi * profile_factor / 90.0 * 10 + 0.5) / 10;
+ }
+ else /* prof == TIZEN_PROFILE_TV */
+ {
+ ecore_wl_screen_size_get(&w, &h);
+
+ profile_factor = 2.0;
+ scale = floor((double)w * profile_factor / 1920 * 10 + 0.5) / 10;
+ }
+
+ saved_scale = elm_config_scale_get();
+
+ if (scale != saved_scale && !getenv("ELM_SCALE"))
+ {
+ EINA_LOG_DBG("efl-config :: save new scale [%f], old scale [%f]", scale, saved_scale);
+ elm_config_scale_set(scale);
+ elm_config_save();
+ elm_config_all_flush();
+ }
+}
+
+static void
+_font_set(const char *font_name, int font_size)
+{
+ Eina_List *text_classes = NULL;
+ Elm_Text_Class *etc = NULL;
+ Eina_List *l = NULL;
+
+ text_classes = elm_config_text_classes_list_get();
+
+ /* Legacy text_classes for Tizen */
+ elm_config_font_overlay_set("tizen_medium", (const char *)font_name, -100);
+ elm_config_font_overlay_set("tizen_roman", (const char *)font_name, -100);
+ elm_config_font_overlay_set("tizen_bold", (const char *)font_name, -100);
+ elm_config_font_overlay_set("tizen_regular", (const char *)font_name, -100);
+
+ /* "tizen" text_class is used only for changing font name */
+ elm_config_font_overlay_set("tizen", (const char *)font_name, -100);
+
+ EINA_LIST_FOREACH(text_classes, l, etc)
+ elm_config_font_overlay_set(etc->name, font_name, font_size);
+
+ elm_config_text_classes_list_free(text_classes);
+ text_classes = NULL;
+
+ elm_config_font_overlay_apply();
+}
+
+static Eina_Bool
+_efl_config_message_parse(char *buf)
+{
+ char *token = NULL;
+ Eina_Bool need_to_save = EINA_FALSE;
+ const char *font_name = NULL;
+ int font_size = -100; /* 100% size based on each font_size */
+
+ token = strtok(buf, ": ");
+
+ while (token)
+ {
+ if (!strncmp(token, "font_name", strlen("font_name")))
+ {
+ /* Get Font Name */
+ token = strtok(NULL, ",");
+
+ if (token)
+ {
+ while (*token == ' ') token++;
+
+ if (strcmp(token, ""))
+ font_name = token;
+ }
+
+ EINA_LOG_DBG("efl-config :: font_name [%s]", font_name);
+ }
+ else if (!strncmp(token, "font_size", strlen("font_size")))
+ {
+ /* Get Font Size */
+ token = strtok(NULL, ",");
+
+ if (token)
+ {
+ while (*token == ' ') token++;
+ font_size = atoi(token);
+ }
+
+ if (font_size == 0)
+ {
+ EINA_LOG_ERR("efl-config :: font_size is zero [%d]", font_size);
+ font_size = -100;
+ }
+
+ EINA_LOG_DBG("efl-config :: font_size [%d]", font_size);
+ }
+ /* TODO: Parse more config values here */
+
+ token = strtok(NULL, ": ");
+ }
+
+ if (font_name)
+ {
+ EINA_LOG_INFO("efl-config :: sets font_name [%s], font_size [%d]", font_name, font_size);
+ _font_set(font_name, font_size);
+ need_to_save = EINA_TRUE;
+ }
+ /* TODO: Apply more config values here */
+
+ if (get_tizen_profile() == TIZEN_PROFILE_IVI || get_tizen_profile() == TIZEN_PROFILE_COMMON)
+ {
+ if (need_to_save)
+ {
+ EINA_LOG_DBG("efl-config :: calls elm_config_save!");
+ elm_config_all_flush();
+ elm_config_save();
+ }
+ }
+
+ return need_to_save;
+}
+
+static int _create_sock_activation(void)
+{
+ int fds;
+
+ fds = sd_listen_fds(0);
+ if (fds == 1)
+ return SD_LISTEN_FDS_START;
+
+ EINA_LOG_ERR("efl-config :: ERROR :: fds > 1 ... fds [%d]", fds);
+ return -1;
+}
+
+
+static Eina_Bool
+_efl_config_run_internal(void)
+{
+ int fd, client_fd, flags, size, i = 0;
+ char buf[BUF_SIZE] = { 0 };
+ Eina_Bool need_to_save = EINA_FALSE;
+
+ fd = _create_sock_activation();
+ if (fd < 0)
+ {
+ EINA_LOG_ERR("efl-config :: fails to get socket fd[%d]!", fd);
+ return EINA_FALSE;
+ }
+
+ /* Sets O_NONBLOCK flag to socket fd.
+ * It prevents blocking at accept() function when listen() queue is empty. */
+ flags = fcntl(fd, F_GETFL, 0);
+ if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
+ EINA_LOG_ERR("efl-config :: fails to set O_NONBLOCK flage to socket fd[%d].", fd);
+
+ /* Gets a file descriptor while listen() queue is not empty */
+ while ((client_fd = accept(fd, NULL, 0)) > 0)
+ {
+ /* Gets a message from client's fd */
+ while ((size = read(client_fd, buf, BUF_SIZE - 1)) > 0)
+ {
+ EINA_LOG_INFO("efl-config :: %d. message received ... msg [%s], size [%d]", i++, buf, size);
+
+ need_to_save |= _efl_config_message_parse(buf);
+ }
+
+ close(client_fd);
+ }
+
+ /* Save elementary's config */
+ if (need_to_save)
+ {
+ EINA_LOG_INFO("efl-config :: calls elm_config_save!");
+ elm_config_all_flush();
+ elm_config_save();
+
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_efl_config_run_timer_cb(void *data)
+{
+ EINA_LOG_INFO("efl-config :: _efl_config_run_timer_cb START!");
+
+ /* Renew the timer if there is a additional message. */
+ if (_efl_config_run_internal())
+ {
+ EINA_LOG_INFO("efl-config :: _efl_config_run_timer_cb RENEW!");
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ EINA_LOG_INFO("efl-config :: calls elm_exit()...");
+ elm_exit();
+
+ EINA_LOG_INFO("efl-config :: _efl_config_run_timer_cb DONE!");
+ return ECORE_CALLBACK_DONE;
+}
+
+static void
+_efl_config_run(double interval_time)
+{
+ static Ecore_Timer *efl_config_run_timer = NULL;
+
+ if (efl_config_run_timer) ecore_timer_del(efl_config_run_timer);
+
+ _efl_config_run_internal();
+
+ /* Run the efl-config process by elm_run() for a very short time.
+ * If there is no additional message, the timer will call elm_exit() to exit the process. */
+ efl_config_run_timer = ecore_timer_add(interval_time, _efl_config_run_timer_cb, NULL);
+
+ EINA_LOG_INFO("efl-config :: calls elm_run()...");
+ elm_run();
+}
+
+int main(int argc, char **argv)
+{
+ int i = 0;
+ Eina_Bool opt_with_message = EINA_FALSE;
+
+ setenv("EINA_LOG_LEVEL", EFL_CONFIG_LOG_LEVEL, 1);
+
+ elm_init(argc, argv);
+
+ EINA_LOG_INFO("efl-config :: START");
+
+ elm_win_add(NULL, "config", ELM_WIN_BASIC);
+
+ if (argc > 1)
+ {
+ /* do if this daemon launched by system socket */
+ for (i = 1; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "--with-message"))
+ {
+ opt_with_message = EINA_TRUE;
+ EINA_LOG_DBG("efl-config :: + option with-message");
+ }
+ }
+ }
+ else
+ {
+ EINA_LOG_DBG("efl-config :: Launching without option. Call _scale_set()");
+ _scale_set();
+ }
+
+ if (opt_with_message)
+ {
+ EINA_LOG_INFO("efl-config :: Calls _efl_config_run()...");
+ _efl_config_run(EFL_CONFIG_RUN_TIMER_TIME);
+ }
+
+ EINA_LOG_INFO("efl-config :: DONE");
+
+ elm_shutdown();
+
+ return 0;
+}