2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
23 #include <livebox-service.h>
31 #define FLICK_COND 100
33 static Evas_Object *create_canvas(Evas_Object *parent)
37 canvas = evas_object_image_add(evas_object_evas_get(parent));
41 evas_object_image_content_hint_set(canvas, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
42 evas_object_image_colorspace_set(canvas, EVAS_COLORSPACE_ARGB8888);
43 evas_object_image_alpha_set(canvas, EINA_TRUE);
44 evas_object_move(canvas, 0, 0);
48 static int update_pd_canvas(struct livebox *handle, Evas_Object *image)
50 Evas_Native_Surface surface;
54 DbgPrint("Updated\n");
56 switch (livebox_pd_type(handle)) {
59 livebox_get_pdsize(handle, &w, &h);
63 //evas_object_image_size_set(image, w, h);
65 DbgPrint("Update: %dx%d\n", w, h);
66 surface.version = EVAS_NATIVE_SURFACE_VERSION;
67 surface.type = EVAS_NATIVE_SURFACE_X11;
68 surface.data.x11.pixmap = livebox_pd_pixmap(handle);
69 surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
70 evas_object_image_native_surface_set(image, &surface);
72 evas_object_image_data_update_add(image, 0, 0, w, h);
73 evas_object_size_hint_max_set(image, w, h);
74 evas_object_resize(image, w, h);
75 evas_object_show(image);
78 livebox_get_pdsize(handle, &w, &h);
82 data = livebox_acquire_pdfb(handle);
84 evas_object_image_data_set(image, NULL);
85 evas_object_image_colorspace_set(image, EVAS_COLORSPACE_ARGB8888);
86 evas_object_image_alpha_set(image, EINA_TRUE);
87 evas_object_image_size_set(image, w, h);
88 evas_object_image_smooth_scale_set(image, EINA_TRUE);
89 evas_object_image_data_copy_set(image, data);
90 evas_object_image_data_update_add(image, 0, 0, w, h);
91 livebox_release_pdfb(data);
93 evas_object_resize(image, w, h);
94 //evas_object_size_hint_min_set(image, w, h);
95 evas_object_size_hint_max_set(image, w, h);
106 static int update_canvas(struct livebox *handle, Evas_Object *image)
108 Evas_Native_Surface surface;
109 const char *filename;
114 DbgPrint("Updated\n");
116 switch (livebox_lb_type(handle)) {
119 type = livebox_size(handle);
120 livebox_service_get_size(type, &w, &h);
121 if (w <= 0 || h <= 0)
124 DbgPrint("Update: %dx%d\n", w, h);
126 //evas_object_image_size_set(image, w, h);
128 surface.version = EVAS_NATIVE_SURFACE_VERSION;
129 surface.type = EVAS_NATIVE_SURFACE_X11;
130 surface.data.x11.pixmap = livebox_lb_pixmap(handle);
131 surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
132 evas_object_image_native_surface_set(image, &surface);
134 evas_object_image_data_update_add(image, 0, 0, w, h);
136 evas_object_resize(image, w, h);
137 evas_object_size_hint_min_set(image, w, h);
138 evas_object_size_hint_max_set(image, w, h);
139 evas_object_show(image);
143 type = livebox_size(handle);
144 livebox_service_get_size(type, &w, &h);
145 if (w > 0 && h > 0) {
147 data = livebox_acquire_fb(handle);
149 evas_object_image_data_set(image, NULL);
150 evas_object_image_colorspace_set(image, EVAS_COLORSPACE_ARGB8888);
151 evas_object_image_alpha_set(image, EINA_TRUE);
152 evas_object_image_size_set(image, w, h);
153 evas_object_image_smooth_scale_set(image, EINA_TRUE);
154 evas_object_image_data_copy_set(image, data);
155 evas_object_image_data_update_add(image, 0, 0, w, h);
156 livebox_release_fb(data);
158 evas_object_resize(image, w, h);
159 evas_object_size_hint_min_set(image, w, h);
160 evas_object_size_hint_max_set(image, w, h);
164 filename = livebox_filename(handle);
167 evas_object_image_file_get(image, &old, NULL);
168 if (old && !strcmp(filename, old)) {
169 evas_object_image_reload(image);
171 evas_object_image_file_set(image, filename, NULL);
175 type = livebox_size(handle);
176 livebox_service_get_size(type, &w, &h);
177 if (w > 0 && h > 0) {
178 evas_object_resize(image, w, h);
179 evas_object_size_hint_min_set(image, w, h);
180 evas_object_size_hint_max_set(image, w, h);
192 static inline void prepend_log(struct livebox *handle, const char *buffer)
197 layout = livebox_get_data(handle);
199 ErrPrint("Failed to get layout\n");
203 logger = elm_object_part_content_get(layout, "logger");
205 elm_list_item_prepend(logger, buffer, NULL, NULL, NULL, NULL);
208 static int lb_event_cb(struct livebox *handle, enum livebox_event_type event, void *data)
215 layout = (Evas_Object *)livebox_get_data(handle);
220 case LB_EVENT_LB_UPDATED:
221 DbgPrint("Contents: [%s]\n", livebox_content(handle));
222 image = elm_object_part_content_get(layout, "livebox");
224 update_canvas(handle, image);
226 case LB_EVENT_PD_UPDATED:
227 image = elm_object_part_content_get(layout, "pd");
229 update_pd_canvas(handle, image);
231 case LB_EVENT_DELETED:
232 sc = evas_object_data_del(layout, "sc");
234 scroller_peek_by_obj(sc, layout);
236 evas_object_del(layout);
238 case LB_EVENT_PD_DESTROYED:
239 pd = elm_object_part_content_unset(layout, "pd");
243 sc = evas_object_data_del(layout, "sc");
254 static int lb_fault_cb(enum livebox_fault_type event,
255 const char *pkgname, const char *filename,
256 const char *funcname, void *data)
258 DbgPrint("pkgname: %s\nfilename: %s\n:funcname: %s\n", pkgname, filename, funcname);
262 static void del_cb(struct livebox *handle, int ret, void *data)
264 Evas_Object *layout = data;
267 sc = evas_object_data_del(layout, "sc");
269 DbgPrint("Scroller: %p\n", sc);
270 scroller_peek_by_obj(sc, layout);
273 DbgPrint("Delete a layout object\n");
274 evas_object_del(layout);
277 static void delete_btn_cb(void *handle, Evas_Object *obj, void *event_info)
281 layout = livebox_get_data(handle);
282 DbgPrint("Livebox Get Data %p - %p\n", handle, layout);
283 ret = livebox_del(handle, del_cb, layout);
286 snprintf(buffer, sizeof(buffer), "Delete returns: %d\n", ret);
287 prepend_log(handle, buffer);
291 static void error_popup(Evas_Object *parent, struct livebox *handle, int ret)
293 ErrPrint("Failed to add a box: %d\n", ret);
297 static void resize_cb(struct livebox *handle, int ret, void *data)
300 Evas_Object *log_list;
303 layout = livebox_get_data(handle);
307 log_list = elm_object_part_content_get(layout, "logger");
311 snprintf(buffer, sizeof(buffer) - 1, "Resize: %d", ret);
312 elm_list_item_prepend(log_list, buffer, NULL, NULL, NULL, NULL);
315 static void resize_click_cb(void *handle, Evas_Object *obj, void *event_info)
317 Elm_Object_Item *item;
323 item = elm_list_selected_item_get(obj);
327 label = elm_object_item_part_text_get(item, NULL);
331 sscanf(label, "%dx%d", &w, &h);
332 size_type = livebox_service_size_type(w, h);
334 livebox_resize(handle, size_type, resize_cb, NULL);
337 static void create_resize_controller(struct livebox *handle, Evas_Object *layout)
339 Evas_Object *size_list;
341 int sizes[NR_OF_SIZE_LIST];
347 size_list = elm_list_add(layout);
348 cnt = sizeof(sizes) / sizeof(sizes[0]);
349 livebox_get_supported_sizes(handle, &cnt, sizes);
350 for (i = 0; i < cnt; i++) {
351 livebox_service_get_size(sizes[i], &w, &h);
352 snprintf(buffer, sizeof(buffer) - 1, "%dx%d", w, h);
354 elm_list_item_append(size_list, buffer, NULL, NULL, resize_click_cb, handle);
356 evas_object_show(size_list);
357 elm_list_go(size_list);
358 evas_object_size_hint_weight_set(size_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
359 evas_object_size_hint_align_set(size_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
360 elm_object_part_content_set(layout, "controller", size_list);
363 static void create_logger(struct livebox *handle, Evas_Object *layout)
365 Evas_Object *log_list;
367 log_list = elm_list_add(layout);
371 elm_list_item_prepend(log_list, "Created", NULL, NULL, NULL, NULL);
372 evas_object_show(log_list);
373 elm_list_go(log_list);
375 evas_object_size_hint_weight_set(log_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
376 evas_object_size_hint_align_set(log_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
377 elm_object_part_content_set(layout, "logger", log_list);
385 FLICK_UNKNOWN = 0x00,
391 static void pd_closed_cb(struct livebox *handle, int ret, void *data)
393 evas_object_del(data);
396 static void pd_hide_done_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
401 sc = evas_object_data_get(obj, "sc");
404 elm_object_signal_callback_del(obj, emission, source, pd_hide_done_cb);
405 pd = elm_object_part_content_unset(obj, "pd");
406 livebox_destroy_pd(data, pd_closed_cb, pd);
409 static void pd_mouse_up_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
411 Evas_Event_Mouse_Up *up = event_info;
412 Evas_Coord x, y, w, h;
415 evas_object_geometry_get(obj, &x, &y, &w, &h);
417 rx = (double)(up->canvas.x - x) / (double)w;
418 ry = (double)(up->canvas.y - y) / (double)h;
419 DbgPrint("%dx%d - %dx%d, %lfx%lf\n", x, y, w, h, rx, ry);
420 livebox_content_event(handle, PD_MOUSE_UP, rx, ry);
423 static void pd_mouse_down_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
425 Evas_Event_Mouse_Down *down = event_info;
426 Evas_Coord x, y, w, h;
429 evas_object_geometry_get(obj, &x, &y, &w, &h);
430 rx = (double)(down->canvas.x - x) / (double)w;
431 ry = (double)(down->canvas.y - y) / (double)h;
432 DbgPrint("%dx%d - %dx%d, %lfx%lf\n", x, y, w, h, rx, ry);
433 livebox_content_event(handle, PD_MOUSE_DOWN, rx, ry);
436 static void pd_mouse_move_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
438 Evas_Event_Mouse_Move *move = event_info;
439 Evas_Coord x, y, w, h;
442 evas_object_geometry_get(obj, &x, &y, &w, &h);
443 rx = (double)(move->cur.canvas.x - x) / (double)w;
444 ry = (double)(move->cur.canvas.y - y) / (double)h;
445 DbgPrint("%dx%d - %dx%d, %lfx%lf\n", x, y, w, h, rx, ry);
446 livebox_content_event(handle, PD_MOUSE_MOVE, rx, ry);
449 static void pd_created_cb(struct livebox *handle, int ret, void *data)
452 Evas_Object *pd_image;
455 layout = (Evas_Object *)livebox_get_data(handle);
459 sc = evas_object_data_get(layout, "sc");
461 pd_image = create_canvas(layout);
465 evas_object_event_callback_add(pd_image, EVAS_CALLBACK_MOUSE_UP, pd_mouse_up_cb, handle);
466 evas_object_event_callback_add(pd_image, EVAS_CALLBACK_MOUSE_DOWN, pd_mouse_down_cb, handle);
467 evas_object_event_callback_add(pd_image, EVAS_CALLBACK_MOUSE_MOVE, pd_mouse_move_cb, handle);
469 update_pd_canvas(handle, pd_image);
471 elm_object_signal_callback_add(layout, "hide,done", "pd", pd_hide_done_cb, handle);
472 elm_object_part_content_set(layout, "pd", pd_image);
473 elm_object_signal_emit(layout, "open", "pd");
477 static void lb_mouse_up_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
479 Evas_Event_Mouse_Up *up = event_info;
480 Evas_Coord x, y, w, h;
481 struct event_data *evt;
483 evt = evas_object_data_del(obj, "evt");
487 evas_object_geometry_get(obj, &x, &y, &w, &h);
489 if (livebox_lb_type(handle) == LB_TYPE_PIXMAP || livebox_lb_type(handle) == LB_TYPE_BUFFER) {
491 rx = (double)(up->canvas.x - x) / (double)w;
492 ry = (double)(up->canvas.y - y) / (double)h;
493 livebox_content_event(handle, LB_MOUSE_UP, rx, ry);
496 if (x < up->canvas.x && up->canvas.x < x + w) {
497 if (y < up->canvas.y && up->canvas.y < y + h) {
498 livebox_click(handle, (double)x / (double)w, (double)y / (double)h);
502 if (evt->flick == FLICK_DOWN && (up->canvas.y - evt->y) > (FLICK_COND>>1)) {
505 ret = livebox_create_pd_with_position(handle, 0.5, 0.0, pd_created_cb, NULL);
511 static void lb_mouse_down_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
513 struct event_data *evt;
514 Evas_Event_Mouse_Down *down = event_info;
518 layout = livebox_get_data(handle);
522 sc = evas_object_data_get(layout, "sc");
526 if (scroller_is_scrolling(sc))
529 if (livebox_lb_type(handle) == LB_TYPE_PIXMAP || livebox_lb_type(handle) == LB_TYPE_BUFFER) {
530 Evas_Coord x, y, w, h;
533 evas_object_geometry_get(obj, &x, &y, &w, &h);
534 rx = (double)(down->canvas.x - x) / (double)w;
535 ry = (double)(down->canvas.y - y) / (double)h;
536 livebox_content_event(handle, LB_MOUSE_DOWN, rx, ry);
539 evt = evas_object_data_get(obj, "evt");
543 evt = malloc(sizeof(*evt));
545 ErrPrint("Heap: %s\n", strerror(errno));
550 evas_object_data_set(obj, "evt", evt);
552 evt->x = down->canvas.x;
553 evt->y = down->canvas.y;
554 evt->flick = FLICK_UNKNOWN;
557 static void lb_mouse_move_cb(void *handle, Evas *e, Evas_Object *obj, void *event_info)
559 Evas_Event_Mouse_Move *move = event_info;
560 struct event_data *evt;
562 evt = evas_object_data_get(obj, "evt");
566 if (livebox_lb_type(handle) == LB_TYPE_PIXMAP || livebox_lb_type(handle) == LB_TYPE_BUFFER) {
567 Evas_Coord x, y, w, h;
570 evas_object_geometry_get(obj, &x, &y, &w, &h);
571 rx = (double)(move->cur.canvas.x - x) / (double)w;
572 ry = (double)(move->cur.canvas.y - y) / (double)h;
573 livebox_content_event(handle, LB_MOUSE_MOVE, rx, ry);
576 if ((move->cur.canvas.x - move->prev.canvas.x) > FLICK_COND) {
577 evt->flick = FLICK_UNKNOWN;
579 } else if ((move->cur.canvas.x - move->prev.canvas.x) < -FLICK_COND) {
580 evt->flick = FLICK_UNKNOWN;
584 if ((move->cur.canvas.y - move->prev.canvas.y) > 0) {
585 if (evt->flick != FLICK_DOWN)
586 evt->flick = FLICK_DOWN;
587 } else if ((move->cur.canvas.y - move->prev.canvas.y) < 0) {
588 if (evt->flick != FLICK_UP)
589 evt->flick = FLICK_UP;
593 static int lb_update_begin(struct livebox *handle)
595 DbgPrint("%p\n", handle);
601 layout = (Evas_Object *)livebox_get_data(handle);
603 ErrPrint("Failed to get layout object\n");
607 list = elm_object_part_content_get(layout, "livebox");
609 ErrPrint("Failed to get list\n");
613 snprintf(buffer, sizeof(buffer), "begin");
614 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
619 static int lb_update_end(struct livebox *handle)
621 DbgPrint("%p\n", handle);
627 layout = (Evas_Object *)livebox_get_data(handle);
629 ErrPrint("Failed to get layout object\n");
633 list = elm_object_part_content_get(layout, "livebox");
635 ErrPrint("Failed to get list\n");
639 snprintf(buffer, sizeof(buffer), "end");
640 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
645 static int lb_update_text(struct livebox *handle, const char *id, const char *part, const char *data)
647 DbgPrint("%p\n", handle);
648 DbgPrint("id: [%s], part[%s], data[%s]\n", id, part, data);
654 layout = (Evas_Object *)livebox_get_data(handle);
656 ErrPrint("Failed to get layout object\n");
660 list = elm_object_part_content_get(layout, "livebox");
662 ErrPrint("Failed to get list\n");
666 snprintf(buffer, sizeof(buffer), "%s=%s", part, data);
667 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
672 static int lb_update_image(struct livebox *handle, const char *id, const char *part, const char *data)
674 DbgPrint("%p\n", handle);
675 DbgPrint("id: [%s], part[%s], data[%s]\n", id, part, data);
681 layout = (Evas_Object *)livebox_get_data(handle);
683 ErrPrint("Failed to get layout object\n");
687 list = elm_object_part_content_get(layout, "livebox");
689 ErrPrint("Failed to get list\n");
693 snprintf(buffer, sizeof(buffer), "%s=%s", part, data);
694 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
699 static int lb_update_script(struct livebox *handle, const char *id, const char *part, const char *file, const char *group)
701 DbgPrint("%p\n", handle);
702 DbgPrint("id: [%s], part[%s], file[%s], group[%s]\n", id, part, file, group);
708 layout = (Evas_Object *)livebox_get_data(handle);
710 ErrPrint("Failed to get layout object\n");
714 list = elm_object_part_content_get(layout, "livebox");
716 ErrPrint("Failed to get list\n");
720 snprintf(buffer, sizeof(buffer), "%s=%s, %s", part, file, group);
721 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
726 static int lb_update_signal(struct livebox *handle, const char *id, const char *emission, const char *signal)
728 DbgPrint("%p\n", handle);
729 DbgPrint("id: [%s], emission[%s], signal[%s]\n", id, emission, signal);
735 layout = (Evas_Object *)livebox_get_data(handle);
737 ErrPrint("Failed to get layout object\n");
741 list = elm_object_part_content_get(layout, "livebox");
743 ErrPrint("Failed to get list\n");
747 snprintf(buffer, sizeof(buffer), "%s,%s", emission, signal);
748 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
752 static int lb_update_drag(struct livebox *handle, const char *id, const char *part, double dx, double dy)
754 DbgPrint("%p\n", handle);
755 DbgPrint("id: [%s], part[%s], pos[%lfx%lf]\n", id, part, dx, dy);
761 layout = (Evas_Object *)livebox_get_data(handle);
763 ErrPrint("Failed to get layout object\n");
767 list = elm_object_part_content_get(layout, "livebox");
769 ErrPrint("Failed to get list\n");
773 snprintf(buffer, sizeof(buffer), "%s=%lfx%lf", part, dx, dy);
774 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
778 static int lb_update_info_size(struct livebox *handle, const char *id, int w, int h)
780 DbgPrint("%p\n", handle);
781 DbgPrint("id: [%s], size[%dx%d]\n", id, w, h);
787 layout = (Evas_Object *)livebox_get_data(handle);
789 ErrPrint("Failed to get layout object\n");
793 list = elm_object_part_content_get(layout, "livebox");
795 ErrPrint("Failed to get list\n");
799 snprintf(buffer, sizeof(buffer), "%dx%d", w, h);
800 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
804 static int lb_update_info_category(struct livebox *handle, const char *id, const char *category)
806 DbgPrint("%p\n", handle);
807 DbgPrint("id: [%s], category: [%s]\n", id, category);
813 layout = (Evas_Object *)livebox_get_data(handle);
815 ErrPrint("Failed to get layout object\n");
819 list = elm_object_part_content_get(layout, "livebox");
821 ErrPrint("Failed to get list\n");
825 snprintf(buffer, sizeof(buffer), "%s=%s", id, category);
826 elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
830 static void livebox_added_cb(struct livebox *handle, int ret, void *data)
839 DbgPrint("%s - %d\n", livebox_pkgname(handle), ret);
842 error_popup(main_get_window(), handle, ret);
846 layout = elm_layout_add(main_get_window());
848 ErrPrint("Failed to add a layout\n");
852 if (elm_layout_file_set(layout, PKGROOT "/res/edje/live-viewer.edj", "layout") == EINA_FALSE) {
853 DbgPrint("Failed to add a layout\n");
854 evas_object_del(layout);
858 if (livebox_lb_type(handle) == LB_TYPE_TEXT) {
860 static struct livebox_script_operators ops = {
861 .update_begin = lb_update_begin,
862 .update_end = lb_update_end,
863 .update_text = lb_update_text,
864 .update_image = lb_update_image,
865 .update_script = lb_update_script,
866 .update_signal = lb_update_signal,
867 .update_drag = lb_update_drag,
868 .update_info_size = lb_update_info_size,
869 .update_info_category = lb_update_info_category,
872 list = elm_list_add(layout);
874 evas_object_del(layout);
878 (void)livebox_set_text_handler(handle, &ops);
879 elm_object_part_content_set(layout, "livebox", list);
882 Evas_Object *lb_image;
883 lb_image = create_canvas(layout);
885 ErrPrint("Failed to create a canvas\n");
886 evas_object_del(layout);
890 evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_UP, lb_mouse_up_cb, handle);
891 evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_DOWN, lb_mouse_down_cb, handle);
892 evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_MOVE, lb_mouse_move_cb, handle);
896 type = livebox_size(handle);
897 if (type != LB_SIZE_TYPE_UNKNOWN) {
898 livebox_service_get_size(type, &w, &h);
899 DbgPrint("%dx%d\n", w, h);
901 evas_object_resize(lb_image, w, h);
902 evas_object_show(lb_image);
904 update_canvas(handle, lb_image);
906 btn = elm_button_add(main_get_window());
908 elm_object_text_set(btn, "Delete");
909 evas_object_smart_callback_add(btn, "clicked", delete_btn_cb, handle);
910 elm_object_part_content_set(layout, "delete,btn", btn);
913 elm_object_part_content_set(layout, "livebox", lb_image);
915 evas_object_resize(layout, 720, 1280);
916 evas_object_show(layout);
918 create_resize_controller(handle, layout);
919 create_logger(handle, layout);
921 livebox_set_data(handle, layout);
922 DbgPrint("Livebox Set Data: %p - %p\n", handle, layout);
923 evas_object_data_set(layout, "sc", data);
925 scroller_append(data, layout);
927 idx = scroller_get_page_index(data, layout);
928 DbgPrint("Scroll to %d\n", idx);
929 scroller_scroll_to(data, idx);
932 int lb_add(Evas_Object *sc, const char *pkgname)
935 struct livebox *handle;
937 evas_object_geometry_get(sc, NULL, NULL, &w, &h);
939 DbgPrint("sc: %dx%d, package: %s\n", w, h, pkgname);
940 livebox_activate(pkgname, NULL, NULL);
942 handle = livebox_add(pkgname, "default", "user,created", "default",
943 DEFAULT_PERIOD, livebox_added_cb, sc);
945 ErrPrint("Failed to add a new livebox\n");
954 livebox_init(ecore_x_display_get());
955 livebox_set_event_handler(lb_event_cb, NULL);
956 livebox_set_fault_handler(lb_fault_cb, NULL);