Fix the typo error and remove edbus dependency
[apps/native/ug-bluetooth-efl.git] / common / include / bt-main-ug.h
1 /*
2 * ug-bluetooth-efl
3 *
4 * Copyright 2012 Samsung Electronics Co., Ltd
5 *
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 *           GirishAshok Joshi <girish.joshi@samsung.com>
8 *           DoHyun Pyun <dh79.pyun@samsung.com>
9 *
10 * Licensed under the Flora License, Version 1.1 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.tizenopensource.org/license
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 */
23
24 #ifndef __BT_MAIN_UG_H__
25 #define __BT_MAIN_UG_H__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <stdbool.h>
32 #include <libintl.h>
33 #include <appcore-efl.h>
34 #include <Elementary.h>
35 #include <efl_extension.h>
36 #include <ui-gadget-module.h>
37 #include <dlog.h>
38 #include <bundle.h>
39 #include <gio/gio.h>
40
41 #include "bt-type-define.h"
42 #include "bt-profile-view.h"
43
44 #ifndef UG_MODULE_API
45 #define UG_MODULE_API __attribute__ ((visibility("default")))
46 #endif
47
48 #define PKGNAME "ug-setting-bluetooth-efl"
49
50 #ifdef PREFIX
51 #undef PREFIX
52 #endif
53 #define PREFIX "/usr/ug/"
54
55 #define LOCALEDIR PREFIX"/res/locale"
56
57 #define BT_EDJ_PATH PREFIX"/res/edje/ug-setting-bluetooth-efl"
58
59 #define _EDJ(o)                 elm_layout_edje_get(o)
60 #define BT_ICON_EDJ BT_EDJ_PATH"/bluetooth_images.edj"
61 #define BT_GENLIST_EDJ BT_EDJ_PATH"/bluetooth_genlist.edj"
62
63 #ifdef _
64 #undef _
65 #endif
66 #define _(s)                    dgettext(PKGNAME, s)
67
68 #define dgettext_noop(s)        (s)
69
70 #ifdef N_
71 #undef N_
72 #endif
73 #define N_(s)                   dgettext_noop(s)
74
75 #define BT_UG_VCONF_PRINTSETTING                "memory/bluetooth/printsetting"
76
77 typedef struct {
78         /* UI gadget data */
79         ui_gadget_h ug;
80         Evas_Object *base;
81         Evas_Object *win_main;
82         Elm_Theme *theme;
83
84         bt_launch_mode_t bt_launch_mode;
85
86         /* Request timer */
87         Ecore_Timer *request_timer;
88
89         /*************************
90         *          Main View objects
91         ************************ */
92         Evas_Object *navi_bar;
93         Evas_Object *main_layout;
94         Elm_Object_Item *navi_it;
95         Elm_Object_Item *service_navi_it;
96         /* Genlist */
97         Evas_Object *main_genlist;
98
99
100         /* Paired / Searched devices */
101         Evas_Object *paired_dlggrp;
102         Evas_Object *searched_dlggrp;
103
104         /* Selected device's genlist items */
105         Elm_Object_Item *paired_item;
106         Elm_Object_Item *searched_item;
107
108         /* Help object */
109         Evas_Object *help_more_popup;
110         Evas_Object *help_popup;
111
112         /* Rename Device object*/
113         Evas_Object *rename_popup;
114         Evas_Object *rename_entry;
115         Evas_Object *rename_button;
116
117         /* Paired / Searched device list */
118         Eina_List *paired_device;
119         Eina_List *searched_device;
120
121         /* Network profile list */
122         Eina_List *net_profile_list;
123
124         /* Button */
125         Evas_Object *onoff_btn;
126         Evas_Object *scan_btn;
127
128         /* Genlist Item class */
129         Elm_Genlist_Item_Class *device_name_itc;
130         Elm_Genlist_Item_Class *rename_entry_itc;
131         Elm_Genlist_Item_Class *rename_desc_itc;
132         Elm_Genlist_Item_Class *paired_title_itc;
133         Elm_Genlist_Item_Class *searched_title_itc;
134         Elm_Genlist_Item_Class *searched_device_itc;
135         Elm_Genlist_Item_Class *no_device_itc;
136         Elm_Genlist_Item_Class *paired_device_itc;
137         Elm_Genlist_Item_Class *on_itc;
138         Elm_Genlist_Item_Class *off_itc;
139
140         /* Genlist Items */
141         Elm_Object_Item *onoff_item;
142         Elm_Object_Item *device_name_item;
143         Elm_Object_Item *paired_title;
144         Elm_Object_Item *searched_title;
145         Elm_Object_Item *no_device_item;
146         Elm_Object_Item *visible_exp_item[BT_MAX_TIMEOUT_ITEMS + 1];
147         Elm_Object_Item *empty_status_item;
148         Elm_Object_Item *rename_entry_item;
149
150         /*************************
151         *           Popup objects
152         ************************ */
153         Evas_Object *popup;
154         bt_popup_data popup_data;
155         Evas_Object *popup_menu;
156
157         /*************************
158         *          Status Variables
159         ************************ */
160         bool waiting_service_response;
161         bool disconn_req;
162         bool connect_req;
163         bool aul_launching_req;
164         bool aul_pairing_req;
165         bool is_discovery_started;
166         bool is_le_discovery_started;
167         unsigned int op_status;
168         unsigned int ug_status;
169         unsigned int help_status;
170         unsigned int search_type;
171
172         /*************************
173         *          Grobal variables
174         ************************ */
175         app_control_h service;
176         bundle *popup_bundle;
177         void *handle;
178         char phone_name[BT_GLOBALIZATION_STR_LENGTH];
179         int timeout_id;
180         int popup_timer;
181         bt_dev_t *pick_device;
182         void *connection;
183         bool is_popup_exist;
184
185         GDBusConnection *g_conn;
186         guint gdbus_owner_id;
187
188         /* End key callback */
189         bt_app_back_cb back_cb;
190
191         Ecore_Timer *timer;
192         Ecore_Timer *network_timer;
193         /*************************
194         *           Profile  View Data
195         ************************ */
196         bt_profile_view_data *profile_vd;
197         bt_confirm_req_t confirm_req;
198
199         void *dpm_handle;
200         int dpm_callback_id;
201 } bt_ug_data;
202
203
204 typedef enum _bt_cfg_item_reset_type {
205         BT_CFG_ITEM_UNRESETABLE = 0,
206         BT_CFG_ITEM_RESETABLE = 1,
207 } bt_cfg_item_reset_type;
208
209 typedef enum _bt_cfg_item_type {
210         BT_CFG_ITEM_NODE_ERROR = 0,     /** Error */
211         BT_CFG_ITEM_UG_NODE = 1,                /** general UG */
212         BT_CFG_ITEM_UI_NODE = 2,                /** no UG, no app launching, just menu name */
213         BT_CFG_ITEM_TITLE_NODE = 3,     /** view name */
214         BT_CFG_ITEM_APP_NODE = 4,               /** app type - by launcher - read doc '4' */
215         BT_CFG_ITEM_VIEW_NODE = 5,              /** view name - 2depth search */
216 } bt_cfg_item_type;
217
218 typedef struct {
219         char *key_name;                         /** key name */
220         char *icon_path;                        /** icon path */
221         char *ug_args;                          /** UG path or hyperlink */
222         int pos;                                /** position : 1st, 2st -- deprecated */
223         bt_cfg_item_reset_type reset_type;      /** if ug supports Reset function */
224         int click_times;                        /** UG menu need to check */
225         bt_cfg_item_type item_type;     /** 0:item 1:header title */
226         void *data;
227 } bt_setting_cfg_node_t;
228
229 void _bt_ug_destroy(void *data, void *result);
230
231 #ifdef __cplusplus
232 }
233 #endif
234 #endif                          /* __BT_MAIN_UG_H__ */