From 4d74367f70160f9ef31a6e8f1bf2769fa19fdf1f Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 27 Dec 2012 12:48:04 +0900 Subject: [PATCH] Change the type of auto-launch attribute to TEXT. To launch the app using explict package name. Change-Id: I6eecec6986af258fbac07d7653cb449cf3050a15 --- include/livebox_internal.h | 4 ++-- packaging/liblivebox-viewer.spec | 2 +- src/client.c | 6 +++--- src/livebox.c | 14 ++++++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/livebox_internal.h b/include/livebox_internal.h index d7dc0ed..a5e88d3 100644 --- a/include/livebox_internal.h +++ b/include/livebox_internal.h @@ -21,7 +21,7 @@ extern void lb_invoke_event_handler(struct livebox *handler, enum livebox_event_ extern void lb_invoke_fault_handler(enum livebox_fault_type type, const char *pkgname, const char *filename, const char *function); extern int lb_set_content(struct livebox *handler, const char *content); extern int lb_set_title(struct livebox *handler, const char *title); -extern void lb_set_auto_launch(struct livebox *handler, int auto_launch); +extern void lb_set_auto_launch(struct livebox *handler, const char *auto_launch); extern struct livebox *lb_find_livebox(const char *pkgname, const char *filename); extern struct livebox *lb_new_livebox(const char *pkgname, const char *filename, double timestamp); extern struct livebox *lb_find_livebox_by_timestamp(double timestamp); @@ -97,7 +97,7 @@ struct livebox { int height; double priority; - int auto_launch; + char *auto_launch; double period; int pinup_supported; diff --git a/packaging/liblivebox-viewer.spec b/packaging/liblivebox-viewer.spec index 52bc65b..ffa8554 100644 --- a/packaging/liblivebox-viewer.spec +++ b/packaging/liblivebox-viewer.spec @@ -1,6 +1,6 @@ Name: liblivebox-viewer Summary: Library for the development of a livebox viewer -Version: 0.8.6 +Version: 0.8.8 Release: 1 Group: main/app License: Flora License diff --git a/src/client.c b/src/client.c index e84c67b..93dceaf 100644 --- a/src/client.c +++ b/src/client.c @@ -544,7 +544,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet const char *title; double timestamp; - int auto_launch; + const char *auto_launch; double priority; int size_list; int user; @@ -558,7 +558,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet int ret; - ret = packet_get(packet, "dsssiiiissssidiiiiidsi", + ret = packet_get(packet, "dsssiiiisssssdiiiiidsi", ×tamp, &pkgname, &id, &content, &lb_w, &lb_h, &pd_w, &pd_h, @@ -574,7 +574,7 @@ static struct packet *master_created(pid_t pid, int handle, const struct packet ErrPrint("[%lf] pkgname: %s, id: %s, content: %s, " "pd_w: %d, pd_h: %d, lb_w: %d, lb_h: %d, " "cluster: %s, category: %s, lb_fname: \"%s\", pd_fname: \"%s\", " - "auto_launch: %d, priority: %lf, size_list: %d, user: %d, pinup: %d, " + "auto_launch: %s, priority: %lf, size_list: %d, user: %d, pinup: %d, " "lb_type: %d, pd_type: %d, period: %lf, title: [%s], is_pinned_up: %d\n", timestamp, pkgname, id, content, pd_w, pd_h, lb_w, lb_h, diff --git a/src/livebox.c b/src/livebox.c index 0a8774d..9ec8c4a 100644 --- a/src/livebox.c +++ b/src/livebox.c @@ -893,8 +893,8 @@ EAPI int livebox_click(struct livebox *handler, double x, double y) } if (handler->lb.auto_launch) - if (aul_launch_app(handler->pkgname, NULL) < 0) - ErrPrint("Failed to launch app %s\n", handler->pkgname); + if (aul_launch_app(handler->lb.auto_launch, NULL) < 0) + ErrPrint("Failed to launch app %s\n", handler->lb.auto_launch); timestamp = util_timestamp(); packet = packet_create_noack("clicked", "sssddd", handler->pkgname, handler->id, "clicked", timestamp, x, y); @@ -2281,9 +2281,14 @@ void lb_set_size_list(struct livebox *handler, int size_list) handler->lb.size_list = size_list; } -void lb_set_auto_launch(struct livebox *handler, int auto_launch) +void lb_set_auto_launch(struct livebox *handler, const char *auto_launch) { - handler->lb.auto_launch = auto_launch; + if (!strlen(auto_launch)) + return; + + handler->lb.auto_launch = strdup(auto_launch); + if (!handler->lb.auto_launch) + ErrPrint("Heap: %s\n", strerror(errno)); } void lb_set_priority(struct livebox *handler, double priority) @@ -2448,6 +2453,7 @@ struct livebox *lb_unref(struct livebox *handler) free(handler->id); free(handler->pkgname); free(handler->filename); + free(handler->lb.auto_launch); if (handler->lb.data.fb) { fb_destroy(handler->lb.data.fb); -- 2.7.4