4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <setting-phone-license-divx-main.h>
23 static int setting_phone_license_divx_main_create(void *cb);
24 static int setting_phone_license_divx_main_destroy(void *cb);
25 static int setting_phone_license_divx_main_update(void *cb);
26 static int setting_phone_license_divx_main_cleanup(void *cb);
28 setting_view setting_view_phone_license_divx_main = {
29 .create = setting_phone_license_divx_main_create,
30 .destroy = setting_phone_license_divx_main_destroy,
31 .update = setting_phone_license_divx_main_update,
32 .cleanup = setting_phone_license_divx_main_cleanup,
35 /* ***************************************************
39 ***************************************************/
41 static int setting_phone_license_divx_main_create(void *cb)
45 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
47 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
49 Evas_Object *scroller;
50 /* scroller is a genlist */
51 setting_push_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get,
52 _("IDS_ST_HEADER_DIVX_VOD"),
53 dgettext("sys_string",
56 setting_phone_license_divx_main_click_softkey_back_cb,
57 NULL, ad, &scroller, ad->navi_bar);
59 Elm_Object_Item *item = NULL;;
62 elm_genlist_item_append(scroller, &(ad->itc_seperator), NULL, NULL,
63 ELM_GENLIST_ITEM_NONE, NULL, NULL);
64 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
67 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
68 setting_phone_license_divx_main_mouse_up_Gendial_list_cb,
69 ad, SWALLOW_Type_INVALID, NULL,
71 "IDS_ST_MBODY_REGISTER",
75 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
76 setting_phone_license_divx_main_mouse_up_Gendial_list_cb,
77 ad, SWALLOW_Type_INVALID, NULL,
79 "IDS_ST_MBODY_DEREGISTER",
82 drm_bool_type_e is_first = 0;
83 result = drm_is_action_allowed(DRM_IS_DEVICE_ACTIVATED, NULL, &is_first);
84 SETTING_TRACE_DEBUG("%s*** drm status - result=%d, is_first=%d ***%s",
85 SETTING_FONT_BGREEN, (int)result, is_first,
88 if (is_first) { /* disable de-reg */
90 elm_object_item_disabled_set(ad->data_dereg->item,
93 SETTING_TRACE_ERROR("ad->data_dereg is NULL");
96 } else { /* disable reg */
98 elm_object_item_disabled_set(ad->data_reg->item,
101 SETTING_TRACE_ERROR("ad->data_reg is NULL");
105 setting_view_phone_license_divx_main.is_create = 1;
106 return SETTING_RETURN_SUCCESS;
109 static int setting_phone_license_divx_main_destroy(void *cb)
113 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
115 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
117 elm_naviframe_item_pop(ad->navi_bar);
118 setting_view_phone_license_divx_main.is_create = 0;
120 return SETTING_RETURN_SUCCESS;
123 static int setting_phone_license_divx_main_update(void *cb)
125 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
127 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
129 if(ad->mode == SETTING_DIVX_MODE_REG)
131 setting_disable_genlist_item(ad->data_reg->item);
132 setting_enable_genlist_item(ad->data_dereg->item);
134 else if(ad->mode == SETTING_DIVX_MODE_DEREG)
136 setting_enable_genlist_item(ad->data_reg->item);
137 setting_disable_genlist_item(ad->data_dereg->item);
140 return SETTING_RETURN_SUCCESS;
143 static int setting_phone_license_divx_main_cleanup(void *cb)
145 return setting_phone_license_divx_main_destroy(cb);
148 /* ***************************************************
152 ***************************************************/
154 static void setting_phone_license_ask_deregistration_resp_cb(void *data,
158 int response_type = btn_type(obj);
159 if (POPUP_RESPONSE_OK == response_type) {
160 setting_phone_license_divx_main_click_popup_dereg_cb(data);
161 } else if (POPUP_RESPONSE_CANCEL == response_type) {
162 setting_phone_license_divx_main_click_popup_cancel_cb(data);
166 static Evas_Object *setting_phone_license_divx_main_create_dereg_popup(void
170 retvm_if(data == NULL, NULL,
171 "[Setting > About] Data parameter is NULL");
173 SettingPhoneUG *ad = (SettingPhoneUG *) data;
177 setting_create_popup_with_btn(ad, ad->win_get, NULL,
179 setting_phone_license_ask_deregistration_resp_cb,
180 0, 2, _("IDS_COM_SK_OK"),_("IDS_COM_SK_CANCEL"));
185 /* ***************************************************
189 ***************************************************/
192 setting_phone_license_divx_main_click_softkey_back_cb(void *data,
198 setting_retm_if(data == NULL, "Data parameter is NULL");
200 SettingPhoneUG *ad = (SettingPhoneUG *) data;
202 setting_view_change(&setting_view_phone_license_divx_main, &setting_view_phone_license_main, ad);
206 setting_phone_license_divx_main_mouse_up_Gendial_list_cb(void *data,
211 setting_retm_if(data == NULL, "Data parameter is NULL");
213 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
214 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
215 elm_genlist_item_selected_set(item, 0);
216 Setting_GenGroupItem_Data *list_item =
217 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
219 SettingPhoneUG *ad = (SettingPhoneUG *) data;
221 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
222 if (!safeStrCmp("IDS_ST_MBODY_REGISTER", list_item->keyStr)) {
223 ad->mode = SETTING_DIVX_MODE_REG;
224 setting_view_change(&setting_view_phone_license_divx_main,
225 &setting_view_phone_license_divx_mode, ad);
228 ("IDS_ST_MBODY_DEREGISTER", list_item->keyStr)) {
230 setting_phone_license_divx_main_create_dereg_popup(ad);
234 static void setting_phone_license_divx_main_click_popup_dereg_cb(void *data)
237 setting_retm_if(data == NULL, "Data parameter is NULL");
239 SettingPhoneUG *ad = (SettingPhoneUG *) data;
242 evas_object_del(ad->pop_dereg);
243 ad->pop_dereg = NULL;
246 ad->mode = SETTING_DIVX_MODE_DEREG;
247 setting_view_change(&setting_view_phone_license_divx_main,
248 &setting_view_phone_license_divx_mode, ad);
251 static void setting_phone_license_divx_main_click_popup_cancel_cb(void *data)
254 setting_retm_if(data == NULL, "Data parameter is NULL");
256 SettingPhoneUG *ad = (SettingPhoneUG *) data;
259 evas_object_del(ad->pop_dereg);
260 ad->pop_dereg = NULL;