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.
20 #include "external-ug.h"
22 static void __cal_ug_destroy_callback(ui_gadget_h ug, void *priv)
24 c_retm_if(!ug, "ug is null");
29 static void __cal_ug_layout_callback(ui_gadget_h ug, enum ug_mode mode, void *priv)
31 c_retm_if(!ug, "ug is null");
32 c_retm_if(mode != UG_MODE_FULLVIEW, "mode is invaild");
34 Evas_Object *base = ug_get_layout(ug);
36 ERR("ug_get_layout() returned null");
42 case UG_MODE_FULLVIEW:
43 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 elm_win_resize_object_add(ug_get_window(), base);
45 evas_object_show(base);
52 static void __cal_ug_result_callback(ui_gadget_h ug, service_h res, void *priv)
54 c_retm_if(!ug, "ug is null");
57 void cal_launch_ug(service_h bd, char *ug_name, struct ug_cbs *cbs)
61 c_retm_if(!bd, "bd is null");
62 c_retm_if(!ug_name, "ug_name is null");
68 uc.destroy_cb = __cal_ug_destroy_callback;
69 uc.layout_cb = __cal_ug_layout_callback;
70 uc.result_cb = __cal_ug_result_callback;
73 if (NULL == cbs->destroy_cb)
74 uc.destroy_cb = __cal_ug_destroy_callback;
76 uc.destroy_cb = cbs->destroy_cb;
78 if (NULL == cbs->layout_cb)
79 uc.layout_cb = __cal_ug_layout_callback;
81 uc.layout_cb = cbs->layout_cb;
83 if (NULL == cbs->result_cb)
84 uc.result_cb = __cal_ug_result_callback;
86 uc.result_cb = cbs->result_cb;
88 if (NULL == cbs->priv)
94 ug = ug_create(NULL, ug_name, UG_MODE_FULLVIEW, bd, &uc);
96 ERR("ug create error");
99 void cal_launch_ug_with_var(char *ug_name, struct ug_cbs *cbs,...)
103 c_retm_if(!ug_name, "ug_name is null");
108 int r = service_create(&bd);
109 c_ret_if(r != SERVICE_ERROR_NONE);
114 key = va_arg(ap, char *);
115 val = va_arg(ap, char *);
121 service_add_extra_data(bd, key, val);
126 cal_launch_ug(bd, ug_name, cbs);