#include <app_control_internal.h>
#include <efl_extension.h>
+#include <appsvc.h>
+#include <watch_control.h>
+#include <pkgmgr-info.h>
+
+
int errno;
#include "main.h"
}
}
+static void __watch_added(void *data, Evas_Object *obj, void *event_info)
+{
+ LOGD("watch added");
+ Evas_Object *clock = (Evas_Object *)event_info;
+
+ evas_object_resize(s_info.win, s_info.w, s_info.h);
+ evas_object_resize(clock, s_info.w, s_info.h);
+
+ evas_object_show(clock);
+ evas_object_show(s_info.win);
+}
+
+static void __watch_removed(void *data, Evas_Object *obj, void *event_info)
+{
+ LOGD("watch removed");
+}
+
static bool app_create(void *data)
{
load_configuration();
eext_object_event_callback_add(s_info.win, EEXT_CALLBACK_BACK, back_key_cb, NULL);
evas_object_show(s_info.win);
+
return true;
}
{
char *widget_id = NULL;
int ret;
+ int lazy_loader = 0;
+ char *app_type = NULL;
+ pkgmgrinfo_appinfo_h app_info;
+ app_control_h watch_control = NULL;
+ bundle *b;
ret = app_control_get_extra_data(service, WIDGET_APPID, &widget_id);
if (ret == APP_CONTROL_ERROR_NONE) {
-#if 0
- char *category;
-#endif
- int lazy_loader = 0;
DbgPrint("Loading a widget: [%s]\n", widget_id);
if (!widget_id)
return;
-#if 0
- category = widget_service_get_category(widget_id);
- if (category) {
- if (!strcmp(category, WATCH_CATEGORY)) {
- /**
- * Trying to unload the WATCH from W-HOME
- */
- char *watch_id;
- int need_to_unload = 0;
- watch_id = vconf_get_str(VCONFKEY_WMS_CLOCKS_SET_IDLE);
- if (watch_id) {
- need_to_unload = !!strcmp(watch_id, s_info.default_watch);
- free(watch_id);
- }
-
- if (need_to_unload) {
- DbgPrint("Watch: [%s] - unload first, SET(%s)\n", widget_id, s_info.default_watch);
- ret = vconf_set_str(VCONFKEY_WMS_CLOCKS_SET_IDLE, s_info.default_watch);
- if (ret != 0)
- ErrPrint("If this is not wearable, there is no such CLOCKS_SET_IDLE key (%d)\n", ret);
-
- /**
- * @note
- * In this case, we should waiting some time to unload watch first.
- */
- lazy_loader = 1;
- }
- }
- free(category);
+ ret = pkgmgrinfo_appinfo_get_appinfo(widget_id, &app_info);
+ if (PMINFO_R_OK != ret) {
+ ErrPrint("fail to get %s appinfo %d", widget_id, ret);
+ return;
}
-#endif
- ret = unload_widget();
- ret = prepare_widget(widget_id, service);
+ pkgmgrinfo_appinfo_get_component_type(app_info, &app_type);
+ if (app_type != NULL && strcmp(app_type, "watchapp") == 0) {
+ watch_manager_init(s_info.win);
+ evas_object_smart_callback_add(s_info.win, WATCH_SMART_SIGNAL_ADDED, __watch_added, NULL);
+ evas_object_smart_callback_add(s_info.win, WATCH_SMART_SIGNAL_REMOVED, __watch_removed, NULL);
+
+ watch_manager_get_app_control(widget_id, &watch_control);
+ app_control_to_bundle(watch_control, &b);
+ appsvc_run_service(b, 0, NULL, NULL);
+ DbgPrint("appsvc_run_service returns [%d]", widget_id);
+ app_control_destroy(watch_control);
+ } else {
+ ret = unload_widget();
+ ret = prepare_widget(widget_id, service);
- if (s_info.lazy_widget_loader) {
- char *tmp;
- tmp = ecore_timer_del(s_info.lazy_widget_loader);
- free(tmp);
- }
+ if (s_info.lazy_widget_loader) {
+ char *tmp;
+ tmp = ecore_timer_del(s_info.lazy_widget_loader);
+ free(tmp);
+ }
- if (lazy_loader) {
- DbgPrint("Load a watch after some time later (%lf)\n", s_info.lazy_watch_time);
- s_info.lazy_widget_loader = ecore_timer_add(s_info.lazy_watch_time, lazy_widget_loader_cb, widget_id);
- if (!s_info.lazy_widget_loader) {
- ErrPrint("Unable to fire the timer\n");
+ if (lazy_loader) {
+ DbgPrint("Load a watch after some time later (%lf)\n", s_info.lazy_watch_time);
+ s_info.lazy_widget_loader = ecore_timer_add(s_info.lazy_watch_time, lazy_widget_loader_cb, widget_id);
+ if (!s_info.lazy_widget_loader) {
+ ErrPrint("Unable to fire the timer\n");
+ lazy_widget_loader_cb(widget_id);
+ }
+ /**
+ * @note
+ * widget_id will be deleted from lazy_widget_loader_cb. or return value of ecore_timer_del().
+ */
+ } else {
+ DbgPrint("Immediately loads the watch[%s]\n", widget_id);
lazy_widget_loader_cb(widget_id);
}
- /**
- * @note
- * widget_id will be deleted from lazy_widget_loader_cb. or return value of ecore_timer_del().
- */
- } else {
- DbgPrint("Immediately loads the watch[%s]\n", widget_id);
- lazy_widget_loader_cb(widget_id);
}
+
} else {
/**
* @note