summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2017-08-11 10:54:53 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2017-09-21 17:38:25 +0900
commita2f7f05a70c5fc2b331786824221c44037fbf88e (patch)
tree8444698406bff300a2c097cd7e398b5070f3e31a
parentb92069e837cbd5ebc51c7b8f4c50fdf94fcedde3 (diff)
downloadappcore-widget-a2f7f05a70c5fc2b331786824221c44037fbf88e.tar.gz
appcore-widget-a2f7f05a70c5fc2b331786824221c44037fbf88e.tar.bz2
appcore-widget-a2f7f05a70c5fc2b331786824221c44037fbf88e.zip
Add a fallback about updating instance
Change-Id: Icc45d5f4fddbadd8deeb81bdd024a47543b2a09c Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com> Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
-rw-r--r--src/base/widget_base.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/base/widget_base.c b/src/base/widget_base.c
index 0cf602c..34c94f5 100644
--- a/src/base/widget_base.c
+++ b/src/base/widget_base.c
@@ -90,6 +90,7 @@ typedef struct _widget_base_instance_data {
double period;
guint periodic_timer;
bool pending_update;
+ char *pending_content;
void *user_data;
} widget_base_instance_data;
@@ -181,6 +182,7 @@ static void __instance_drop(appcore_multiwindow_base_instance_h instance_h)
data = appcore_multiwindow_base_instance_get_extra(instance_h);
appcore_multiwindow_base_instance_drop(instance_h);
+ free(data->pending_content);
free(data->content);
free(data->id);
free(data);
@@ -444,6 +446,29 @@ static void __call_update_cb(const char *class_id, const char *id, int force,
bundle_free(content);
}
+static void __update_pending_content(
+ appcore_multiwindow_base_instance_h instance_h,
+ const char *content_raw)
+{
+ widget_base_instance_data *data;
+
+ data = (widget_base_instance_data *)
+ appcore_multiwindow_base_instance_get_extra(instance_h);
+
+ if (data->pending_content) {
+ free(data->pending_content);
+ data->pending_content = NULL;
+ }
+
+ if (content_raw) {
+ data->pending_content = strdup(content_raw);
+ if (data->pending_content == NULL)
+ LOGW("Out of memory");
+ }
+
+ data->pending_update = true;
+}
+
static void __update_process(const char *class_id, const char *id,
appcore_multiwindow_base_instance_h instance_h, void *data)
{
@@ -465,7 +490,10 @@ static void __update_process(const char *class_id, const char *id,
force = 0;
bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content_raw);
- __call_update_cb(class_id, id, force, content_raw);
+ if (!appcore_multiwindow_base_instance_is_resumed(instance_h) && !force)
+ __update_pending_content(instance_h, content_raw);
+ else
+ __call_update_cb(class_id, id, force, content_raw);
}
static void __control_update(const char *class_id, const char *id, bundle *b)
@@ -505,6 +533,7 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b)
/* call stub terminate */
appcore_multiwindow_base_instance_exit(instance_h);
+ free(data->pending_content);
free(data->content);
free(data->id);
free(data);
@@ -1383,7 +1412,7 @@ static void __multiwindow_instance_resume(
if (data->pending_update) {
LOGD("pending update!");
data->pending_update = false;
- __control_update(class_id, data->id, data->args);
+ __call_update_cb(class_id, data->id, 0, data->pending_content);
if (data->period > 0) {
LOGD("Restart timer!");
data->periodic_timer = g_timeout_add_seconds(