Fix the bug of upgrading package.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 3 Apr 2014 08:21:58 +0000 (17:21 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 4 Apr 2014 01:17:26 +0000 (10:17 +0900)
While upgrading packages, the instance's update period doesn't updated correctly.
This patch will apply the new update period.

But if the instance's update period is changed manually, (that is not same with in the XML),
the master will not touch it.

Only if the period is same with orignal value in the old XML, will be updated to the new value.

Change-Id: I4e8e9f8a104a3010b6261ab77770960463051c84

include/instance.h
packaging/data-provider-master.spec
src/instance.c
src/package.c
src/xmonitor.c

index bb5d2d7..a61c32c 100644 (file)
@@ -260,4 +260,5 @@ extern int instance_set_data(struct inst_info *inst, const char *tag, void *data
 extern void *instance_del_data(struct inst_info *inst, const char *tag);
 extern void *instance_get_data(struct inst_info *inst, const char *tag);
 
+extern void instance_reload_period(struct inst_info *inst, double period);
 /* End of a file */
index 8eca2c7..838a0bf 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.41.0
+Version: 0.41.1
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index 513c0ea..32e6b91 100644 (file)
@@ -2393,6 +2393,11 @@ static Eina_Bool timer_updator_cb(void *data)
        return ECORE_CALLBACK_CANCEL;
 }
 
+HAPI void instance_reload_period(struct inst_info *inst, double period)
+{
+       inst->lb.period = period;
+}
+
 HAPI int instance_set_period(struct inst_info *inst, double period)
 {
        struct packet *packet;
index c7377ce..30790e2 100644 (file)
@@ -1292,9 +1292,12 @@ static inline void reload_package_info(struct pkg_info *info)
        unsigned int size_type;
        int width;
        int height;
+       double old_period;
 
        DbgPrint("Already exists, try to update it\n");
 
+       old_period = info->lb.period;
+
        group_del_livebox(info->lbid);
        package_clear_fault(info);
 
@@ -1313,6 +1316,9 @@ static inline void reload_package_info(struct pkg_info *info)
                height = instance_lb_height(inst);
                size_type = livebox_service_size_type(width, height);
                if (info->lb.size_list & size_type) {
+                       if (instance_period(inst) == old_period) {
+                               instance_reload_period(inst, package_period(info));
+                       }
                        instance_reload(inst, INSTANCE_DESTROY_UPGRADE);
                } else {
                        instance_destroy(inst, INSTANCE_DESTROY_UNINSTALL);
index 6f519c1..204a22d 100644 (file)
@@ -369,7 +369,7 @@ static inline int enable_xmonitor(void)
        s_info.destroy_handler =
                ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY,
                                                        destroy_cb, NULL);
-       if (!s_info.create_handler) {
+       if (!s_info.destroy_handler) {
                ErrPrint("Failed to add destroy event handler\n");
                ecore_event_handler_del(s_info.create_handler);
                s_info.create_handler = NULL;