upload codes for TIZEN 2.0
[apps/home/clock.git] / src / clock_util.c
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
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
8 *
9 *    http://www.tizenopensource.org/license
10 *
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.
16 *
17 */
18 #include "clock.h"
19 #include "clock_util.h"
20
21 /**
22  * Creat new popup window, and show it
23  *
24  * @param[in]  data   Data used in this function
25  * @param[in]  info   String displayed on popup
26  *
27  * @return
28  */
29 void clock_util_show_popup(void *data, char *info, Evas_Smart_Cb response_cb)
30 {
31         CLK_FUN_BEG();
32         if (!data) {
33                 return;
34         }
35
36         struct appdata *ad = (struct appdata *)data;
37         Evas_Object *popup = NULL;
38         // reset popup
39         EVAS_OBJECT_DELIF(ad->popup);
40         //to show popup
41         popup = elm_popup_add(NULL);
42         evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
43                                          EVAS_HINT_EXPAND);
44         elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
45         elm_object_part_text_set(popup, "title", S_("IDS_COM_POP_WARNING"));
46         elm_object_text_set(popup, _(info));
47
48         Evas_Object *btn = elm_button_add(popup);
49         elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
50         elm_object_part_content_set(popup, "button1", btn);
51         evas_object_smart_callback_add(btn, "clicked", response_cb, data);
52
53         // show popup
54         evas_object_show(popup);
55
56         ad->popup = popup;
57
58         CLK_FUN_END();
59 }