Add alternative icon & name for the instance
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 18 Dec 2013 04:09:17 +0000 (13:09 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 18 Dec 2013 04:09:17 +0000 (13:09 +0900)
Change-Id: I03b27485895584ccc48f98d0fc59c4f686fe8897

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

index b9b8674..47ae61e 100644 (file)
@@ -155,6 +155,7 @@ extern int instance_need_slave(struct inst_info *inst);
 extern void instance_set_lb_info(struct inst_info *inst, double priority, const char *content, const char *title);
 extern void instance_set_lb_size(struct inst_info *inst, int w, int h);
 extern void instance_set_pd_size(struct inst_info *inst, int w, int h);
+extern void instance_set_alt_info(struct inst_info *inst, const char *icon, const char *name);
 
 extern int instance_set_pinup(struct inst_info *inst, int pinup);
 extern int instance_resize(struct inst_info *inst, int w, int h);
index 1e5349b..7196eed 100755 (executable)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.29.1
+Version: 0.30.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index 265d931..d11840b 100644 (file)
@@ -109,6 +109,9 @@ struct inst_info {
        int scroll_locked; /*!< Scroller which is in viewer is locked. */
        int active_update; /*!< Viewer will reload the buffer by itself, so the provider doesn't need to send the updated event */
 
+       char *icon;
+       char *name;
+
        enum livebox_visible_state visible;
 
        struct {
@@ -685,6 +688,8 @@ static inline void destroy_instance(struct inst_info *inst)
        EINA_LIST_FREE(inst->delete_event_list, item) {
                DbgFree(item);
        }
+       DbgFree(inst->icon);
+       DbgFree(inst->name);
        DbgFree(inst->category);
        DbgFree(inst->cluster);
        DbgFree(inst->content);
@@ -1761,6 +1766,8 @@ HAPI void instance_lb_updated_by_instance(struct inst_info *inst, const char *sa
        enum lb_type lb_type;
        const char *title;
        const char *content;
+       const char *icon;
+       const char *name;
 
        if (inst->client && inst->visible != LB_SHOW) {
                if (inst->visible == LB_HIDE) {
@@ -1791,9 +1798,21 @@ HAPI void instance_lb_updated_by_instance(struct inst_info *inst, const char *sa
                title = "";
        }
 
-       packet = packet_create_noack("lb_updated", "sssiidsss",
+       if (inst->icon) {
+               icon = inst->icon;
+       } else {
+               icon = "";
+       }
+
+       if (inst->name) {
+               name = inst->name;
+       } else {
+               name = "";
+       }
+
+       packet = packet_create_noack("lb_updated", "sssiidsssss",
                        package_name(inst->info), inst->id, id,
-                       inst->lb.width, inst->lb.height, inst->lb.priority, content, title, safe_file);
+                       inst->lb.width, inst->lb.height, inst->lb.priority, content, title, safe_file, icon, name);
        if (!packet) {
                ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
                return;
@@ -1965,6 +1984,36 @@ HAPI void instance_set_lb_info(struct inst_info *inst, double priority, const ch
        }
 }
 
+HAPI void instance_set_alt_info(struct inst_info *inst, const char *icon, const char *name)
+{
+       char *_icon = NULL;
+       char *_name = NULL;
+
+       if (icon && strlen(icon)) {
+               _icon = strdup(icon);
+               if (!_icon) {
+                       ErrPrint("Heap: %s\n", strerror(errno));
+               }
+       }
+
+       if (name && strlen(name)) {
+               _name = strdup(name);
+               if (!_name) {
+                       ErrPrint("Heap: %s\n", strerror(errno));
+               }
+       }
+
+       if (_icon) {
+               DbgFree(inst->icon);
+               inst->icon = _icon;
+       }
+
+       if (_name) {
+               DbgFree(inst->name);
+               inst->name = _name;
+       }
+}
+
 HAPI void instance_set_lb_size(struct inst_info *inst, int w, int h)
 {
        if (inst->lb.width != w || inst->lb.height != h) {
index e9a4bf9..ab0d40b 100644 (file)
@@ -6658,6 +6658,8 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
        const char *id;
        const char *content_info;
        const char *title;
+       const char *icon;
+       const char *name;
        int w;
        int h;
        double priority;
@@ -6670,11 +6672,11 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
                goto out;
        }
 
-       ret = packet_get(packet, "ssiidsss", &pkgname, &id,
+       ret = packet_get(packet, "ssiidsssss", &pkgname, &id,
                                                &w, &h, &priority,
                                                &content_info, &title,
-                                               &safe_filename);
-       if (ret != 8) {
+                                               &safe_filename, &icon, &name);
+       if (ret != 10) {
                ErrPrint("Parameter is not matched\n");
                goto out;
        }
@@ -6687,6 +6689,7 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
                }
 
                instance_set_lb_info(inst, priority, content_info, title);
+               instance_set_alt_info(inst, icon, name);
 
                switch (package_lb_type(instance_package(inst))) {
                case LB_TYPE_SCRIPT: