Change the LOG_TAG
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 2 Jan 2013 07:03:40 +0000 (16:03 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 2 Jan 2013 07:03:40 +0000 (16:03 +0900)
Change-Id: Ic4e860de0b0d950695534de8111b9d2f3365528d

CMakeLists.txt
live.viewer/src/lb.c
live.viewer/src/main.c
packaging/liblivebox-viewer.spec

index 2fcc8c9..006c861 100644 (file)
@@ -36,7 +36,7 @@ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -g"
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-ADD_DEFINITIONS("-DLOG_TAG=\"${PROJECT_NAME}\"")
+ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX_VIEWER\"")
 ADD_DEFINITIONS("-DNDEBUG")
 #ADD_DEFINITIONS("-DFLOG")
 ADD_DEFINITIONS("-DMASTER_PKGNAME=\"org.tizen.data-provider-master\"")
index 313aca2..dfd31d2 100644 (file)
@@ -566,10 +566,246 @@ static void lb_mouse_move_cb(void *handle, Evas *e, Evas_Object *obj, void *even
        }
 }
 
+static int lb_update_begin(struct livebox *handle)
+{
+       DbgPrint("%p\n", handle);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "begin");
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+
+       return 0;
+}
+
+static int lb_update_end(struct livebox *handle)
+{
+       DbgPrint("%p\n", handle);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "end");
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+
+       return 0;
+}
+
+static int lb_update_text(struct livebox *handle, const char *id, const char *part, const char *data)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], part[%s], data[%s]\n", id, part, data);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s=%s", part, data);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+
+       return 0;
+}
+
+static int lb_update_image(struct livebox *handle, const char *id, const char *part, const char *data)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], part[%s], data[%s]\n", id, part, data);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s=%s", part, data);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+
+       return 0;
+}
+
+static int lb_update_script(struct livebox *handle, const char *id, const char *part, const char *file, const char *group)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], part[%s], file[%s], group[%s]\n", id, part, file, group);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s=%s, %s", part, file, group);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+
+       return 0;
+}
+
+static int lb_update_signal(struct livebox *handle, const char *id, const char *emission, const char *signal)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], emission[%s], signal[%s]\n", id, emission, signal);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s,%s", emission, signal);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+       return 0;
+}
+
+static int lb_update_drag(struct livebox *handle, const char *id, const char *part, double dx, double dy)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], part[%s], pos[%lfx%lf]\n", id, part, dx, dy);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s=%lfx%lf", part, dx, dy);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+       return 0;
+}
+
+static int lb_update_info_size(struct livebox *handle, const char *id, int w, int h)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], size[%dx%d]\n", id, w, h);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%dx%d", w, h);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+       return 0;
+}
+
+static int lb_update_info_category(struct livebox *handle, const char *id, const char *category)
+{
+       DbgPrint("%p\n", handle);
+       DbgPrint("id: [%s], category: [%s]\n", id, category);
+
+       Evas_Object *layout;
+       Evas_Object *list;
+       char buffer[80];
+
+       layout = (Evas_Object *)livebox_get_data(handle);
+       if (!layout) {
+               ErrPrint("Failed to get layout object\n");
+               return 0;
+       }
+
+       list = elm_object_part_content_get(layout, "livebox");
+       if (!list) {
+               ErrPrint("Failed to get list\n");
+               return 0;
+       }
+
+       snprintf(buffer, sizeof(buffer), "%s=%s", id, category);
+       elm_list_item_prepend(list, buffer, NULL, NULL, NULL, NULL);
+       return 0;
+}
+
 static void livebox_added_cb(struct livebox *handle, int ret, void *data)
 {
        Evas_Object *layout;
-       Evas_Object *lb_image;
        Evas_Object *btn;
        int w;
        int h;
@@ -595,37 +831,63 @@ static void livebox_added_cb(struct livebox *handle, int ret, void *data)
                return;
        }
 
