2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.0 (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.
19 #include "setting_view_toast.h"
22 Toast_Data *_create_toast(void *data, char *msg)
24 Toast_Data *toast = (Toast_Data *) calloc(sizeof(Toast_Data), 1);
27 toast->str = strdup(msg);
28 toast->toast_popup = NULL;
34 void _destroy_toast(Toast_Data *toast)
40 if (toast->toast_popup) {
41 evas_object_del(toast->toast_popup);
42 toast->toast_popup = NULL;
48 void _dismiss_toast(void *data, Evas_Object *obj, void *event_info)
50 Toast_Data *toast = (Toast_Data *)data;
51 _destroy_toast(toast);
54 void _show_toast(void *data, Toast_Data *toast)
57 if (ad == NULL || toast == NULL) {
65 toast->toast_popup = elm_popup_add(ad->nf);
67 elm_object_style_set(toast->toast_popup, "toast/circle");
69 elm_object_style_set(toast->toast_popup, "toast");
71 elm_popup_orient_set(toast->toast_popup, ELM_POPUP_ORIENT_BOTTOM);
72 evas_object_size_hint_weight_set(toast->toast_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
73 ea_object_event_callback_add(toast->toast_popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
74 elm_object_part_text_set(toast->toast_popup, "elm.text", toast->str);
75 elm_popup_timeout_set(toast->toast_popup, 2.0);
77 evas_object_smart_callback_add(toast->toast_popup, "block,clicked", _dismiss_toast, toast);
78 evas_object_smart_callback_add(toast->toast_popup, "timeout", _dismiss_toast, toast);
80 evas_object_show(toast->toast_popup);