2 * Copyright 2012 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://www.tizenopensource.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.
18 #include <ui-gadget.h>
21 #include "_util_log.h"
32 static void button_ug_layout_cb(ui_gadget_h ug,
33 enum ug_mode mode, void *priv)
35 Evas_Object *base = NULL;
36 Evas_Object *win = NULL;
38 base = ug_get_layout(ug);
39 win = ug_get_window();
41 retm_if(ug == NULL, "ug_get_layout API is failed\n");
42 retm_if(ug == NULL, "ug_get_window API is failed\n");
45 case UG_MODE_FULLVIEW:
46 evas_object_size_hint_weight_set(base,
47 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 elm_win_resize_object_add(win, base);
49 evas_object_show(base);
56 static void button_ug_destroy_cb(ui_gadget_h ug, void *priv)
59 struct appdata *ad = (struct appdata *)priv;
60 retm_if(ug == NULL, "Invalid argument: ug is NULL\n");
62 /* ug_destroy 0 : success, -1 : fail */
63 _D("%d\n", ug_destroy(ug));
66 ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NOTIFICATION);
67 utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_OFF);
68 elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE);
73 ui_gadget_h create_button_ug(void *data)
75 ui_gadget_h ug = NULL;
76 struct ug_cbs cbs = {0};
77 struct appdata *ad = (struct appdata *)data;
78 int vconf_status = -1;
79 int lock = -1, type = -1;
80 retvm_if(ad == NULL, 0, "Invalid argument:appdata is NULL\n");
82 cbs.layout_cb = button_ug_layout_cb;
83 cbs.destroy_cb = button_ug_destroy_cb;
84 cbs.priv = (void *)data;
86 vconf_get_int(VCONFKEY_PWLOCK_STATE, &vconf_status);
88 lock = _get_vconf_idlelock();
89 type = _get_volume_type();
91 if(vconf_status == VCONFKEY_PWLOCK_BOOTING_LOCK || (lock == IDLELOCK_ON && type == VOLUME_TYPE_MEDIA)){
92 ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NOTIFICATION);
95 ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NORMAL);
97 utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_ON);
98 ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, NULL, &cbs);
100 ecore_x_e_illume_quickpanel_state_send(ecore_x_e_illume_zone_get(elm_win_xwindow_get(ad->win)),
101 ECORE_X_ILLUME_QUICKPANEL_STATE_OFF);
106 int _open_ug(void *data)
108 struct appdata *ad = (struct appdata *)data;
109 ui_gadget_h ug= NULL;
111 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
112 retvm_if(ad->win == NULL, -1, "Invalid argument: window is NULL\n");
114 UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_PORTRAIT_ONLY);
115 elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
116 ug = create_button_ug(ad);
119 retvm_if(ug == NULL, -1, "Failed to Create ug!\n");