1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
/*
* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* PROPRIETARY/CONFIDENTIAL
*
* This software is the confidential and proprietary information of
* SAMSUNG ELECTRONICS ("Confidential Information").
* You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement
* you entered into with SAMSUNG ELECTRONICS.
* SAMSUNG make no representations or warranties about the suitability
* of the software, either express or implied, including but not
* limited to the implied warranties of merchantability, fitness for
* a particular purpose, or non-infringement.
* SAMSUNG shall not be liable for any damages suffered by licensee as
* a result of using, modifying or distributing this software or its derivatives.
*/
#include <vconf.h>
#include <account_internal.h>
#include "my-account-main.h"
#include "my-account-view.h"
#include "my-account-debug.h"
#include "my-account-util.h"
#include "my-account-ui-widget.h"
static void __back_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
appdata *ad = data;
MA_DEBUG_ERR("back click cb : view depth is %d", ad->current_view);
elm_naviframe_item_pop(ad->navi_frame);
if (ad->current_view == VIEW_MAIN) {
/* release Main view and exit application */
ui_app_exit();
} else if (ad->current_view == VIEW_ADD_ACCOUNTS) {
ad->current_view = VIEW_MAIN;
ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
}
}
void _myaccount_init(appdata *ad)
{
ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
ad->account_list = NULL;
ad->account_app_list = NULL;
}
bool _create_gui(appdata *ad)
{
/* create window */
ad->main_win = myaccount_create_main_win(APPNAME);
retv_if(ad->main_win == NULL, false);
/* create conformant */
ad->conform = myaccount_create_conformant(ad->main_win);
retv_if(ad->conform == NULL, false);
/* create circle surface */
ad->circle_surface = eext_circle_surface_conformant_add(ad->conform);
retv_if(ad->circle_surface == NULL, false);
/* create bg */
ad->main_bg = myaccount_create_bg(ad->conform);
retv_if(ad->main_bg == NULL, false);
/* create base layout */
ad->main_layout = myaccount_create_main_layout(ad->conform);
retv_if(ad->main_layout == NULL, false);
/* create naviframe */
ad->navi_frame = elm_naviframe_add(ad->main_layout);
retv_if(ad->navi_frame == NULL, false);
elm_object_part_content_set(ad->main_layout, "elm.swallow.content", ad->navi_frame);
evas_object_show(ad->navi_frame);
eext_object_event_callback_add(ad->navi_frame, EEXT_CALLBACK_BACK, __back_clicked_cb, ad);
evas_object_show(ad->main_win);
return true;
}
bool _myaccount_main_app_create(void *user_data)
{
appdata *ad = user_data;
int account_cnt, ret;
MA_DEBUG("_myaccount_main_app_create start");
retv_if(ad == NULL, false);
bindtextdomain("my-account", "/usr/apps/org.tizen.my-account/res/locale");
textdomain("my-account");
_myaccount_init(ad);
ret = account_get_total_count_from_db_ex(&account_cnt);
if (ret != ACCOUNT_ERROR_NONE) {
MA_DEBUG_ERR("myaccount account_get_total_count_from_db_ex fail error=[%d]", ret);
return false;
}
if (account_cnt > 0) {
MA_DEBUG("myaccount account_cnt > 0, count = [%d]", account_cnt);
ad->mode = MYACCOUNT_ACCOUNT_LIST_MODE;
} else {
MA_DEBUG("myaccount account_cnt <= 0, count = [%d]", account_cnt);
ad->mode = MYACCOUNT_ADD_ACCOUNT_MODE;
}
if (!_create_gui(ad)) {
MA_DEBUG("_create_gui() fail");
return false;
}
_myaccount_view_main_create(ad);
elm_win_activate(ad->main_win);
MA_DEBUG("_myaccount_main_app_create end");
return true;
}
void _myaccount_main_app_resume(void *user_data)
{
MA_DEBUG("_myaccount_main_app_resume start");
appdata *ad = user_data;
int account_cnt = _myaccount_get_accounts_total_count();
if (account_cnt != previous_cnt) {
MA_DEBUG("account_cnt is changed from [%d]", previous_cnt);
_myaccount_view_main_create(ad);
elm_win_activate(ad->main_win);
}
MA_DEBUG("_myaccount_main_app_resume end");
}
void _myaccount_main_app_terminate(void *user_data)
{
appdata *ad = user_data;
MA_DEBUG("_myaccount_main_app_terminate start");
ret_if(ad == NULL);
MA_DEBUG("_myaccount_main_app_terminate end");
}
void _myaccount_main_app_service(app_control_h service, void *user_data)
{
appdata *ad = user_data;
MA_DEBUG("_myaccount_main_app_service start");
ret_if(ad == NULL);
int account_cnt = _myaccount_get_accounts_total_count();
if (account_cnt != previous_cnt) {
MA_DEBUG("account_cnt is changed from [%d]", previous_cnt);
_myaccount_view_main_create(ad);
elm_win_activate(ad->main_win);
}
MA_DEBUG("_myaccount_main_app_service end");
}
int main(int argc, char* argv[])
{
appdata ad;
ui_app_lifecycle_callback_s event_callback = {0,};
MA_DEBUG("app start");
event_callback.create = _myaccount_main_app_create;
event_callback.resume = _myaccount_main_app_resume;
event_callback.terminate = _myaccount_main_app_terminate;
event_callback.app_control = _myaccount_main_app_service;
MA_DEBUG("app end");
memset(&ad, 0x0, sizeof(appdata));
return ui_app_main(argc, argv, &event_callback, &ad);
}
|