Tizen 2.4.0 rev3 SDK Public Release
[apps/home/settings.git] / setting-moreconnections / src / setting-moreconnections.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
22 #include "setting-moreconnections.h"
23
24 #ifndef UG_MODULE_API
25 #define UG_MODULE_API __attribute__ ((visibility("default")))
26 #endif
27
28 static void *setting_moreconnections_ug_on_create(ui_gadget_h ug,
29                                                   enum ug_mode mode, app_control_h service,
30                                                   void *priv)
31 {
32         SETTING_TRACE_BEGIN;
33         setting_retvm_if((!priv), NULL, "!priv");
34
35         SettingMoreConnectionsUG *moreconnectionsUG = priv;
36         moreconnectionsUG->ug = ug;
37         moreconnectionsUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
38         moreconnectionsUG->win_get = (Evas_Object *) ug_get_window();
39
40         moreconnectionsUG->evas = evas_object_evas_get(moreconnectionsUG->win_main_layout);
41
42         setting_retvm_if(moreconnectionsUG->win_main_layout == NULL, NULL,
43                          "cannot get main window ");
44         setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
45
46         /* register view node table */
47         setting_view_node_table_intialize();
48         setting_view_node_table_register(&setting_view_moreconnections_main, NULL);
49
50         /*  creating a view. */
51         setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, &(moreconnectionsUG->itc_2text_2));
52         setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(moreconnectionsUG->itc_1text));
53
54         setting_view_node_set_cur_view(&setting_view_moreconnections_main);
55         setting_view_create(&setting_view_moreconnections_main, (void *)moreconnectionsUG);
56
57         return moreconnectionsUG->ly_main;
58 }
59
60 static void setting_moreconnections_ug_on_start(ui_gadget_h ug, app_control_h service,
61                                                 void *priv)
62 {
63         SETTING_TRACE_BEGIN;
64         SETTING_TRACE_END;
65 }
66
67 static void setting_moreconnections_ug_on_pause(ui_gadget_h ug, app_control_h service,
68                                                 void *priv)
69 {
70         SETTING_TRACE_BEGIN;
71         SETTING_TRACE_END;
72 }
73
74 static void setting_moreconnections_ug_on_resume(ui_gadget_h ug, app_control_h service,
75                                                  void *priv)
76 {
77         SETTING_TRACE_BEGIN;
78         setting_retvm_if((!priv), NULL, "!priv");
79
80         SettingMoreConnectionsUG *moreconnectionsUG = priv;
81         setting_view_create(&setting_view_moreconnections_main, (void *)moreconnectionsUG);
82
83         if (moreconnectionsUG->location_service) {
84                 char *sub_desc = setting_location_is_enable(priv);
85                 moreconnectionsUG->location_service->sub_desc = (char *)strdup(sub_desc);
86                 elm_object_item_data_set(moreconnectionsUG->location_service->item, moreconnectionsUG->location_service);
87                 elm_genlist_item_update(moreconnectionsUG->location_service->item);
88         }
89
90         SETTING_TRACE_END;
91 }
92
93 static void setting_moreconnections_ug_on_destroy(ui_gadget_h ug, app_control_h service,
94                                                   void *priv)
95 {
96         SETTING_TRACE_BEGIN;
97         SETTING_TRACE_END;
98 }
99
100 static void setting_moreconnections_ug_on_message(ui_gadget_h ug, app_control_h msg,
101                                                   app_control_h service, void *priv)
102 {
103         SETTING_TRACE_BEGIN;
104         SETTING_TRACE_END;
105 }
106
107 static void setting_moreconnections_ug_on_event(ui_gadget_h ug,
108                                                 enum ug_event event, app_control_h service,
109                                                 void *priv)
110 {
111         SETTING_TRACE_BEGIN;
112         SETTING_TRACE_END;
113 }
114
115 static void setting_moreconnections_ug_on_key_event(ui_gadget_h ug,
116                                                     enum ug_key_event event,
117                                                     app_control_h service, void *priv)
118 {
119         SETTING_TRACE_BEGIN;
120         SETTING_TRACE_END;
121 }
122
123 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
124 {
125         SETTING_TRACE_BEGIN;
126         SettingMoreConnectionsUG *moreconnectionsUG = calloc(1, sizeof(SettingMoreConnectionsUG));
127         setting_retvm_if(!moreconnectionsUG, -1, "Create SettingMoreConnectionsUG obj failed");
128
129         memset(moreconnectionsUG, 0x00, sizeof(SettingMoreConnectionsUG));
130
131         ops->create = setting_moreconnections_ug_on_create;
132         ops->start = setting_moreconnections_ug_on_start;
133         ops->pause = setting_moreconnections_ug_on_pause;
134         ops->resume = setting_moreconnections_ug_on_resume;
135         ops->destroy = setting_moreconnections_ug_on_destroy;
136         ops->message = setting_moreconnections_ug_on_message;
137         ops->event = setting_moreconnections_ug_on_event;
138         ops->key_event = setting_moreconnections_ug_on_key_event;
139         ops->priv = moreconnectionsUG;
140         ops->opt = UG_OPT_INDICATOR_ENABLE;
141
142         return 0;
143 }
144
145 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
146 {
147         SETTING_TRACE_BEGIN;
148         struct SettingMoreConnectionsUG *moreconnectionsUG;
149         setting_retm_if(!ops, "ops == NULL");
150
151         moreconnectionsUG = ops->priv;
152         if (moreconnectionsUG) {
153                 FREE(moreconnectionsUG);
154         }
155 }