summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoon87.park <moon87.park@samsung.com>2016-12-08 21:23:29 +0900
committermoon87.park <moon87.park@samsung.com>2016-12-08 21:23:50 +0900
commit8f5e64799e79dbadca6ffbf92523b4eaf8b753ca (patch)
tree9af0f6e29a640538c71feb050e3e9e44587285a7
parentf615ed406bef810d91dcc6dd7807baa318a61379 (diff)
parent3c1a3b69e845adff0bfe3000db136ab47b73ba41 (diff)
downloadw-clock-viewer-8f5e64799e79dbadca6ffbf92523b4eaf8b753ca.tar.gz
w-clock-viewer-8f5e64799e79dbadca6ffbf92523b4eaf8b753ca.tar.bz2
w-clock-viewer-8f5e64799e79dbadca6ffbf92523b4eaf8b753ca.zip
Change-Id: I6c8de9546eb9d8ed2a8785be645ccbaa335229b5
-rw-r--r--clock-viewer/include/clock-viewer-util-pkginfo.h1
-rw-r--r--clock-viewer/include/clock-viewer-widget.h2
-rw-r--r--clock-viewer/src/clock-viewer-util-pkginfo.c9
-rw-r--r--clock-viewer/src/clock-viewer-widget.c6
-rw-r--r--clock-viewer/src/clock-viewer.c22
5 files changed, 29 insertions, 11 deletions
diff --git a/clock-viewer/include/clock-viewer-util-pkginfo.h b/clock-viewer/include/clock-viewer-util-pkginfo.h
index 550792c..e8e98bd 100644
--- a/clock-viewer/include/clock-viewer-util-pkginfo.h
+++ b/clock-viewer/include/clock-viewer-util-pkginfo.h
@@ -28,6 +28,7 @@ extern void clock_viewer_util_pkginfo_init_clock_package_event(void *data, vconf
extern void clock_viewer_util_pkginfo_fini_clock_package_event(vconf_callback_fn cb);
extern char *clock_viewer_util_pkginfo_get_clock_package(void);
+extern int clock_viewer_util_pkginfo_get_clock_resource_id(void);
extern clock_viewer_ambient_type clock_viewer_util_pkginfo_get_ambient_type(char *appid);
diff --git a/clock-viewer/include/clock-viewer-widget.h b/clock-viewer/include/clock-viewer-widget.h
index 867f41a..3ad1eaa 100644
--- a/clock-viewer/include/clock-viewer-widget.h
+++ b/clock-viewer/include/clock-viewer-widget.h
@@ -24,7 +24,7 @@
#include "clock-viewer.h"
-extern void clock_viewer_widget_init(void *data, Evas_Object *parent, char *pkgname);
+extern void clock_viewer_widget_init(void *data, Evas_Object *parent, char *pkgname, int resource_id);
extern void clock_viewer_widget_fini(void *data);
extern void clock_viewer_widget_pause(void);
extern void clock_viewer_widget_resume(void);
diff --git a/clock-viewer/src/clock-viewer-util-pkginfo.c b/clock-viewer/src/clock-viewer-util-pkginfo.c
index b77ad04..efebc3b 100644
--- a/clock-viewer/src/clock-viewer-util-pkginfo.c
+++ b/clock-viewer/src/clock-viewer-util-pkginfo.c
@@ -27,7 +27,7 @@ HAPI void clock_viewer_util_pkginfo_init_clock_package_event(void *data, vconf_c
{
int ret = 0;
- ret = vconf_notify_key_changed(VCONFKEY_WMS_CLOCKS_SET_IDLE, cb, data);
+ ret = vconf_notify_key_changed("memory/homescreen/watch_resource_id", cb, data);
if (ret != 0) {
_ERR("Failed to notify clock set");
}
@@ -48,6 +48,13 @@ HAPI char *clock_viewer_util_pkginfo_get_clock_package(void)
return vconf_get_str(VCONFKEY_WMS_CLOCKS_SET_IDLE);
}
+HAPI int clock_viewer_util_pkginfo_get_clock_resource_id(void)
+{
+ int resource_id = 0;
+ vconf_get_int("memory/homescreen/watch_resource_id", &resource_id);
+ return resource_id;
+}
+
static inline char *pkgmgr_get_mainapp(const char *pkgid)
{
pkgmgrinfo_pkginfo_h handle;
diff --git a/clock-viewer/src/clock-viewer-widget.c b/clock-viewer/src/clock-viewer-widget.c
index ec7c7e8..66dd465 100644
--- a/clock-viewer/src/clock-viewer-widget.c
+++ b/clock-viewer/src/clock-viewer-widget.c
@@ -41,6 +41,7 @@ static struct _widget_info
int view_pos;
int view_pos_timestamp;
+ int resource_id;
} s_widget_info = {
.win = NULL,
.layout = NULL,
@@ -53,6 +54,7 @@ static struct _widget_info
.view_pos = 0,
.view_pos_timestamp = 0,
+ .resource_id = 0,
};
@@ -97,7 +99,7 @@ static void _watch_removed_cb(void *data, Evas_Object *obj, void *event_info)
}
-HAPI void clock_viewer_widget_init(void *data, Evas_Object *win, char *pkgname)
+HAPI void clock_viewer_widget_init(void *data, Evas_Object *win, char *pkgname, int resource_id)
{
if (s_widget_info.is_widget_init) {
_DBG("widget already initialized");
@@ -121,6 +123,8 @@ HAPI void clock_viewer_widget_init(void *data, Evas_Object *win, char *pkgname)
watch_manager_init(win);
+ watch_manager_set_resource_id(resource_id);
+
evas_object_smart_callback_add(win, WATCH_SMART_SIGNAL_ADDED, _watch_added_cb, data);
evas_object_smart_callback_add(win, WATCH_SMART_SIGNAL_REMOVED, _watch_removed_cb, data);
diff --git a/clock-viewer/src/clock-viewer.c b/clock-viewer/src/clock-viewer.c
index 67a5899..24f365d 100644
--- a/clock-viewer/src/clock-viewer.c
+++ b/clock-viewer/src/clock-viewer.c
@@ -252,7 +252,7 @@ static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg)
#endif
ret = vconf_set_int(CLOCK_VIEWER_VCONF_CLOCK_VIEWER_CLOCK_VISIBILITY, s_info.home_clock_visibitity);
if (ret != 0) {
- _ERR("Failed to set clock visibility");
+ _ERR("Failed to set clock visibility. ret[%d] home_clock_visibitity[%d]", ret, s_info.home_clock_visibitity);
} else {
_DBG("Clock visibility set to [%d]", s_info.home_clock_visibitity);
}
@@ -268,13 +268,15 @@ static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg)
}
char *clock_signal[1] = { "clockstart" };
- _WARN("clock start >>");
+ _DBG("clock start >>");
device_power_request_lock(POWER_LOCK_CPU, 0);
clock_viewer_util_dbus_broadcast_signal(clock_viewer, DEVICED_PATH, DEVICED_INTERFACE, "HomeScreen", "s", &clock_signal[0]);
+ _DBG("ambient_type[%d] clock_viewer->current_type[%d]", s_info.ambient_type, clock_viewer->current_type);
+
if (s_info.ambient_type == CLOCK_VIEWER_AMBIENT_TYPE_MANUAL) {
char *clock_begin_signal[1] = { "clockbegin" };
- _WARN("clock begin >>");
+ _DBG("clock begin >>");
clock_viewer_util_dbus_broadcast_signal(clock_viewer, DEVICED_PATH, DEVICED_INTERFACE, "HomeScreen", "s", &clock_begin_signal[0]);
}
@@ -283,6 +285,7 @@ static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg)
s_info.render_first_timer = ecore_timer_add(1.0, __clock_viewer_render_first_timer_cb, clock_viewer);
}
+ _DBG("clock_visibitity[%d]", s_info.clock_visibitity);
if (!s_info.clock_visibitity) {
clock_viewer_show(clock_viewer, 0);
}
@@ -348,6 +351,7 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
{
clock_viewer_ambient_type ambient_type;
char *pkgname;
+ int resource_id = 0;
pkgname = clock_viewer_util_pkginfo_get_clock_package();
if (!pkgname) {
@@ -355,6 +359,12 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
return;
}
+ resource_id = clock_viewer_util_pkginfo_get_clock_resource_id();
+ if (!resource_id) {
+ _ERR("resource id is not valid\n");
+ return;
+ }
+
if (s_info.clock_pkgname) {
if (!strcmp(s_info.clock_pkgname, pkgname)) {
_WARN("same pkgname(%s), skip!", pkgname);
@@ -368,10 +378,6 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
ambient_type = clock_viewer_util_pkginfo_get_ambient_type(pkgname);
_DBG("package[%s] ambient type[%d]", pkgname, ambient_type);
- /* Force to set built-in clock temporally
- * TODO: remove the below line for external watch app */
- ambient_type = 0;
-
/* unload old clock */
clock_viewer_default_clock_fini(clock_viewer);
clock_viewer_widget_fini(clock_viewer);
@@ -379,7 +385,7 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
/* load new clock */
if (ambient_type == CLOCK_VIEWER_AMBIENT_TYPE_MANUAL) {
if (clock_viewer_util_pkginfo_is_widget(pkgname)) {
- clock_viewer_widget_init(clock_viewer, clock_viewer->window, pkgname);
+ clock_viewer_widget_init(clock_viewer, clock_viewer->window, pkgname, resource_id);
clock_viewer->current_type = CLOCK_VIEWER_TYPE_WIDGET;
} else {
clock_viewer->current_type = CLOCK_VIEWER_TYPE_MINICTRL;