-       lb_image = create_canvas(layout);
-       if (!lb_image) {
-               ErrPrint("Failed to create a canvas\n");
-               evas_object_del(layout);
-               return;
-       }
+       if (livebox_lb_type(handle) == LB_TYPE_TEXT) {
+               Evas_Object *list;
+               static struct livebox_script_operators ops = {
+                       .update_begin = lb_update_begin,
+                       .update_end = lb_update_end,
+                       .update_text = lb_update_text,
+                       .update_image = lb_update_image,
+                       .update_script = lb_update_script,
+                       .update_signal = lb_update_signal,
+                       .update_drag = lb_update_drag,
+                       .update_info_size = lb_update_info_size,
+                       .update_info_category = lb_update_info_category,
+               };
+
+               list = elm_list_add(layout);
+               if (!list) {
+                       evas_object_del(layout);
+                       return;
+               }
 
-       evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_UP, lb_mouse_up_cb, handle);
-       evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_DOWN, lb_mouse_down_cb, handle);
-       evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_MOVE, lb_mouse_move_cb, handle);
+               (void)livebox_set_text_handler(handle, &ops);
+               elm_object_part_content_set(layout, "livebox", list);
+               elm_list_go(list);
+       } else {
+               Evas_Object *lb_image;
+               lb_image = create_canvas(layout);
+               if (!lb_image) {
+                       ErrPrint("Failed to create a canvas\n");
+                       evas_object_del(layout);
+                       return;
+               }
 
-       w = 0;
-       h = 0;
-       type = livebox_size(handle);
-       if (type != LB_SIZE_TYPE_UNKNOWN) {
-               livebox_service_get_size(type, &w, &h);
-               DbgPrint("%dx%d\n", w, h);
-       }
-       evas_object_resize(lb_image, w, h);
-       evas_object_show(lb_image);
+               evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_UP, lb_mouse_up_cb, handle);
+               evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_DOWN, lb_mouse_down_cb, handle);
+               evas_object_event_callback_add(lb_image, EVAS_CALLBACK_MOUSE_MOVE, lb_mouse_move_cb, handle);
+
+               w = 0;
+               h = 0;
+               type = livebox_size(handle);
+               if (type != LB_SIZE_TYPE_UNKNOWN) {
+                       livebox_service_get_size(type, &w, &h);
+                       DbgPrint("%dx%d\n", w, h);
+               }
+               evas_object_resize(lb_image, w, h);
+               evas_object_show(lb_image);
 
-       update_canvas(handle, lb_image);
+               update_canvas(handle, lb_image);
 
-       btn = elm_button_add(main_get_window());
-       if (btn) {
-               elm_object_text_set(btn, "Delete");
-               evas_object_smart_callback_add(btn, "clicked", delete_btn_cb, handle);
-               elm_object_part_content_set(layout, "delete,btn", btn);
-       }
+               btn = elm_button_add(main_get_window());
+               if (btn) {
+                       elm_object_text_set(btn, "Delete");
+                       evas_object_smart_callback_add(btn, "clicked", delete_btn_cb, handle);
+                       elm_object_part_content_set(layout, "delete,btn", btn);
+               }
 
-       elm_object_part_content_set(layout, "livebox", lb_image);
+               elm_object_part_content_set(layout, "livebox", lb_image);
+       }
        evas_object_resize(layout, 720, 1280);
        evas_object_show(layout);
 
index 49577bc..362cf3f 100644 (file)
@@ -87,20 +87,24 @@ static inline void livebox_list_create(void)
        Evas_Object *list;
 
        list = elm_list_add(s_info.window);
-       evas_object_resize(list, 720, 1000);
+       if (!list) {
+               ErrPrint("Failed to create a list\n");
+               return;
+       }
+
+       evas_object_resize(list, 720, 1280);
        evas_object_show(list);
 
        DbgPrint("Get Package list\n");
        livebox_service_get_pkglist(append_livebox_cb, list);
-       scroller_append(s_info.scroller, list);
        elm_list_go(list);
+
+       scroller_append(s_info.scroller, list);
 }
 
 static bool app_create(void *data)
 {
        Evas_Object *bg;
-       Evas_Object *conformant;
-       Evas_Object *box;
        DbgPrint("create");
        lb_init();
 
@@ -111,20 +115,14 @@ static bool app_create(void *data)
        }
        elm_win_autodel_set(s_info.window, EINA_TRUE);
 
-       bg = elm_bg_add(s_info.window);
-       evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(s_info.window, bg);
-       evas_object_show(bg);
-
        evas_object_resize(s_info.window, 720, 1280);
        evas_object_show(s_info.window);
 
-       conformant = elm_conformant_add(s_info.window);
-       evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(s_info.window, conformant);
-       evas_object_show(conformant);
+       bg = elm_bg_add(s_info.window);
+       elm_win_resize_object_add(s_info.window, bg);
+       elm_bg_color_set(bg, 0, 0, 255);
+       evas_object_show(bg);
 
-       box = elm_box_add(s_info.window);
        s_info.scroller = scroller_create(s_info.window);
        if (!s_info.scroller) {
                evas_object_del(s_info.window);
@@ -132,18 +130,11 @@ static bool app_create(void *data)
                ErrPrint("Failed to create a scroller\n");
                return false;
        }
-       livebox_list_create();
-       evas_object_size_hint_min_set(s_info.scroller, 720, 1000);
-       evas_object_resize(s_info.scroller, 720, 1000);
-       evas_object_show(s_info.scroller);
 
-       elm_box_pack_end(box, s_info.scroller);
-       evas_object_size_hint_min_set(box, 720, 1000);
-       evas_object_resize(box, 720, 1000);
-       evas_object_show(box);
+       evas_object_resize(s_info.scroller, 720, 1280);
+       evas_object_show(s_info.scroller);
 
-       elm_object_content_set(conformant, box);
-       elm_win_indicator_mode_set(s_info.window, ELM_WIN_INDICATOR_SHOW);
+       livebox_list_create();
 
        return true;
 }
index ffa8554..eb8a6ee 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-viewer
 Summary: Library for the development of a livebox viewer
-Version: 0.8.8
+Version: 0.8.9
 Release: 1
 Group: main/app
 License: Flora License