Fix No result string bug
[apps/home/smartsearch.git] / src / ps_makeupviews.cpp
index a46413d..15d4581 100755 (executable)
@@ -1,12 +1,12 @@
 /*
  * Copyright 2012  Samsung Electronics Co., Ltd
- * 
+ *
  * Licensed under the Flora License, Version 1.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *     http://www.tizenopensource.org/license
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  */
 
 
-
-
-
-
 #include "smartsearch.h"
 #include "ps_searcher.h"
 #include "ps_app_interface.h"
+#include <contacts-svc.h>
+#include <calendar-svc-provider.h>
+#include <memo-db.h>
+#include <media_content.h>
+#include <msg_types.h>
+#include <msg_storage.h>
+#include <msg.h>
+
+struct search_thread_data {
+       struct appdata *ad;
+       char *keyword;
+       int is_search_result;
+};
+
+struct search_genlist_item_info* search_add_genlist_item(int type,
+               struct search_content_object *obj, Elm_Genlist_Item_Class *itc_style, void *data,
+               Elm_Object_Item *parent)
+{
+       struct search_genlist_item_info *item = (struct search_genlist_item_info *)
+                                                                                       calloc(1,
+                                                                                       sizeof(struct search_genlist_item_info));
+
+       if (item) {
+               item->type = type;
+               item->obj = obj;
+               item->itc_style = itc_style;
+               item->data = data;
+               item->parent = parent;
+       }
 
-static char *__search_get_phone_category_name(int type)
+       return item;
+}
+
+static void
+ecore_exe_pipe_cb(void *data, void *buf, unsigned int size)
 {
        SEARCH_FUNC_START;
 
-       char* name = NULL;
 
-       switch(type) {
-               
-               case SEARCH_TYPE_PHONE_CONTACTS:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_CONTACTS");
-               }
-               break;
-               case SEARCH_TYPE_PHONE_MSG:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_MESSAGES");
-               }
+       struct appdata *ad = (struct appdata *)data;
+       struct search_pipe_data *pipe_data = *((struct search_pipe_data**)buf);
+
+       struct search_content_object *obj = NULL;
+       struct search_genlist_item_info *item = NULL;
+       struct search_genlist_info *result_info = pipe_data->result_list;
+
+       int cmd = pipe_data->cmd;
+
+       SEARCH_DEBUG_LOG("Pipe Command : %d ret : %d", cmd, pipe_data->search_ret);
+
+       switch (cmd) {
+       case SEARCH_PIPE_CMD_CLEAR_GENLIST:
+               elm_genlist_clear(ad->search_gl);
                break;
-               case SEARCH_TYPE_PHONE_EMAIL:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_EMAIL");
-               }
+       case SEARCH_PIPE_CMD_SET_LAYOUT:
+               if (pipe_data->search_ret == SEARCH_RET_SEARCH_SUCCESS)
+                       search_layout_set_search_list(ad);
+               else
+                       search_layout_set_search_no_result(ad);
                break;
-               case SEARCH_TYPE_PHONE_IMAGES:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_IMAGES");
+       case SEARCH_PIPE_CMD_ADD_GENLIST_PHONE:
+               if (result_info) {
+                       if (result_info->group) {
+                               item = result_info->group;
+                               obj = item->obj;
+
+                               obj->gl_result_grp = elm_genlist_item_append(ad->search_gl,
+                                                                       item->itc_style,
+                                                                       item->data,
+                                                                       NULL,
+                                                                       ELM_GENLIST_ITEM_GROUP,
+                                                                       NULL,
+                                                                       NULL);
+                               SEARCH_FREE(item);
+                       }
+
+                       if (result_info->itemlist) {
+                               GList *node = g_list_first(result_info->itemlist);
+
+                               while (node != NULL) {
+                                       item = (struct search_genlist_item_info *)node->data;
+                                       obj = item->obj;
+                                       if (item) {
+                                               elm_genlist_item_append(ad->search_gl,
+                                                                                       item->itc_style,
+                                                                                       item->data,
+                                                                                       obj->gl_result_grp,
+                                                                                       ELM_GENLIST_ITEM_NONE,
+                                                                                       search_gl_phone_result_sel,
+                                                                                       ad);
+                                               SEARCH_FREE(item);
+                                       }
+                                       node = g_list_next(node);
+                               }
+                               g_list_free(result_info->itemlist);
+                               result_info->itemlist = NULL;
+                       }
+
+                       if (result_info->more) {
+                               item = result_info->more;
+                               obj = item->obj;
+                               elm_genlist_item_append(ad->search_gl,
+                                                               item->itc_style,
+                                                               item->data,
+                                                               obj->gl_result_grp,
+                                                               ELM_GENLIST_ITEM_NONE,
+                                                               search_gl_result_more_item_append_cb,
+                                                               ad);
+                               SEARCH_FREE(item);
+                       }
+
+                       SEARCH_FREE(result_info);
                }
                break;
-               case SEARCH_TYPE_PHONE_MUSIC:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_MUSIC");
                }
-               break;
-               case SEARCH_TYPE_PHONE_VIDEO:
+
+       SEARCH_FREE(pipe_data);
+       SEARCH_FUNC_END;
+}
+
+static Evas_Object *__search_gl_content_get_search_item_type(void *data, Evas_Object *obj, const char *part)
                {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_VIDEOS");
+       Evas_Object *icon = NULL;
+       int icon_size = 0;
+
+       struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+
+       if (!SEARCH_STRCMP(part, "elm.icon") || !SEARCH_STRCMP(part, "elm.icon.1")) {
+               if (strlen(sel_mem_info->icon1_path) > 0 ) {
+                       icon = elm_icon_add(obj);
+                       icon_size = (int)(SEARCH_THUMBNAIL_SIZE * elm_scale_get());
+                       elm_icon_prescale_set(icon, icon_size);
+                       elm_icon_file_set(icon, sel_mem_info->icon1_path, NULL);
+                       evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
                }
-               break;
-               case SEARCH_TYPE_PHONE_CALENDAR:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_CALENDAR");
+       } else if(!strcmp(part, "elm.icon.2")) {
+               if (strlen(sel_mem_info->icon2_path) > 0 ) {
+                       icon = elm_icon_add(obj);
+                       icon_size = (int)(SEARCH_ICON_SIZE * elm_scale_get());
+                       elm_icon_prescale_set(icon, icon_size);
+                       elm_icon_file_set(icon, sel_mem_info->icon2_path, NULL);
+                       evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
                }
-               break;
-               case SEARCH_TYPE_PHONE_MEMO:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_MEMO");
                }
-               break;
-               case SEARCH_TYPE_PHONE_MENU:
-               {
-                       name  = dgettext("sys_string", "IDS_COM_BODY_APPLICATIONS");
+       return icon;
                }
-               break;
-       }
-
-       return name;
-}
-
 
 static Eina_Bool __search_gl_state_get(void *data, Evas_Object * obj,
                                       const char *part)
