2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "alarm_subview_tone.h"
19 #include "alarm_fwk_util.h"
20 /**********************************************************************
21 ******************Local function ref*************************************
22 ***********************************************************************/
26 * This function is used to set layout cb
27 * @param ug[in] pointer to struct ui_gadget
28 * @param mode[in] enum ug_mode
29 * @param priv[in] pointer to data
33 static void alarmapp_tone_layout_cb(ui_gadget_h ug, enum ug_mode mode,
37 Evas_Object *base = ug_get_layout(ug);
39 Evas_Object *win = ug_get_window();
42 case UG_MODE_FULLVIEW:
43 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
45 elm_win_resize_object_add(win, base);
46 evas_object_show(base);
48 case UG_MODE_FRAMEVIEW:
49 elm_object_part_content_set(win, STRING_ALARM_LAYOUT_CONTENT,
59 * This function is used to set result cb
60 * @param ug[in] pointer to struct ui_gadget
61 * @param result[out] bundle
62 * @param priv[in] pointer to data
66 static void alarmapp_tone_result_cb(ui_gadget_h ug, service_h result,
69 retm_if(NULL_CHECK(ug), "ug null");
70 retm_if(NULL_CHECK(priv), "priv null");
72 struct appdata *ad = (struct appdata *)priv;
73 setting_view *view = ad->view_setting;
76 service_get_extra_data(result, STRING_ALARM_RESULT, &val);
77 retm_if(NULL_CHECK(val), "val null");
78 memset(view->tmp_alarm.tone, 0, sizeof(view->tmp_alarm.tone));
79 memcpy(view->tmp_alarm.tone, val, sizeof(view->tmp_alarm.tone));
80 alarm_view_setting.update(ad);
87 * This function is used to set destroy cb
88 * @param ug[in] pointer to struct ui_gadget
89 * @param priv[in] pointer to data
93 static void alarmapp_tone_destroy_cb(ui_gadget_h ug, void *priv)
95 retm_if(NULL_CHECK(priv), "priv null");
96 struct appdata *ad = (struct appdata *)priv;
97 setting_view *view = ad->view_setting;
103 ad->page = PAGE_ALARM_SETTING;
104 alm_show_view(ad, EINA_FALSE);
105 alarm_view_setting.update(ad);
110 * This function is used to create ug: myfile
111 * @param ad[in] pointer to struct appdata
115 ui_gadget_h alarmapp_tone_create_ug_myfile(struct appdata *ad)
117 retvm_if(NULL_CHECK(ad), NULL, "ad null");
118 setting_view *view = ad->view_setting;
119 retv_if(!view, NULL);
122 struct ug_cbs cbs = { 0, };
124 cbs.layout_cb = alarmapp_tone_layout_cb;
125 cbs.result_cb = alarmapp_tone_result_cb;
126 cbs.destroy_cb = alarmapp_tone_destroy_cb;
127 cbs.priv = (void *)ad;
130 service_create(&service);
131 retv_if(!service, NULL);
133 service_add_extra_data(service, STRING_ALARM_bundle_MARKED_MODE, view->tmp_alarm.tone);
134 service_add_extra_data(service, STRING_ALARM_bundle_PATH, SETTING_DEFAULT_ALERT_PATH);
135 service_add_extra_data(service, STRING_ALARM_bundle_SELECT_TYPE,
136 STRING_ALARM_bundle_SINGLE_FILE);
137 service_add_extra_data(service, STRING_ALARM_bundle_FILE_TYPE, STRING_ALARM_bundle_SOUND);
138 service_add_extra_data(service, STRING_ALARM_bundle_DRM_TYPE,
139 STRING_ALARM_bundle_DRM_ALL);
140 ug = ug_create(NULL, STRING_ALARM_bundle_MYFILE_EFL, UG_MODE_FULLVIEW,
142 service_destroy(service);
146 /**********************************************************************
147 ******************Global function ref*************************************
148 ***********************************************************************/
152 * This function is used to load view: tone view
153 * @param ad[in] pointer to struct appdata
154 * @return when success, return SUCCESS or FAILED if error
157 int load_page_tone(struct appdata *ad)
159 retvm_if(NULL_CHECK(ad), FAILED, "ad null");
160 ad->page = PAGE_ALARM_TONE;
161 setting_view *view = ad->view_setting;
163 UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
164 alarmapp_tone_create_ug_myfile(ad);