summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaehyeon Jung <darrenh.jung@samsung.com>2016-02-29 18:24:34 +0900
committerDaehyeon Jung <darrenh.jung@samsung.com>2016-02-29 22:13:10 +0900
commit46d1989076e3b7ec50c46851c3bb79a1b9d9ef59 (patch)
treee539fdc1aade5bac81aa9a66e3f877136b74c57a
parent39b586294a0c637d8f33b2b25b7c7e07ad9348f1 (diff)
downloadappcore-watch-46d1989076e3b7ec50c46851c3bb79a1b9d9ef59.tar.gz
appcore-watch-46d1989076e3b7ec50c46851c3bb79a1b9d9ef59.tar.bz2
appcore-watch-46d1989076e3b7ec50c46851c3bb79a1b9d9ef59.zip
Change-Id: Ief4adc6d7c54ac70f850a75f2dd941cf8a1483c6 Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
-rwxr-xr-xinclude/appcore-watch.h1
-rwxr-xr-xsrc/appcore-watch.c53
-rwxr-xr-xsrc/watch_app_main.c2
3 files changed, 45 insertions, 11 deletions
diff --git a/include/appcore-watch.h b/include/appcore-watch.h
index 75d8e59..c8b3aaa 100755
--- a/include/appcore-watch.h
+++ b/include/appcore-watch.h
@@ -83,6 +83,7 @@ int watch_core_terminate();
int watch_core_set_event_callback(enum watch_core_event event,
int (*cb)(void *, void *), void *data);
+const char *watch_core_get_appid();
void watch_core_get_timeinfo(struct watch_time_s *timeinfo);
diff --git a/src/appcore-watch.c b/src/appcore-watch.c
index a10cb41..de22d51 100755
--- a/src/appcore-watch.c
+++ b/src/appcore-watch.c
@@ -25,6 +25,8 @@
#include <malloc.h>
#include <assert.h>
+#include <bundle_internal.h>
+
#include <Elementary.h>
#include <app_control.h>
@@ -1009,14 +1011,6 @@ static int __signal_alpm_handler(int ambient, void *data)
return 0;
}
-static int __watch_core_widget_init(void)
-{
- _D("Initialize the widget");
-
- return 0;
-
-}
-
static void __watch_core_signal_init(void)
{
_watch_core_listen_alpm_handler(__signal_alpm_handler, NULL);
@@ -1039,13 +1033,48 @@ static int __before_loop(struct watch_priv *watch, int argc, char **argv)
g_type_init();
#endif
+ bundle *kb = NULL;
+ char *wayland_display = NULL;
+ char *xdg_runtime_dir = NULL;
+ char *width_str = NULL;
+ char *height_str = NULL;
+ int width = 360;
+ int height = 360;
+ kb = bundle_import_from_argv(argc, argv);
+ if (kb) {
+ bundle_get_str(kb, "XDG_RUNTIME_DIR", &xdg_runtime_dir);
+ bundle_get_str(kb, "WAYLAND_DISPLAY", &wayland_display);
+ bundle_get_str(kb, "WATCH_WIDTH", &width_str);
+ bundle_get_str(kb, "WATCH_HEIGHT", &height_str);
+
+ if (xdg_runtime_dir) {
+ _E("senenv: %s", xdg_runtime_dir);
+ setenv("XDG_RUNTIME_DIR", xdg_runtime_dir, 1);
+ } else
+ _E("failed to get xdgruntimedir");
+
+ if (wayland_display) {
+ _E("setenv: %s", wayland_display);
+ setenv("WAYLAND_DISPLAY", wayland_display, 1);
+ } else
+ _E("failed to get waylanddisplay");
+
+ if (width_str)
+ width = atoi(width_str);
+
+ if (height_str)
+ height = atoi(height_str);
+
+ bundle_free(kb);
+ } else
+ _E("failed to get launch argv");
+
elm_init(argc, argv);
r = watch_core_init(watch->name, &w_ops, argc, argv);
_retv_if(r < 0, -1);
- r = __watch_core_widget_init();
- _retv_if(r < 0, r);
+ __widget_create(NULL, NULL, width, height, NULL);
__watch_core_signal_init();
@@ -1107,3 +1136,7 @@ EXPORT_API void watch_core_get_timeinfo(struct watch_time_s *timeinfo)
__get_timeinfo(timeinfo);
}
+EXPORT_API const char *watch_core_get_appid()
+{
+ return priv.appid;
+}
diff --git a/src/watch_app_main.c b/src/watch_app_main.c
index 140fc74..6b99141 100755
--- a/src/watch_app_main.c
+++ b/src/watch_app_main.c
@@ -618,7 +618,7 @@ EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
if (win == NULL)
return watch_app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- ret_win = elm_win_add(NULL, NULL, ELM_WIN_BASIC);
+ ret_win = elm_win_add(NULL, watch_core_get_appid(), ELM_WIN_BASIC);
if (ret_win == NULL)
return watch_app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);