3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.1 (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://floralicense.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 evas_object_show(base);
49 static void __cal_ug_result_callback(ui_gadget_h ug, service_h res, void *priv)
51 c_retm_if(!ug, "ug is null");
54 ui_gadget_h cal_launch_ug(ui_gadget_h parent_ug, service_h bd, char *ug_name, struct ug_cbs *cbs)
58 c_retvm_if(!bd, NULL, "bd is null");
59 c_retvm_if(!ug_name, NULL, "ug_name is null");
65 uc.destroy_cb = __cal_ug_destroy_callback;
66 uc.layout_cb = __cal_ug_layout_callback;
67 uc.result_cb = __cal_ug_result_callback;
70 if (NULL == cbs->destroy_cb)
71 uc.destroy_cb = __cal_ug_destroy_callback;
73 uc.destroy_cb = cbs->destroy_cb;
75 if (NULL == cbs->layout_cb)
76 uc.layout_cb = __cal_ug_layout_callback;
78 uc.layout_cb = cbs->layout_cb;
80 if (NULL == cbs->result_cb)
81 uc.result_cb = __cal_ug_result_callback;
83 uc.result_cb = cbs->result_cb;
85 if (NULL == cbs->priv)
91 ug = ug_create(parent_ug, ug_name, UG_MODE_FULLVIEW, bd, &uc);
93 ERR("ug create error");
98 ui_gadget_h cal_launch_ug_with_var(ui_gadget_h parent_ug, char *ug_name, struct ug_cbs *cbs,...)
102 c_retv_if(!ug_name, NULL);
107 int r = service_create(&service);
108 c_retv_if(r != SERVICE_ERROR_NONE, NULL);
113 key = va_arg(ap, char *);
114 val = va_arg(ap, char *);
120 service_add_extra_data(service, key, val);
121 service_set_uri(service, val);
126 /* Temporary code for email UG */
127 if (!CAL_STRCMP(ug_name, CAL_EMAIL_COMPOSER_UG)) {
131 service_destroy(service);
135 struct appdata *ad = (struct appdata*)cbs;
138 ERR("ad->win is null");
139 service_destroy(service);
143 service_set_operation(service, SERVICE_OPERATION_SEND);
145 service_set_app_id(service, CAL_EMAIL_COMPOSER_UG);
147 Ecore_X_Window win_id = elm_win_xwindow_get(ad->win);
149 service_set_window(service, win_id);
151 service_send_launch_request(service, NULL, NULL);
153 service_destroy(service);
158 ui_gadget_h ug = cal_launch_ug(parent_ug, service, ug_name, cbs);
160 service_destroy(service);