3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.tizenopensource.org/license
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #include "alarm_subview_tone.h"
20 #include "alarm_fwk_util.h"
21 /**********************************************************************
22 ******************Local function ref*************************************
23 ***********************************************************************/
27 * This function is used to set layout cb
28 * @param ug[in] pointer to struct ui_gadget
29 * @param mode[in] enum ug_mode
30 * @param priv[in] pointer to data
34 static void alarmapp_tone_layout_cb(ui_gadget_h ug, enum ug_mode mode,
38 Evas_Object *base = ug_get_layout(ug);
40 Evas_Object *win = ug_get_window();
43 case UG_MODE_FULLVIEW:
44 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
46 elm_win_resize_object_add(win, base);
47 evas_object_show(base);
49 case UG_MODE_FRAMEVIEW:
50 elm_object_part_content_set(win, STRING_ALARM_LAYOUT_CONTENT,
60 * This function is used to set result cb
61 * @param ug[in] pointer to struct ui_gadget
62 * @param result[out] bundle
63 * @param priv[in] pointer to data
67 static void alarmapp_tone_result_cb(ui_gadget_h ug, service_h result,
70 retm_if(NULL_CHECK(ug), "ug null");
71 retm_if(NULL_CHECK(priv), "priv null");
73 struct appdata *ad = (struct appdata *)priv;
74 setting_view *view = ad->view_setting;
77 service_get_extra_data(result, STRING_ALARM_RESULT, &val);
78 retm_if(NULL_CHECK(val), "val null");
79 memset(view->tmp_alarm.tone, 0, sizeof(view->tmp_alarm.tone));
80 memcpy(view->tmp_alarm.tone, val, sizeof(view->tmp_alarm.tone));
81 alarm_view_setting.update(ad);
88 * This function is used to set destroy cb
89 * @param ug[in] pointer to struct ui_gadget
90 * @param priv[in] pointer to data
94 static void alarmapp_tone_destroy_cb(ui_gadget_h ug, void *priv)
96 retm_if(NULL_CHECK(priv), "priv null");
97 struct appdata *ad = (struct appdata *)priv;
98 setting_view *view = ad->view_setting;
100 ug_destroy(view->gadget);
103 ad->page = PAGE_ALARM_SETTING;
104 alm_show_view(ad, EINA_FALSE);
109 * This function is used to create ug: myfile
110 * @param ad[in] pointer to struct appdata
114 ui_gadget_h alarmapp_tone_create_ug_myfile(struct appdata *ad)
116 retvm_if(NULL_CHECK(ad), NULL, "ad null");
117 setting_view *view = ad->view_setting;
118 retv_if(!view, NULL);
121 struct ug_cbs cbs = { 0, };
123 cbs.layout_cb = alarmapp_tone_layout_cb;
124 cbs.result_cb = alarmapp_tone_result_cb;
125 cbs.destroy_cb = alarmapp_tone_destroy_cb;
126 cbs.priv = (void *)ad;
129 service_create(&service);
130 retv_if(!service, NULL);
132 service_add_extra_data(service, STRING_ALARM_bundle_MARKED_MODE, view->tmp_alarm.tone);
133 service_add_extra_data(service, STRING_ALARM_bundle_PATH, SETTING_DEFAULT_ALERT_PATH);
134 service_add_extra_data(service, STRING_ALARM_bundle_SELECT_TYPE,
135 STRING_ALARM_bundle_SINGLE_FILE);
136 service_add_extra_data(service, STRING_ALARM_bundle_FILE_TYPE, STRING_ALARM_bundle_SOUND);
137 service_add_extra_data(service, STRING_ALARM_bundle_DRM_TYPE,
138 STRING_ALARM_bundle_DRM_ALL);
139 ug = ug_create(NULL, STRING_ALARM_bundle_MYFILE_EFL, UG_MODE_FULLVIEW,
141 service_destroy(service);
145 /**********************************************************************
146 ******************Global function ref*************************************
147 ***********************************************************************/
151 * This function is used to load view: tone view
152 * @param ad[in] pointer to struct appdata
153 * @return when success, return SUCCESS or FAILED if error
156 int load_page_tone(struct appdata *ad)
158 retvm_if(NULL_CHECK(ad), FAILED, "ad null");
159 ad->page = PAGE_ALARM_TONE;
160 setting_view *view = ad->view_setting;
162 UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
164 view->gadget = alarmapp_tone_create_ug_myfile(ad);