Merge "modified default wallpaper image for Tizen setting" into 2.0_beta
[apps/core/preloaded/settings.git] / setting-security / src / setting-security-encryption.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <setting-common-data-type.h>
22 #include <setting-common-data-slp-setting.h>
23 #include <setting-common-draw-widget.h>
24
25 #include <setting-security-encryption.h>
26 #include <setting-debug.h>
27
28 static int setting_security_encryption_create(void *cb);
29 static int setting_security_encryption_destroy(void *cb);
30 static int setting_security_encryption_update(void *cb);
31 static int setting_security_encryption_cleanup(void *cb);
32
33 setting_view setting_view_security_encryption = {
34         .create = setting_security_encryption_create,
35         .destroy = setting_security_encryption_destroy,
36         .update = setting_security_encryption_update,
37         .cleanup = setting_security_encryption_cleanup,
38 };
39
40 /* ***************************************************
41  **
42  **basic func
43  **
44  ****************************************************/
45
46 static int setting_security_encryption_create(void *cb)
47 {
48         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
49
50         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
51
52         Evas_Object *scroller;
53
54         /* add basic layout */
55         char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI];
56         snprintf(setBtnStr, sizeof(setBtnStr), "%s",
57                  (char *)dgettext("sys_string", "IDS_COM_BODY_BACK"));
58
59         /* there are 2 titles, Device encryption or Device decryption */
60         setting_push_layout_navi_bar_genlist(ad->win_main_layout,
61                                                    ad->win_get,
62                                                    Keystr_DeviceEncryption,
63                                                    setBtnStr, NULL,
64                                                    setting_security_encryption_click_softkey_back_cb,
65                                                    NULL, ad, &scroller,
66                                                    ad->navi_bar);
67
68         (void)setting_create_Gendial_field_titleItem(scroller,
69                                                      &itc_group_item,
70                                                      "IDS_ST_HEADER_SCREEN_SECURITY", NULL);
71         /* To do : Fill this view */
72
73         /* update info */
74
75         setting_view_security_encryption.is_create = 1;
76
77         return SETTING_RETURN_SUCCESS;
78
79 }
80
81 static int setting_security_encryption_destroy(void *cb)
82 {
83         /* error check */
84         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
85
86         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
87
88         elm_naviframe_item_pop(ad->navi_bar);
89
90         setting_view_security_encryption.is_create = 0;
91
92         return SETTING_RETURN_SUCCESS;
93 }
94
95 static int setting_security_encryption_update(void *cb)
96 {
97         /* error check */
98         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
99
100         return SETTING_RETURN_SUCCESS;
101 }
102
103 static int setting_security_encryption_cleanup(void *cb)
104 {
105         /* error check */
106         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
107
108         setting_security_encryption_destroy(cb);
109
110         return SETTING_RETURN_SUCCESS;
111 }
112
113 /* ***************************************************
114  **
115  **call back func
116  **
117  ****************************************************/
118 static void
119 setting_security_encryption_click_softkey_back_cb(void *data, Evas_Object *obj,
120                                             void *event_info)
121 {
122         /* error check */
123         retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
124
125         SettingSecurityUG *ad = (SettingSecurityUG *) data;
126
127         setting_view_change(&setting_view_security_encryption, &setting_view_security_main, ad);
128 }