summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaehyeon Jung <darrenh.jung@samsung.com>2016-05-31 16:39:27 +0900
committerDaehyeon Jung <darrenh.jung@samsung.com>2016-05-31 17:05:56 +0900
commit76ea01896a1249a656393df11b44068f2e068164 (patch)
treed4ec3e50fcbf0bd7e58f6175fc18e83c98904b1b
parentdb3e0a600a6ec4930a384a8809c20a09915afb08 (diff)
downloadwidget-service-accepted/tizen/ivi/20160602.022957.tar.gz
widget-service-accepted/tizen/ivi/20160602.022957.tar.bz2
widget-service-accepted/tizen/ivi/20160602.022957.zip
Change-Id: I49abaafb98879c03fc7578c38b851c84222db56c Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
-rw-r--r--src/widget_instance.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/widget_instance.c b/src/widget_instance.c
index 1dd1759..896f508 100644
--- a/src/widget_instance.c
+++ b/src/widget_instance.c
@@ -660,10 +660,22 @@ EAPI int widget_instance_terminate(const char *widget_id, const char *instance_i
{
int ret = 0;
bundle *b = NULL;
+ struct _widget_instance *instance;
if (widget_id == NULL || instance_id == NULL)
return -1;
+ instance = __pick_instance(widget_id, instance_id);
+ if (!instance) {
+ _E("illegal operation: termiante (instance not yet initialized: %s)", instance_id);
+ return -1;
+ }
+
+ if (instance->status != WIDGET_INSTANCE_RUNNING) {
+ _E("illegal operation: terminate (wrong status: %s %d)", instance_id, instance->status);
+ return -1;
+ }
+
b = bundle_create();
if (b == NULL)
return -1;
@@ -681,10 +693,22 @@ EAPI int widget_instance_destroy(const char *widget_id, const char *instance_id)
{
int ret = 0;
bundle *b = NULL;
+ struct _widget_instance *instance;
if (widget_id == NULL || instance_id == NULL)
return -1;
+ instance = __pick_instance(widget_id, instance_id);
+ if (!instance) {
+ _E("illegal operation: destroy (instance not yet initialized: %s)", instance_id);
+ return -1;
+ }
+
+ if (instance->status != WIDGET_INSTANCE_RUNNING) {
+ _E("illegal operation: destroy (wrong status: %s %d)", instance_id, instance->status);
+ return -1;
+ }
+
b = bundle_create();
if (b == NULL)
return -1;
@@ -702,10 +726,22 @@ EAPI int widget_instance_resume(const char *widget_id, const char *instance_id)
{
int ret = 0;
bundle *b = NULL;
+ struct _widget_instance *instance;
if (widget_id == NULL || instance_id == NULL)
return -1;
+ instance = __pick_instance(widget_id, instance_id);
+ if (!instance) {
+ _E("illegal operation: resume (instance not yet initialized: %s)", instance_id);
+ return -1;
+ }
+
+ if (instance->status != WIDGET_INSTANCE_RUNNING) {
+ _E("illegal operation: resume (wrong status: %s %d)", instance_id, instance->status);
+ return -1;
+ }
+
b = bundle_create();
if (b == NULL)
return -1;
@@ -723,10 +759,22 @@ EAPI int widget_instance_pause(const char *widget_id, const char *instance_id)
{
int ret = 0;
bundle *b = NULL;
+ struct _widget_instance *instance;
if (widget_id == NULL || instance_id == NULL)
return -1;
+ instance = __pick_instance(widget_id, instance_id);
+ if (!instance) {
+ _E("illegal operation: pause (instance not yet initialized: %s)", instance_id);
+ return -1;
+ }
+
+ if (instance->status != WIDGET_INSTANCE_RUNNING) {
+ _E("illegal operation: pause (wrong status: %s %d)", instance_id, instance->status);
+ return -1;
+ }
+
b = bundle_create();
if (b == NULL)
return -1;
@@ -744,10 +792,22 @@ EAPI int widget_instance_resize(const char *widget_id, const char *instance_id,
{
int ret = 0;
bundle *b = NULL;
+ struct _widget_instance *instance;
if (widget_id == NULL || instance_id == NULL)
return -1;
+ instance = __pick_instance(widget_id, instance_id);
+ if (!instance) {
+ _E("illegal operation: resize (instance not yet initialized: %s)", instance_id);
+ return -1;
+ }
+
+ if (instance->status != WIDGET_INSTANCE_RUNNING) {
+ _E("illegal operation: resize (wrong status: %s %d)", instance_id, instance->status);
+ return -1;
+ }
+
b = bundle_create();
if (b == NULL)
return -1;