source code open - cert-svc-ui
[framework/security/cert-svc-ui.git] / view / src / certificates / trusted_root_ca_cert / trusted_root_ca_cert.c
1 /*
2  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * This file is part of the Manage Applications
5  * Written by Eunmi Son <eunmi.son@samsung.com>
6  *
7  * Author of this file:
8  * Janusz Kozerski <j.kozerski@samsung.com>
9  *
10  * PROPRIETARY/CONFIDENTIAL
11  *
12  * This software is the confidential and proprietary information of
13  * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
14  * disclose such Confidential Information and shall use it only in
15  * accordance with the terms of the license agreement you entered
16  * into with SAMSUNG ELECTRONICS.
17  *
18  * SAMSUNG make no representations or warranties about the suitability
19  * of the software, either express or implied, including but not limited
20  * to the implied warranties of merchantability, fitness for a particular
21  * purpose, or non-infringement. SAMSUNG shall not be liable for any
22  * damages suffered by licensee as a result of using, modifying or
23  * distributing this software or its derivatives.
24  *
25  */
26
27 #include "certificates/certificate_util.h"
28 #include "certificates/certificates.h"
29
30 #include <dirent.h>
31
32 //static char *dir_path = PATH_CERT_ROOT_PATH; // This path is the original certificates path
33 static char *dir_path = PATH_CERT_WAC; // This can be used for tests
34
35 void trusted_root_cert_cb(void *data, Evas_Object *obj, void *event_info) {
36
37         LOGD("trusted root ---------------------");
38
39         struct ug_data *ad = (struct ug_data *) data;
40         Evas_Object *list = NULL;
41
42         struct ListElement *firstListElement = NULL;
43         struct ListElement *lastListElement = NULL;
44         firstListElement = initList();
45         lastListElement = firstListElement;
46
47         Evas_Object *toolbar = elm_toolbar_add(ad->navi_bar);
48         if (!toolbar)
49                 return;
50         elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
51
52         elm_toolbar_item_append(toolbar, NULL, dgettext(PACKAGE, "UNINSTALL"), delete_cert_cb, strdup(dir_path));
53
54         list = elm_list_add(ad->win_main);
55         elm_list_mode_set(list, ELM_LIST_COMPRESS);
56         evas_object_smart_callback_add(list, "selected", NULL, NULL);
57
58         if(make_list(ad, list, dir_path, lastListElement, TRUSTED_ROOT)){
59                 Evas_Object *no_content = elm_layout_add(ad->win_main);
60                 elm_layout_theme_set(no_content, "layout", "nocontents", "text");
61                 elm_object_part_text_set(no_content, "elm.text", dgettext(PACKAGE, "IDS_COM_BODY_NO_CONTENTS"));
62                 evas_object_size_hint_weight_set(no_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63                 evas_object_show(no_content);
64
65                 elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "TRUSTED_ROOT_CERTIFICATE"), NULL, NULL, no_content, NULL);
66         } else {
67
68                 Elm_Object_Item *itm = elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "TRUSTED_ROOT_CERTIFICATE"), NULL, NULL, list,
69                                 NULL);
70                 elm_object_item_part_content_set(itm, "controlbar", toolbar);
71
72                 Evas_Object *back = NULL;
73                 back = elm_object_item_part_content_get(itm, "prev_btn");
74                 evas_object_smart_callback_add(back, "clicked", back_cb, ad);
75         }
76
77 }
78