Modify the popup string issue
[apps/native/ug-bluetooth-efl.git] / 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.0 (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 <E_DBus.h>
39 #include <bundle.h>
40 #include <gio/gio.h>
41
42 #include "bt-type-define.h"
43 #include "bt-profile-view.h"
44
45 #ifndef UG_MODULE_API
46 #define UG_MODULE_API __attribute__ ((visibility("default")))
47 #endif
48
49 #define PKGNAME "ug-setting-bluetooth-efl"
50
51 #ifdef PREFIX
52 #undef PREFIX
53 #endif
54 #define PREFIX "/usr/ug/"
55
56 #define LOCALEDIR PREFIX"/res/locale"
57
58 #define BT_EDJ_PATH PREFIX"/res/edje/ug-setting-bluetooth-efl"
59
60 #define _EDJ(o)                 elm_layout_edje_get(o)
61 #define BT_ICON_EDJ BT_EDJ_PATH"/bluetooth_images.edj"
62 #define BT_GENLIST_EDJ BT_EDJ_PATH"/bluetooth_genlist.edj"
63
64 #ifdef _
65 #undef _
66 #endif
67 #define _(s)                    dgettext(PKGNAME, s)
68
69 #define dgettext_noop(s)        (s)
70
71 #ifdef N_
72 #undef N_
73 #endif
74 #define N_(s)                   dgettext_noop(s)
75
76 #define BT_UG_VCONF_PRINTSETTING                "memory/bluetooth/printsetting"
77
78 typedef struct {
79         /* UI gadget data */
80         ui_gadget_h ug;
81         Evas_Object *base;
82         Evas_Object *win_main;
83         Elm_Theme *theme;
84
85         bt_launch_mode_t bt_launch_mode;
86
87         /* Request timer */
88         Ecore_Timer *request_timer;
89
90         /*************************
91         *          Main View objects
92         ************************ */
93         Evas_Object *navi_bar;
94         Evas_Object *main_layout;
95         Elm_Object_Item *navi_it;
96         Elm_Object_Item *service_navi_it;
97         /* Genlist */
98         Evas_Object *main_genlist;
99
100
101         /* Paired / Searched devices */
102         Evas_Object *paired_dlggrp;
103         Evas_Object *searched_dlggrp;
104
105         /* Selected device's genlist items */
106         Elm_Object_Item *paired_item;
107         Elm_Object_Item *searched_item;
108
109         /* Help object */
110         Evas_Object *help_more_popup;
111         Evas_Object *help_popup;
112
113         /* Rename Device object*/
114         Evas_Object *rename_popup;
115         Evas_Object *rename_entry;
116         Evas_Object *rename_button;
117
118         /* Visibility object */
119         Evas_Object *visibility_popup;
120
121         /* Paired / Searched device list */
122         Eina_List *paired_device;
123         Eina_List *searched_device;
124
125         /* Network profile list */
126         Eina_List *net_profile_list;
127
128         /* Button */
129         Evas_Object *onoff_btn;
130         Evas_Object *scan_btn;
131         Evas_Object *radio_main;
132
133         /* Genlist Item class */
134         Elm_Genlist_Item_Class *device_name_itc;
135         Elm_Genlist_Item_Class *rename_entry_itc;
136         Elm_Genlist_Item_Class *rename_desc_itc;
137         Elm_Genlist_Item_Class *visible_itc;
138         Elm_Genlist_Item_Class *paired_title_itc;
139         Elm_Genlist_Item_Class *searched_title_itc;
140         Elm_Genlist_Item_Class *timeout_value_itc;
141         Elm_Genlist_Item_Class *searched_device_itc;
142         Elm_Genlist_Item_Class *no_device_itc;
143         Elm_Genlist_Item_Class *paired_device_itc;
144         Elm_Genlist_Item_Class *on_itc;
145         Elm_Genlist_Item_Class *off_itc;
146
147         /* Genlist Items */
148         Elm_Object_Item *onoff_item;
149         Elm_Object_Item *device_name_item;
150         Elm_Object_Item *visible_item;
151         Elm_Object_Item *paired_title;
152         Elm_Object_Item *searched_title;
153         Elm_Object_Item *no_device_item;
154         Elm_Object_Item *visible_exp_item[BT_MAX_TIMEOUT_ITEMS + 1];
155         Elm_Object_Item *empty_status_item;
156         Elm_Object_Item *rename_entry_item;
157
158         /*************************
159         *           Popup objects
160         ************************ */
161         Evas_Object *popup;
162         bt_popup_data popup_data;
163         Evas_Object *popup_menu;
164
165         /*************************
166         *          Status Variables
167         ************************ */
168         bool waiting_service_response;
169         bool disconn_req;
170         bool connect_req;
171         bool aul_launching_req;
172         bool aul_pairing_req;
173         bool is_discovery_started;
174         unsigned int op_status;
175         unsigned int ug_status;
176         unsigned int help_status;
177         unsigned int search_type;
178
179         /*************************
180         *          Grobal variables
181         ************************ */
182         app_control_h service;
183         bundle *popup_bundle;
184         void *handle;
185         char phone_name[BT_GLOBALIZATION_STR_LENGTH];
186         int selected_radio;
187         int remain_time;
188         time_t start_time;
189         bool visible;
190         bool visibility_changed_by_ug;
191         int timeout_id;
192         int popup_timer;
193         int visibility_timeout;
194         bt_dev_t *pick_device;
195         void *connection;
196         bool is_popup_exist;
197
198         GDBusConnection *g_conn;
199         guint gdbus_owner_id;
200
201         /* End key callback */
202         bt_app_back_cb back_cb;
203
204         Ecore_Timer *network_timer;
205         /*************************
206         *           Profile  View Data
207         ************************ */
208         bt_profile_view_data *profile_vd;
209         bt_confirm_req_t confirm_req;
210 } bt_ug_data;
211
212
213 typedef enum _bt_cfg_item_reset_type {
214         BT_CFG_ITEM_UNRESETABLE = 0,
215         BT_CFG_ITEM_RESETABLE = 1,
216 } bt_cfg_item_reset_type;
217
218 typedef enum _bt_cfg_item_type {
219         BT_CFG_ITEM_NODE_ERROR = 0,     /** Error */
220         BT_CFG_ITEM_UG_NODE = 1,                /** general UG */
221         BT_CFG_ITEM_UI_NODE = 2,                /** no UG, no app launching, just menu name */
222         BT_CFG_ITEM_TITLE_NODE = 3,     /** view name */
223         BT_CFG_ITEM_APP_NODE = 4,               /** app type - by launcher - read doc '4' */
224         BT_CFG_ITEM_VIEW_NODE = 5,              /** view name - 2depth search */
225 } bt_cfg_item_type;
226
227 typedef struct {
228         char *key_name;                         /** key name */
229         char *icon_path;                        /** icon path */
230         char *ug_args;                          /** UG path or hyperlink */
231         int pos;                                /** position : 1st, 2st -- deprecated */
232         bt_cfg_item_reset_type reset_type;      /** if ug supports Reset function */
233         int click_times;                        /** UG menu need to check */
234         bt_cfg_item_type item_type;             /** 0:item      1:header title */
235         void *data;
236 } bt_setting_cfg_node_t;
237
238 void _bt_ug_destroy(void *data, void *result);
239
240 #ifdef __cplusplus
241 }
242 #endif
243 #endif                          /* __BT_MAIN_UG_H__ */