Askuser-popup for mobile profile
[profile/mobile/apps/native/askuser-popup.git] / common / include / common_utils.h
1 /**
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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  * @file        common_utils.h
18  * @author      Yunjin Lee (yunjin-.lee@samsung.com)
19  * @version     1.0
20  * @brief
21  */
22
23 #ifndef __UI_PRIVACY_SETTING_COMMON_UTILS_H_
24 #define __UI_PRIVACY_SETTING_COMMON_UTILS_H_
25
26 #include <Elementary.h>
27 #include <glib.h>
28 #include <app.h>
29 #include <dlog.h>
30 #include <app_control_internal.h>
31
32
33
34 #ifdef _cplusplus
35 extern "C" {
36 #endif
37
38 #define return_if(condition, expr, returnValue, ...) \
39         if (condition) { \
40                 LOGE(__VA_ARGS__); \
41                 expr; \
42                 return returnValue; \
43         }
44
45 #define lreturn_if(condition, expr, returnValue, ...) \
46         if (condition) { \
47                 LOGD(__VA_ARGS__); \
48                 expr; \
49                 return returnValue; \
50         }
51
52 #define log_if(condition, level, ...) \
53         if (condition) { \
54                 if (level) { \
55                         LOGE(__VA_ARGS__); \
56                 } else { \
57                         LOGD(__VA_ARGS__); \
58                 } \
59         }
60
61 typedef struct {
62         char* privacy;
63         bool user_responsed;
64         char* response;
65 } privacy_data_s;
66
67 typedef struct _app_data_s {
68         Evas_Object *win;
69         Evas_Object *conform;
70         Evas_Object *layout;
71         Evas_Object *nf;
72         Evas_Object *popup;
73         Evas_Object *checkbox;
74         Evas_Object *btn_l;
75         Evas_Object *btn_r;
76         Evas_Object *label;
77
78         app_control_h caller;
79         char* caller_pkgid;
80
81         bool all_responded;
82         char* launch_type;
83
84         GList* privacy_list;
85         int privacy_num;
86         int privacy_idx;
87 } app_data_s;
88
89 privacy_data_s* new_privacy_data();
90
91 //void init_app_data(app_data_s *ad);
92 void free_app_data(app_data_s *ad);
93
94 #ifdef _cplusplus
95 }
96 #endif
97
98 #endif /* __UI_PRIVACY_SETTING_COMMON_UTILS_H_ */