Sync from SPIN branch
[platform/core/telephony/tel-plugin-vconf.git] / src / vconf_main.c
1 /*
2  * tel-plugin-vconf
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@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 <stdio.h>
22 #include <stdlib.h>
23
24 #include <glib.h>
25
26 #include <tcore.h>
27
28 #include "vconf_main.h"
29 #include "vconf_core.h"
30 #include "vconf_handler.h"
31
32 /*
33  * VCONF Initialization function
34  */
35 gboolean vconf_main_init(TcorePlugin *p)
36 {
37         gboolean ret;
38
39         if (!p)
40                 return FALSE;
41
42         dbg("Enter");
43
44         /*
45          * Initialize VCONF 'Core'
46          */
47         ret = vconf_core_init(p);
48         if (ret == FALSE) {
49                 err("VCONF Core init failed!");
50                 return FALSE;
51         }
52
53         /*
54          * Initialize VCONF 'Handler'
55          */
56         ret = vconf_handler_init(p);
57         if (ret == FALSE) {
58                 err("VCONF Handler init failed!");
59
60                 vconf_core_deinit(p);
61                 return FALSE;
62         }
63
64
65         return TRUE;
66 }
67
68 /*
69  * VCONF De-initialization function
70  */
71 void vconf_main_deinit(TcorePlugin *p)
72 {
73         if (!p)
74                 return;
75
76         dbg("Enter");
77
78         /*
79          * De-initialize VCONF 'Handler'
80          */
81         vconf_handler_deinit(p);
82
83         /*
84          * De-initialize VCONF 'Core'
85          */
86         vconf_core_deinit(p);
87 }