summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoon87.park <moon87.park@samsung.com>2016-12-02 14:03:53 +0900
committermoon87.park <moon87.park@samsung.com>2016-12-02 14:03:53 +0900
commit3c1a3b69e845adff0bfe3000db136ab47b73ba41 (patch)
tree9af0f6e29a640538c71feb050e3e9e44587285a7
parent4c5097d5c48a603ea1e5f25ec64b94d524e0668b (diff)
downloadw-clock-viewer-3c1a3b69e845adff0bfe3000db136ab47b73ba41.tar.gz
w-clock-viewer-3c1a3b69e845adff0bfe3000db136ab47b73ba41.tar.bz2
w-clock-viewer-3c1a3b69e845adff0bfe3000db136ab47b73ba41.zip
[Clock viewer] Set the clock object using clock's resource idsubmit/tizen_3.0/20161206.080517accepted/tizen/3.0/wearable/20161207.012106
Change-Id: I54e70a90f2882a9e1569af32b59c455c73b1b1df
-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.c9
5 files changed, 23 insertions, 4 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 1550354..24f365d 100644
--- a/clock-viewer/src/clock-viewer.c
+++ b/clock-viewer/src/clock-viewer.c
@@ -351,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) {
@@ -358,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);
@@ -378,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;