@@ -88,7 +171,7 @@ static Eina_Bool __search_gl_state_get(void *data, Evas_Object * obj,
        return EINA_FALSE;
 }
 
-static char *__search_gl_label_get(void *data, Evas_Object * obj,
+static char *__search_gl_label_get_search_item_type(void *data, Evas_Object * obj,
                                   const char *part)
 {
        if (data == NULL) {
@@ -97,7 +180,7 @@ static char *__search_gl_label_get(void *data, Evas_Object * obj,
 
        char *buf;
        struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+
        if (!SEARCH_STRCMP(part, "elm.text") || !SEARCH_STRCMP(part, "elm.text.1")) {
                buf = g_strdup(sel_mem_info->main_buf);
        } else if (!SEARCH_STRCMP(part, "elm.text.sub") || !SEARCH_STRCMP(part, "elm.text.2")) {
@@ -105,24 +188,32 @@ static char *__search_gl_label_get(void *data, Evas_Object * obj,
        } else {
                buf = NULL;
        }
+
        return buf;
 }
 
-static char *__search_gl_label_get_title(void *data, Evas_Object * obj,
+static char *__search_gl_label_get_normal_type(void *data, Evas_Object * obj,
                                         const char *part)
 {
-       SEARCH_FUNC_START;
-
-       char* category_name = NULL;
-
-       struct search_item_sel *sel_mem = (struct search_item_sel *)data;
+       char *title_string = (char*)data;
+       if(title_string)
+               return strdup(dgettext("sys_string", title_string));
+       else
+               return strdup("");
+}
 
-       category_name = __search_get_phone_category_name(sel_mem->type);
+static char *__search_gl_label_get_group(void *data, Evas_Object * obj,
+                                        const char *part)
+{
+       struct search_content_object *object = (struct search_content_object*)data;
+       SEARCH_DEBUG_WARNING("%s %d", object->name, object->string_type);
+       if (object) {
+               if (object->string_type == SEARCH_STR_TYPE_APP_STRING)
+                       return strdup(gettext(object->name));
+               else
+                       return strdup(dgettext("sys_string", object->name));
+       }
 
-       if(category_name)
-               return strdup(category_name);
-       else
                return strdup("");
 }
 
@@ -132,10 +223,16 @@ static char *__search_gl_label_get_more(void *data, Evas_Object * obj,
        return strdup(gettext("IDS_SSEARCH_BODY_MORE_RESULTS"));
 }
 
-static void __search_gl_del(void *data, Evas_Object * obj)
+static void __search_gl_del_grouptitle(void *data, Evas_Object * obj)
 {
        SEARCH_FUNC_START;
 
+       SEARCH_FUNC_END;
+       return;
+}
+
+static void __search_gl_del(void *data, Evas_Object * obj)
+{
        struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
 
        SEARCH_FREE(sel_mem_info);
@@ -143,6 +240,217 @@ static void __search_gl_del(void *data, Evas_Object * obj)
        return;
 }
 
+static void __search_gl_del_more_button(void *data, Evas_Object * obj)
+{
+       struct search_item_more_sel *sel_mem_more = (struct search_item_more_sel *)data;
+
+       SEARCH_FREE(sel_mem_more);
+
+       return;
+}
+
+int search_app_connect(void *data)
+{
+       SEARCH_FUNC_START;
+
+       struct appdata *ad = (struct appdata *)data;
+
+       int rc = 0, conn_ret = 0;
+       int ret = SEARCH_RET_SUCCESS;
+       int i = 0;
+
+       for (i = 0; i < SEARCH_CONT_MAX ; ++i) {
+               switch (ad->result_obj[i].contents_type) {
+                       case SEARCH_CONT_PHONE_CONTACTS:
+                               {
+                                       if (ad->result_obj[i].visible == EINA_TRUE) {
+                                               rc = contacts_svc_connect();
+                                               if (rc != CTS_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
+                                               }
+                                       } else {
+                                               rc = contacts_svc_disconnect();
+                                               if (rc != CTS_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING("contacts svc disconnect fail : %d",rc);
+                                               }
+                                       }
+                               }
+                               break;
+
+                       /* Contact-service should be conneted for display Message result.
+                          Because We should display message with contact photo
+                          if user have contact photo which have matched to tel-number of sender or receiver */
+                       case SEARCH_CONT_PHONE_MSG:
+                               {
+                                       msg_error_t err = MSG_SUCCESS;
+
+                                       if (ad->result_obj[i].visible == EINA_TRUE) {
+
+                                               /* Connect Contact-service if contact category status is invisible */
+                                               if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
+                                                       rc = contacts_svc_connect();
+                                                       if (rc != CTS_SUCCESS) {
+                                                               /* If we fail to connect contact-service, display message-app icon */
+                                                               SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
+                                                       }
+                                               }
+
+                                               /* Connect Message-Service */
+                                               err = msg_open_msg_handle(&ad->msg_handle);
+
+                                               if (err != MSG_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING("msg_open_msg_handle error : %d", err);
+                                                       ad->msg_handle = NULL;
+                                               }
+                                       } else {
+                                               /* Disconnect Contact-service if contact category status is invisible */
+                                               if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
+                                                       rc = contacts_svc_disconnect();
+                                                       if (rc != CTS_SUCCESS)
+                                                               SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
+                                               }
+
+                                               /* Disconnect Message-Service */
+                                               if (ad->msg_handle != NULL ) {
+                                                       err = msg_close_msg_handle(&ad->msg_handle);
+
+                                                       if (err != MSG_SUCCESS)
+                                                               SEARCH_DEBUG_WARNING("msg_close_msg_handle error : %d", err);
+                                                       ad->msg_handle = NULL;
+                                               }
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_EMAIL:
+                               break;
+                       /* IMAGE, MUSIC, VIDEO use common handle */
+                       case SEARCH_CONT_PHONE_IMAGES:
+                       case SEARCH_CONT_PHONE_MUSIC:
+                       case SEARCH_CONT_PHONE_VIDEO:
+                               {
+                                       if (ad->result_obj[SEARCH_CONT_PHONE_IMAGES].visible == EINA_TRUE
+                                               || ad->result_obj[SEARCH_CONT_PHONE_MUSIC].visible == EINA_TRUE
+                                               || ad->result_obj[SEARCH_CONT_PHONE_VIDEO].visible == EINA_TRUE ) {
+                                               conn_ret = media_content_connect();
+
+                                               if (conn_ret != 0)
+                                                       SEARCH_DEBUG_WARNING("media_content_connect failed : %d\n", conn_ret);
+                                       } else {
+                                                       conn_ret = media_content_disconnect();
+
+                                                       if(conn_ret < 0)
+                                                               SEARCH_DEBUG_WARNING("media_content_disconnect failed : %d\n", conn_ret);
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_CALENDAR:
+                               {
+                                       if (ad->result_obj[i].visible == EINA_TRUE) {
+                                               rc = calendar_svc_connect();
+                                               if (rc != CAL_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING
+                                                           ("calendar svc connect fail : %d",
+                                                            rc);
+                                               }
+                                       } else {
+                                               rc = calendar_svc_close();
+                                               if (rc != CAL_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING
+                                                           ("calendar svc disconnect fail : %d",
+                                                            rc);
+                                               }
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_MEMO:
+                               {
+                                       if (ad->result_obj[i].visible == EINA_TRUE) {
+                                               rc = memo_init(NULL);
+                                               if (rc == -1) {
+                                                       SEARCH_DEBUG_WARNING
+                                                           ("memo svc connect fail : %d", rc);
+                                               }
+                                       } else
+                                               memo_fini();
+                               }
+                               break;
+                       }
+       }
+
+       SEARCH_FUNC_END;
+
+       return ret;
+}
+
+int search_app_disconnect(void *data)
+{
+       SEARCH_FUNC_START;
+
+       struct appdata *ad = (struct appdata *)data;
+
+       int rc = 0, conn_ret = 0;
+       int i = 0;
+
+       for (i = 0; i < SEARCH_CONT_MAX ; ++i) {
+               switch (ad->result_obj[i].contents_type) {
+                       case SEARCH_CONT_PHONE_CONTACTS:
+                               {
+                                       rc = contacts_svc_disconnect();
+                                       if (rc != CTS_SUCCESS) {
+                                               SEARCH_DEBUG_WARNING
+                                                   ("contacts svc disconnect fail : %d",
+                                                    rc);
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_MSG:
+                               {
+                                       if (ad->msg_handle != NULL ) {
+                                               msg_error_t err = MSG_SUCCESS;
+                                               err = msg_close_msg_handle(&ad->msg_handle);
+
+                                               if (err != MSG_SUCCESS) {
+                                                       SEARCH_DEBUG_WARNING("msg_close_msg_handle error : %d", err);
+                                               }
+
+                                               ad->msg_handle = NULL;
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_EMAIL:
+                               break;
+                       case SEARCH_CONT_PHONE_IMAGES:
+                       case SEARCH_CONT_PHONE_MUSIC:
+                       case SEARCH_CONT_PHONE_VIDEO:
+                               {
+                                       conn_ret = media_content_disconnect();
+                                       if(conn_ret != 0)
+                                               SEARCH_DEBUG_WARNING("media_content_disconnect failed : %d\n", conn_ret);
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_CALENDAR:
+                               {
+                                       rc = calendar_svc_close();
+                                       if (rc != CAL_SUCCESS) {
+                                               SEARCH_DEBUG_WARNING
+                                                   ("calendar svc disconnect fail : %d",
+                                                    rc);
+                                       }
+                               }
+                               break;
+                       case SEARCH_CONT_PHONE_MEMO:
+                               {
+                                       memo_fini();
+                               }
+                               break;
+               }
+       }
+
+       SEARCH_FUNC_END;
+
+       return 0;
+}
+
 void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info)
 {
        SEARCH_FUNC_START;
@@ -150,7 +458,6 @@ void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info)
        struct appdata *ad = (struct appdata *)data;
        struct search_item_sel *cur_category_mem;
        Elm_Object_Item *it = (Elm_Object_Item *) event_info;
-       int ret = 0;
 
        cur_category_mem =
            (struct search_item_sel *)elm_object_item_data_get(it);
@@ -158,44 +465,48 @@ void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info)
                return;
        }
 
-       switch (cur_category_mem->type) {
+       SEARCH_DEBUG_LOG("cur_category_mem->type : %d", cur_category_mem->type);
 
-       case SEARCH_TYPE_PHONE_CONTACTS:
+       switch (cur_category_mem->type) {
+       case SEARCH_CONT_PHONE_CONTACTS:
                search_launch_contact_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_MSG:
+       case SEARCH_CONT_PHONE_MSG:
                search_launch_msg_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_EMAIL:
+       case SEARCH_CONT_PHONE_EMAIL:
                search_launch_email_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_IMAGES:
+       case SEARCH_CONT_PHONE_IMAGES:
                search_launch_image_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_VIDEO:
+       case SEARCH_CONT_PHONE_VIDEO:
                search_launch_video_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_MUSIC:
+       case SEARCH_CONT_PHONE_MUSIC:
                search_launch_music_view(ad, cur_category_mem);
                break;
-               
-       case SEARCH_TYPE_PHONE_CALENDAR:
+
+       case SEARCH_CONT_PHONE_CALENDAR:
                search_launch_calendar_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_MEMO:
+       case SEARCH_CONT_PHONE_MEMO:
                search_launch_memo_view(ad, cur_category_mem);
                break;
 
-       case SEARCH_TYPE_PHONE_MENU:
+       case SEARCH_CONT_PHONE_MENU:
                search_launch_menu_view(ad, cur_category_mem);
                break;
 
+       case SEARCH_CONT_PHONE_BROWSER:
+               search_launch_browser_view(ad, cur_category_mem);
+
        default:
                break;
        }
@@ -205,326 +516,521 @@ void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info)
        SEARCH_FUNC_END;
 }
 
-void search_result_gl_init(void *data)
-{
-       SEARCH_FUNC_START;
-
-       struct appdata *ad = (struct appdata *)data;
-       Evas_Object *genlist;
-
-
-       if (ad->itc_pslist_1line == NULL) {
-               ad->itc_pslist_1line = elm_genlist_item_class_new();
-               ad->itc_pslist_1line->item_style = "1text.2";
-               ad->itc_pslist_1line->func.text_get = __search_gl_label_get;
-               ad->itc_pslist_1line->func.content_get = NULL;
-               ad->itc_pslist_1line->func.state_get = __search_gl_state_get;
-               ad->itc_pslist_1line->func.del = __search_gl_del;
-       }
-
-
-       if (ad->itc_pslist_2line == NULL) {
-               ad->itc_pslist_2line = elm_genlist_item_class_new();
-               ad->itc_pslist_2line->item_style = "2text.8";
-               ad->itc_pslist_2line->func.text_get = __search_gl_label_get;
-               ad->itc_pslist_2line->func.content_get = NULL;
-               ad->itc_pslist_2line->func.state_get = __search_gl_state_get;
-               ad->itc_pslist_2line->func.del = __search_gl_del;
-       }
-
-       if (ad->itc_grouptitle == NULL) {
-               ad->itc_grouptitle = elm_genlist_item_class_new();
-               ad->itc_grouptitle->item_style = "grouptitle";
-               ad->itc_grouptitle->func.text_get = __search_gl_label_get_title;
-               ad->itc_grouptitle->func.state_get = __search_gl_state_get;
-               ad->itc_grouptitle->func.del = __search_gl_del;
-       }
-
-       if (ad->itc_listmore == NULL) {
-               ad->itc_listmore = elm_genlist_item_class_new();
-               ad->itc_listmore->item_style = "1text.2";
-               ad->itc_listmore->func.text_get = __search_gl_label_get_more;
-               ad->itc_listmore->func.state_get = __search_gl_state_get;
-               ad->itc_listmore->func.del = __search_gl_del;
-       }
-
-       ad->search_gl = NULL;
-
-       genlist = elm_genlist_add(ad->navi_bar);
-
-       // To use multiline textblock/entry/editfield in genlist, set height_for_width mode
-       // then the item's height is calculated while the item's width fits to genlist width.
-       elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
-       elm_genlist_tree_effect_enabled_set(genlist, EINA_TRUE);
-
-       ad->search_gl = genlist;
-
-       evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND,
-                                        EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL,
-                                       EVAS_HINT_FILL);
-       SEARCH_FUNC_END;
-}
-
-void search_result_gl_deinit(void *data)
+static int __search_gl_set_phone_search_result(struct search_content_object *obj,
+                                                                                                       int offset,
+                                                                                                       char *keyword,
+                                                                                                       void *data,
+                                                                                                       struct search_genlist_info *result_info)
 {
        SEARCH_FUNC_START;
 
-       struct appdata *ad = (struct appdata *)data;
-
-       if (ad->itc_pslist_1line != NULL)
-               elm_genlist_item_class_free(ad->itc_pslist_1line);
-
-       if (ad->itc_pslist_2line != NULL)
-               elm_genlist_item_class_free(ad->itc_pslist_2line);
-
-       if (ad->itc_grouptitle != NULL)
-               elm_genlist_item_class_free(ad->itc_grouptitle);
-
-       if (ad->itc_listmore != NULL)
-               elm_genlist_item_class_free(ad->itc_listmore);
-
-       SEARCH_FUNC_END;
-}
-
-static int __search_gl_set_phone_search_result(int type, int offset, char *keyword,
-                                              void *data)
-{
-       SEARCH_FUNC_START;
-
-       int rc = 0;
-       int category = 0;
-       int loop_cnt = 0;
-
-       int ret = 0;
-
        int sel_cnt = SEARCH_CATEGORY_LIST_MORE_CNT + 1;
-       int func_ret = 1;
+       int func_ret = SEARCH_RET_SEARCH_NONE;
 
        struct appdata *ad = (struct appdata *)data;
-       Evas_Object *glist;
 
-       ad->cate_info[type].offset = offset;
+       obj->mr_info.offset = offset;
 
-       if (offset == 0) {
-               ad->cate_info[type].next_point = 0;
+       if (obj->mr_info.offset == 0) {
+               obj->mr_info.next_point = 0;
        }
 
-       switch (type) {
-               
-       case SEARCH_TYPE_PHONE_CONTACTS:
+       SEARCH_DEBUG_LOG("offset : %d, limit : %d keyword : %s", offset, sel_cnt, keyword);
+
+       if (obj->visible == EINA_TRUE ) {
+               switch (obj->contents_type) {
+                       case SEARCH_CONT_PHONE_CONTACTS:
                {
                        func_ret =
-                           search_sql_contact_search_result_by_api(type,
+                                           search_sql_contact_search_result_by_api(obj,
                                                                    offset,
                                                                    sel_cnt,
-                                                                   data);
+                                                           keyword,
+                                                           ad,
+                                                           result_info);
                }
                break;
 
-       case SEARCH_TYPE_PHONE_MSG:
+                       case SEARCH_CONT_PHONE_MSG:
                {
                        if (ad->msg_handle != NULL) {
                        func_ret =
-                           search_sql_msg_search_result_by_api(type, 
+                                                   search_sql_msg_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
+                                                                       sel_cnt,
+                                                           keyword,
+                                                           ad,
+                                                           result_info);
                }
                }
                break;
 
-       case SEARCH_TYPE_PHONE_EMAIL:
+                       case SEARCH_CONT_PHONE_EMAIL:
                {
                        func_ret =
-                           search_sql_email_search_result_by_api(type, 
+                                           search_sql_email_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
+                                                                       sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
-               break;          
-       case SEARCH_TYPE_PHONE_IMAGES:
+               break;
+                       case SEARCH_CONT_PHONE_IMAGES:
                {
-                       if (ad->media_handle != NULL ) {
                        func_ret =
-                           search_sql_image_search_result_by_api(type, 
+                                           search_sql_image_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
+                                                                       sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
+                       break;
+                       case SEARCH_CONT_PHONE_MUSIC:
+                       {
+                                       func_ret =
+                                           search_sql_music_search_result_by_api(obj,
+                                               offset,
+                                                   sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
-               break;                  
-       case SEARCH_TYPE_PHONE_MUSIC:
+               break;
+                       case SEARCH_CONT_PHONE_VIDEO:
                {
-                       if (ad->media_handle != NULL ) {
                        func_ret =
-                           search_sql_music_search_result_by_api(type, 
+                                           search_sql_video_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
-               }
+                                                                       sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
                break;
-       case SEARCH_TYPE_PHONE_VIDEO:
+                       case SEARCH_CONT_PHONE_CALENDAR:
                {
-                       if (ad->media_handle != NULL ) {
                        func_ret =
-                           search_sql_video_search_result_by_api(type, 
+                                           search_sql_calendar_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
+                                                                       sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
-               }
-               break;          
-       
-       case SEARCH_TYPE_PHONE_CALENDAR:
+               break;
+                       case SEARCH_CONT_PHONE_MEMO:
                {
                        func_ret =
-                           search_sql_calendar_search_result_by_api(type,
+                                           search_sql_memo_search_result_by_api(obj,
                                                                        offset,
                                                                        sel_cnt,
-                                                                       data);
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
                break;
-
-       case SEARCH_TYPE_PHONE_MEMO:
+                       case SEARCH_CONT_PHONE_MENU:
                {
                        func_ret =
-                           search_sql_memo_search_result_by_api(type, 
+                                           search_sql_menu_search_result_by_api(obj,
                                                                offset,
-                                                                       sel_cnt, 
-                                                                       data);
+                                                                       sel_cnt,
+                                                   keyword,
+                                                   ad,
+                                                   result_info);
                }
                break;
-
-       case SEARCH_TYPE_PHONE_MENU:
+                       case SEARCH_CONT_PHONE_BROWSER:
                {
                        func_ret =
-                           search_sql_menu_search_result_by_api(type,
+                                               search_sql_browser_search_result_by_api(obj,
                                                                        offset,
                                                                        sel_cnt,
                                                                        keyword,
-                                                                       data);
+                                                   ad,
+                                                   result_info);
                }
-               break;
+       }
        }
 
        SEARCH_FUNC_END;
-
        return func_ret;
 }
 
-void search_gl_result_more_item_append_cb(void *data, Evas_Object * obj,
-                                         void *event_info)
+static void __search_thread_heavy_cb(void *data, Ecore_Thread *th)
 {
        SEARCH_FUNC_START;
 
-       struct appdata *ad = (struct appdata *)data;
-       Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+       struct search_thread_data *thread_data = (struct search_thread_data*)data;
+       struct appdata *ad = thread_data->ad;
+       struct search_content_object *obj = NULL;
+       struct search_genlist_info *result_info = NULL;
 
        int ret = 0;
 
-       struct search_item_sel *sel_mem =
-           (search_item_sel *) elm_object_item_data_get(it);
-       struct search_item_sel *sel_mem_info = NULL;
-       struct search_item_sel *sel_mem_more = NULL;
+       int i = SEARCH_CONT_PHONE_MIN;
+       int category_type = 0;
 
-       char* escape_added_keyword = NULL;
-       SEARCH_MALLOC(escape_added_keyword, strlen(ad->search_word)*2+5, char);
-       memset(escape_added_keyword, 0x0, strlen(ad->search_word)*2+5);
+       SEARCH_DEBUG_LOG("Thread ID : %p Keyword : %s", th, thread_data->keyword);
 
-       int rc = 0, i = 0;
-       int type = sel_mem->type;
-       int offset = ad->cate_info[type].next_point;
+       thread_data->ad = ad;
+       thread_data->is_search_result = SEARCH_RET_SEARCH_NONE;
 
-       search_sql_make_keyword_bind_value(ad->search_word, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+       while (i <= SEARCH_CONT_PHONE_MAX) {
+               int offset = 0;
+               obj = &ad->result_obj[i];
+               category_type = obj->category_type;
 
-       elm_object_item_del(it);
+               if (category_type == SEARCH_OBJ_PHONE_CONTENTS) {
+                       if (ecore_thread_check(th) != EINA_TRUE) {
+                               result_info = (struct search_genlist_info *)calloc(1, sizeof(struct search_genlist_info));
+                               ret = __search_gl_set_phone_search_result(obj,
+                                                               offset,
+                                                               thread_data->keyword,
+                                                               ad,
+                                                               result_info);
+
+                               if (ret == SEARCH_RET_SEARCH_SUCCESS) {
+                                       SEARCH_DEBUG_LOG("Succes to Matched result : %s %d", obj->name, ret);
+                                       thread_data->is_search_result = SEARCH_RET_SEARCH_SUCCESS;
+                                       ecore_thread_feedback(th, result_info);
+                               } else {
+                                       SEARCH_FREE(result_info);
+                               }
+                       }
+               }
+               i++;
+       }
+       SEARCH_FUNC_END;
+}
 
-       __search_gl_set_phone_search_result(type, offset, escape_added_keyword, ad);
+
+static void __search_thread_feedback_cb(void *data, Ecore_Thread *th, void *msg_data)
+{
+       SEARCH_FUNC_START;
+
+       struct search_thread_data *thread_data = (struct search_thread_data *)data;
+       struct appdata *ad = thread_data->ad;
+       struct search_genlist_info *result_list = (struct search_genlist_info *)msg_data;
+       struct search_pipe_data *pdata = NULL;
+
+       pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
+       pdata->cmd = SEARCH_PIPE_CMD_ADD_GENLIST_PHONE;
+       pdata->obj = NULL;
+       pdata->result_list = result_list;
+       pdata->search_ret = thread_data->is_search_result;
+
+       if (ecore_thread_check(th) == EINA_TRUE)
+               return;
+
+       ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
 
        SEARCH_FUNC_END;
 }
 
-static int __search_set_phone_result_list(struct appdata *ad, bool is_input_keyword, const char* search_keyword)
+static void __search_thread_end_cb(void *data, Ecore_Thread *th)
 {
        SEARCH_FUNC_START;
 
-       int i = 0, is_search_result = 0, ret = 0;
+       struct search_thread_data *thread_data = (struct search_thread_data *)data;
+       struct appdata *ad = thread_data->ad;
+       struct search_pipe_data *pdata = NULL;
 
-       if (is_input_keyword == false) { 
-               return SEARCH_RET_SEARCH_NONE;
-       } else {
+       pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
+       pdata->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
+       pdata->search_ret = thread_data->is_search_result;
 
-               int offset = 0;
+       if (ecore_thread_check(th) == EINA_TRUE)
+               return;
 
-               while (i < PHONE_CATEGORY_LIST_CNT) {
-                       ret = __search_gl_set_phone_search_result(i,
-                                                               offset,
-                                                               (char*)search_keyword,
-                                                               ad);
-                       if (ret == SEARCH_RET_SEARCH_SUCCESS) {
-                               is_search_result = 1;
-                       }
+       ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
 
-                       i++;
-               }
+       SEARCH_FREE(thread_data->keyword);
+       SEARCH_FREE(thread_data);
 
-               if(is_search_result == 0) { 
-                       return SEARCH_RET_SEARCH_NONE;
-               } else {
-                       return SEARCH_RET_SEARCH_SUCCESS;
-               }
-       }
+       SEARCH_FUNC_END;
 }
 
-Eina_Bool search_set_result_list(void *data)
+static void __search_thread_cancel_cb(void *data, Ecore_Thread *th)
+{
+       SEARCH_FUNC_START;
+
+       struct search_thread_data *thread_data = (struct search_thread_data *)data;
+
+       SEARCH_FREE(thread_data->keyword);
+       SEARCH_FREE(thread_data);
+
+       SEARCH_FUNC_END;
+}
+
+void search_stop_search(void *data)
 {
        SEARCH_FUNC_START;
 
        struct appdata *ad = (struct appdata *)data;
-       char *text;
+
+       if (ad->search_thread) {
+               ecore_thread_cancel(ad->search_thread);
+               ad->search_thread = NULL;
+       }
+
+       if (ad->search_timer) {
+               ecore_timer_del(ad->search_timer);
+               ad->search_timer = NULL;
+       }
+
+       SEARCH_FUNC_END;
+}
+
+Ecore_Thread* search_make_result_thread(void *data)
+{
+       SEARCH_FUNC_START;
+
        int ret = 0;
+       Ecore_Thread *th = NULL;
+       struct appdata *ad = (struct appdata *)data;
+       struct search_thread_data *thread_data = NULL;
+
+       /* set keyword to vconf for save last search histroy */
+       ret = vconf_set_str(SMARTSEARCH_KEY_KEYWORD, ad->not_markup_search_word);
+
+       if (ret < 0)
+       SEARCH_DEBUG_WARNING("Error : set keyword to vconf");
+
+       /* Create Thread for Phone Search */
+       thread_data = (struct search_thread_data *)calloc(1, sizeof(struct search_thread_data));
+       thread_data->ad = ad;
+       thread_data->is_search_result = SEARCH_RET_SEARCH_NONE;
+       thread_data->keyword = strdup(ad->search_word);
+
+       th = ecore_thread_feedback_run(__search_thread_heavy_cb,
+                               __search_thread_feedback_cb,
+                               __search_thread_end_cb,
+                               __search_thread_cancel_cb,
+                               thread_data,
+                               EINA_TRUE);
+
+       SEARCH_FUNC_END;
+       return th;
+}
+
+
+void search_result_gl_init(void *data)
+{
+       SEARCH_FUNC_START;
+
+       struct appdata *ad = (struct appdata *)data;
+
+       ad->pipe = ecore_pipe_add(ecore_exe_pipe_cb, ad);
+       eina_lock_new(&ad->mutex);
+       eina_condition_new(&ad->condition, &ad->mutex);
+
+       Evas_Object *genlist;
+
+       if (ad->itc_pslist_1line == NULL) {
+               ad->itc_pslist_1line = elm_genlist_item_class_new();
+               ad->itc_pslist_1line->item_style = "1text.2";
+               ad->itc_pslist_1line->func.text_get = __search_gl_label_get_search_item_type;
+               ad->itc_pslist_1line->func.content_get = __search_gl_content_get_search_item_type;
+               ad->itc_pslist_1line->func.state_get = __search_gl_state_get;
+               ad->itc_pslist_1line->func.del = __search_gl_del;
+       }
+
+       if (ad->itc_pslist_1line_1icon == NULL) {
+               ad->itc_pslist_1line_1icon = elm_genlist_item_class_new();
+               ad->itc_pslist_1line_1icon->item_style = "1text.1icon.2.tb";
+               ad->itc_pslist_1line_1icon->func.text_get = __search_gl_label_get_search_item_type;
+               ad->itc_pslist_1line_1icon->func.content_get = __search_gl_content_get_search_item_type;
+               ad->itc_pslist_1line_1icon->func.state_get = __search_gl_state_get;
+               ad->itc_pslist_1line_1icon->func.del = __search_gl_del;
+       }
+
+       if (ad->itc_pslist_1line_2icon == NULL) {
+               ad->itc_pslist_1line_2icon = elm_genlist_item_class_new();
+               ad->itc_pslist_1line_2icon->item_style = "1text.2icon.6.tb";
+               ad->itc_pslist_1line_2icon->func.text_get = __search_gl_label_get_search_item_type;
+               ad->itc_pslist_1line_2icon->func.content_get = __search_gl_content_get_search_item_type;
+               ad->itc_pslist_1line_2icon->func.state_get = __search_gl_state_get;
+               ad->itc_pslist_1line_2icon->func.del = __search_gl_del;
+       }
+
+       if (ad->itc_pslist_2line_1icon == NULL) {
+               ad->itc_pslist_2line_1icon = elm_genlist_item_class_new();
+               ad->itc_pslist_2line_1icon->item_style = "2text.1icon.4.tb";
+               ad->itc_pslist_2line_1icon->func.text_get = __search_gl_label_get_search_item_type;
+               ad->itc_pslist_2line_1icon->func.content_get = __search_gl_content_get_search_item_type;
+               ad->itc_pslist_2line_1icon->func.state_get = __search_gl_state_get;
+               ad->itc_pslist_2line_1icon->func.del = __search_gl_del;
+       }
+
+       if (ad->itc_pslist_2line_2icon == NULL) {
+               ad->itc_pslist_2line_2icon = elm_genlist_item_class_new();
+               ad->itc_pslist_2line_2icon->item_style = "2text.2icon.4.tb";
+               ad->itc_pslist_2line_2icon->func.text_get = __search_gl_label_get_search_item_type;
+               ad->itc_pslist_2line_2icon->func.content_get = __search_gl_content_get_search_item_type;
+               ad->itc_pslist_2line_2icon->func.state_get = __search_gl_state_get;
+               ad->itc_pslist_2line_2icon->func.del = __search_gl_del;
+       }
+
+       if (ad->itc_grouptitle == NULL) {
+               ad->itc_grouptitle = elm_genlist_item_class_new();
+               ad->itc_grouptitle->item_style = "grouptitle";
+               ad->itc_grouptitle->func.text_get = __search_gl_label_get_group;
+               ad->itc_grouptitle->func.state_get = __search_gl_state_get;
+               ad->itc_grouptitle->func.del = __search_gl_del_grouptitle;
+       }
+
+       if (ad->itc_label == NULL) {
+               ad->itc_label = elm_genlist_item_class_new();
+               ad->itc_label->item_style = "grouptitle";
+               ad->itc_label->func.text_get = __search_gl_label_get_normal_type;
+               ad->itc_label->func.state_get = __search_gl_state_get;
+               ad->itc_label->func.del = __search_gl_del_grouptitle;
+                       }
+
+       if (ad->itc_listmore == NULL) {
+               ad->itc_listmore = elm_genlist_item_class_new();
+               ad->itc_listmore->item_style = "1text.2";
+               ad->itc_listmore->func.text_get = __search_gl_label_get_more;
+               ad->itc_listmore->func.state_get = __search_gl_state_get;
+               ad->itc_listmore->func.del = __search_gl_del_more_button;
+       }
+
+       ad->search_gl = NULL;
+
+       genlist = elm_genlist_add(ad->navi_bar);
+
+       // To use multiline textblock/entry/editfield in genlist, set height_for_width mode
+       // then the item's height is calculated while the item's width fits to genlist width.
+       elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+       elm_genlist_tree_effect_enabled_set(genlist, EINA_TRUE);
+
+       ad->search_gl = genlist;
+
+       evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL,
+                                       EVAS_HINT_FILL);
+       SEARCH_FUNC_END;
+}
+
+void search_result_gl_deinit(void *data)
+{
+       SEARCH_FUNC_START;
+
+       struct appdata *ad = (struct appdata *)data;
+
+       ecore_pipe_del(ad->pipe);
+       eina_condition_free(&ad->condition);
+       eina_lock_free(&ad->mutex);
+
+       if (ad->itc_pslist_1line != NULL)
+               elm_genlist_item_class_free(ad->itc_pslist_1line);
+
+       if (ad->itc_pslist_1line_1icon != NULL)
+               elm_genlist_item_class_free(ad->itc_pslist_1line_1icon);
+
+       if (ad->itc_pslist_1line_2icon != NULL)
+               elm_genlist_item_class_free(ad->itc_pslist_2line_1icon);
+
+       if (ad->itc_pslist_2line_1icon != NULL)
+               elm_genlist_item_class_free(ad->itc_pslist_2line_1icon);
+
+       if (ad->itc_pslist_2line_2icon != NULL)
+               elm_genlist_item_class_free(ad->itc_pslist_2line_2icon);
+
+       if (ad->itc_grouptitle != NULL)
+               elm_genlist_item_class_free(ad->itc_grouptitle);
+
+       if (ad->itc_label != NULL)
+               elm_genlist_item_class_free(ad->itc_label);
+
+       if (ad->itc_listmore != NULL)
+               elm_genlist_item_class_free(ad->itc_listmore);
+
+       SEARCH_FUNC_END;
+}
+
+
+void search_gl_result_more_item_append_cb(void *data, Evas_Object * obj,
+                                         void *event_info)
+{
+       SEARCH_FUNC_START;
+
+       struct appdata *ad = (struct appdata *)data;
+       Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+       struct search_pipe_data *pdata = NULL;
+       struct search_genlist_info *result_info = NULL;
+       struct search_item_more_sel *sel_more =
+           (search_item_more_sel *)elm_object_item_data_get(it);
+
+       struct search_content_object *content_obj = sel_more->obj;
+       int offset = content_obj->mr_info.next_point;
+       int ret = SEARCH_RET_SEARCH_NONE;
+
+       elm_object_item_del(it);
+
+       result_info = (struct search_genlist_info *)calloc(1, sizeof(struct search_genlist_info));
+       ret = __search_gl_set_phone_search_result(content_obj,
+                                               offset,
+                                               ad->search_word,
+                                               ad,
+                                               result_info);
+
+       pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
+       pdata->cmd = SEARCH_PIPE_CMD_ADD_GENLIST_PHONE;
+       pdata->obj = NULL;
+       pdata->result_list = result_info;
+       pdata->search_ret = ret;
+       ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+       pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
+       pdata->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
+       pdata->search_ret = ret;
+       ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+       SEARCH_FUNC_END;
+}
+
+void search_set_result_list(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       int category = ad->search_category;
+
        bool is_input_keyword = false;
-       char* escape_added_keyword = NULL;
-       int bind_type = 0;
-       int search_ret = SEARCH_RET_SEARCH_NONE;
+       struct search_pipe_data *pipe_data = NULL;
+       char *text = NULL;
 
-       SEARCH_ASSERT_IF(!ad);
+       search_stop_search(ad);
 
        text = elm_entry_markup_to_utf8(elm_object_text_get(ad->search_entry));
-
        SEARCH_FREE(ad->not_markup_search_word);
        SEARCH_FREE(ad->search_word);
 
        if((text) && (strlen(text) > 0)) {
                ad->not_markup_search_word = strdup(elm_object_text_get(ad->search_entry));
                ad->search_word = text;
-
-               SEARCH_MALLOC(escape_added_keyword, strlen(ad->search_word)*2+5, char);
-               memset(escape_added_keyword, 0x0, strlen(ad->search_word)*2+5);
-
-               bind_type = SEARCH_SQL_BIND_TYPE_DUPLEX;
-               
-               search_sql_make_keyword_bind_value(ad->search_word, escape_added_keyword, bind_type);
                is_input_keyword = true;
-
-               elm_genlist_clear(ad->search_gl);
-
-               search_ret = __search_set_phone_result_list(ad, is_input_keyword, ad->search_word);
+       } else if ( category == SEARCH_CATE_PHONE) {
+               pipe_data = (struct search_pipe_data *)calloc(1, sizeof(struct search_pipe_data));
+               pipe_data->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
+               pipe_data->search_ret = SEARCH_RET_SEARCH_NONE;
+               ecore_pipe_write(ad->pipe, &pipe_data, sizeof(struct search_pipe_data));
+               return;
        }
 
-       if(search_ret == SEARCH_RET_SEARCH_SUCCESS) {
-               search_layout_set_search_list(ad);
-       } else {
-               search_layout_set_search_no_result(ad);
-       }
-       
-       SEARCH_FREE(escape_added_keyword);
-       
-       SEARCH_FUNC_END;
+       /* If category is Phone, make a thread for search */
+       pipe_data = (struct search_pipe_data *)calloc(1, sizeof(struct search_pipe_data));
+       pipe_data->cmd = SEARCH_PIPE_CMD_CLEAR_GENLIST;
+       ecore_pipe_write(ad->pipe, &pipe_data, sizeof(struct search_pipe_data));
 
-       return EINA_FALSE;
+       switch(category) {
+       case SEARCH_CATE_PHONE:
+               ad->search_thread = search_make_result_thread(ad);
+               break;
+       }
 }
 
 void search_layout_set_search_list(void* data)
@@ -533,14 +1039,17 @@ void search_layout_set_search_list(void* data)
 
        struct appdata *ad = (struct appdata *)data;
 
-       if (elm_object_part_content_get(ad->sb_layout,"list_noresult")) {
-               elm_object_part_content_unset(ad->sb_layout,"list_noresult");
+       if (elm_object_part_content_get(ad->result_layout,"list_noresult")) {
+               elm_object_part_content_unset(ad->result_layout,"list_noresult");
                evas_object_hide(ad->noresult_view);
 
-               elm_object_part_content_set(ad->sb_layout, "list", ad->search_gl);
+               if (ad->search_gl) {
+                       elm_object_part_content_set(ad->result_layout, "list", ad->search_gl);
                evas_object_show(ad->search_gl);
        }
+       }
 
+       if (ad->search_gl)
        elm_genlist_item_show(elm_genlist_first_item_get(ad->search_gl), ELM_GENLIST_ITEM_SCROLLTO_TOP);
        SEARCH_FUNC_END;
 
@@ -553,11 +1062,13 @@ void search_layout_set_search_no_result(void* data)
 
        struct appdata *ad = (struct appdata *)data;
 
-       if (elm_object_part_content_get(ad->sb_layout,"list")) {
-               elm_object_part_content_unset(ad->sb_layout, "list");
+       if (elm_object_part_content_get(ad->result_layout, "list")) {
+               elm_object_part_content_unset(ad->result_layout, "list");
+
+               if (ad->search_gl)
                evas_object_hide(ad->search_gl);
 
-               elm_object_part_content_set(ad->sb_layout,"list_noresult", ad->noresult_view);
+               elm_object_part_content_set(ad->result_layout,"list_noresult", ad->noresult_view);
                evas_object_show(ad->noresult_view);
        }
 
@@ -573,7 +1084,7 @@ int search_layout_get_content_list_set_status(void* data)
        struct appdata *ad = (struct appdata *)data;
        int ret;
 
-       if (elm_object_part_content_get(ad->sb_layout,"list")) {
+       if (elm_object_part_content_get(ad->result_layout, "list")) {
                ret = SEARCH_RET_SUCCESS;
        } else {
                ret = SEARCH_RET_FAIL;
@@ -583,5 +1094,5 @@ int search_layout_get_content_list_set_status(void* data)
 
        return ret;
 }
-       
+