Trigger update for all instances if its "id" is not specified. submit/tizen/20150602.021205
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 1 Jun 2015 08:54:38 +0000 (17:54 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 1 Jun 2015 08:54:38 +0000 (17:54 +0900)
Change-Id: I171b1cc519b94aea4a532d198c7fcf99ac3b7d9c

widget_provider_app/src/client.c

index 4da650d..b118c23 100644 (file)
@@ -572,7 +572,29 @@ static int method_update_content(struct widget_event_arg *arg, void *data)
                return WIDGET_ERROR_NOT_SUPPORTED;
        }
 
-       ret = table->update(widget_util_uri_to_path(arg->id), arg->info.update_content.content, arg->info.update_content.force, table->data);
+       if (!arg->id) {
+               /**
+                * Burst Update required. Every instances should be updated for this package.
+                * Find the instance list of given package and then trigger each instance's update_content event callback
+                */
+               Eina_List *l;
+               struct item *inst;
+               int cnt = 0;
+
+               DbgPrint("Burst update is triggerd for [%s]\n", arg->pkgname);
+
+               EINA_LIST_FOREACH(s_info.inst_list, l, inst) {
+                       ret = table->update(widget_util_uri_to_path(inst->id), arg->info.update_content.content, arg->info.update_content.force, table->data);
+                       DbgPrint("UpdateContent[%s] returns 0x%X\n", widget_util_uri_to_path(inst->id), ret);
+                       cnt++;
+               }
+
+               DbgPrint("%d instnaces update function is triggered\n", cnt);
+               ret = cnt > 0 ? WIDGET_ERROR_NONE : WIDGET_ERROR_NOT_EXIST; /** override ret in this case */
+       } else {
+               ret = table->update(widget_util_uri_to_path(arg->id), arg->info.update_content.content, arg->info.update_content.force, table->data);
+       }
+
        return ret;
 }