0726a6f84fde102d1ec03f331a8ebab7792762f8
[apps/home/smartsearch.git] / include / smartsearch.h
1 /*
2  * Copyright 2012-2013 Samsung Electronics Co., Ltd/
3  *
4  * Licensed under the Flora License, Version 1.0 (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
7  *
8  *     http://floralicense.org/license/
9  *
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.
15  */
16
17
18
19
20
21
22 #ifndef __DEF_SMARTSEARCH_H__
23 #define __DEF_SMARTSEARCH_H__
24
25 #include <glib.h>
26 #include <time.h>
27 #include <Elementary.h>
28 #include <Ecore_X.h>
29 #include <appcore-efl.h>
30 #include <Ecore_IMF.h>
31 #include <vconf.h>
32 #include <aul.h>
33 #include <ui-gadget.h>
34 #include <malloc.h>
35 #include <sqlite3.h>
36 #include <msg_types.h>
37
38 #include "smartsearch_define.h"
39 #include "ps_debug_util.h"
40 #include "search_bar.h"
41 #include "ps_makeupviews.h"
42 #include "ps_app_interface.h"
43 #include "common_util.h"
44 #include "util-func.h"
45
46 #define _EDJ(x)    elm_layout_edje_get(x)
47
48 struct search_more_result{
49         int next_point;
50         int offset;
51         int loop_cnt;
52         int result_cnt;
53         struct appdata *ad;
54 };
55
56 struct search_content_object {
57         int order;
58         Eina_Bool visible;
59         char *name;
60         int string_type;
61         int contents_type;
62         int category_type;
63         char *def_pkg_name;
64         char *obj_icon_path;
65         Elm_Object_Item *gl_result_grp;
66         struct search_more_result mr_info;
67 };
68
69 struct search_category_info {
70         char *btn_icon_path;
71         char *btn_icon_press_path;
72         char *popup_icon_path;
73         char *popup_press_icon_path;
74 };
75
76 struct search_genlist_item_info {
77         int type;
78         struct search_content_object *obj;
79         Elm_Genlist_Item_Class *itc_style;
80         void *data;
81         Elm_Object_Item *parent;
82 };
83
84 struct search_genlist_info {
85         struct search_genlist_item_info *group;
86         GList *itemlist;
87         struct search_genlist_item_info *more;
88 };
89
90 struct search_pipe_data {
91         int cmd;
92         struct search_genlist_info *result_list;
93         int search_ret;
94         struct search_content_object *obj;
95 };
96
97 struct search_item_sel {
98         int type;
99         char *launch_path;
100         char *launch_param;
101         char *text1;
102         char *text2;
103         char *icon1;
104         char *icon2;
105 };
106
107 struct search_item_more_sel {
108         struct search_content_object *obj;
109 };
110
111 struct appdata {
112         Evas_Object *win_main;
113         Evas_Object *bg;
114         Evas_Object *conformant;
115         Evas_Object *layout_main;
116         Evas_Object *navi_bar;
117         Elm_Object_Item *navi_it;
118
119         double scale_factor;
120
121         Evas_Object *search_entry;
122         Evas_Object *search_bar;
123         Evas_Object *search_cancel_btn;
124         Evas_Object *search_gl;
125         Evas_Object *noresult_view;
126         Evas_Object *sb_layout;
127         Evas_Object *back_btn;
128
129         Evas_Object *ctxpopup;
130         Evas_Object *cate_ctxpopup;
131
132         Evas_Object *cate_btn;
133         Ecore_Idler *idler_create_ui;
134         Ecore_Timer *search_timer;
135
136         int touch_x;
137         int touch_y;
138
139         Elm_Genlist_Item_Class *itc_pslist_1line;
140         Elm_Genlist_Item_Class *itc_pslist_1line_1icon;
141         Elm_Genlist_Item_Class *itc_pslist_1line_1icon_browser_history;
142         Elm_Genlist_Item_Class *itc_pslist_1line_2icon;
143         Elm_Genlist_Item_Class *itc_pslist_2line_1icon;
144         Elm_Genlist_Item_Class *itc_pslist_2line_2icon;
145         Elm_Genlist_Item_Class *itc_pslist_2line_2icon_browser_bookmark;
146         Elm_Genlist_Item_Class *itc_grouptitle;
147         Elm_Genlist_Item_Class *itc_listmore;
148
149         Ecore_Pipe *pipe;
150         Ecore_Thread *search_thread;
151         Eina_Condition condition;
152         Eina_Lock mutex;
153
154         bool first_search;
155         char *search_word;
156         char *not_markup_search_word;
157
158         int back_btn_type;
159         int search_category;
160
161         ui_gadget_h detail_ug;
162
163         sqlite3 *search_db_hd;
164         sqlite3_stmt *search_db_sql[SEARCH_STMT_MAX];
165         struct search_content_object result_obj[SEARCH_CONT_MAX];
166         struct search_category_info category_info[SEARCH_CATE_MAX];
167
168         /* Handle List */
169         msg_handle_t msg_handle;
170 };
171
172 #endif