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.
19 #include <vconf-keys.h>
24 static void _draglock_util_window_deleted_cb(void *data, Evas_Object *obj,
29 Evas_Object *draglock_util_add_window(const char *name) {
30 Evas_Object *obj_window = NULL;
31 int width = 0, height = 0;
33 obj_window = elm_win_add(NULL, name, ELM_WIN_BASIC);
34 if (obj_window != NULL) {
35 elm_win_alpha_set(obj_window, EINA_TRUE);
36 elm_win_title_set(obj_window, name);
37 elm_win_borderless_set(obj_window, EINA_TRUE);
38 evas_object_smart_callback_add(obj_window, "delete,request",
39 _draglock_util_window_deleted_cb, NULL);
40 ecore_x_window_size_get(ecore_x_window_root_first_get(), &width,
42 evas_object_resize(obj_window, width, height);
43 elm_win_indicator_mode_set(obj_window, ELM_WIN_INDICATOR_SHOW);
49 Evas_Object *draglock_util_add_bg(Evas_Object *window) {
50 Evas_Object *obj_background = NULL;
56 obj_background = elm_bg_add(window);
58 if (obj_background != NULL) {
59 evas_object_size_hint_weight_set(obj_background, EVAS_HINT_EXPAND,
61 elm_object_style_set(obj_background, "transparent");
63 elm_win_resize_object_add(window, obj_background);
65 evas_object_show(obj_background);
68 return obj_background;
71 Evas_Object *draglock_util_add_layout(Evas_Object *parent, const char *file,
73 Evas_Object *layout = NULL;
74 Eina_Bool ret = EINA_FALSE;
77 DRAGLOCK_ERR("parent is NULL");
81 layout = elm_layout_add(parent);
83 DRAGLOCK_ERR("layout is NULL");
87 ret = elm_layout_file_set(layout, file, group);
88 DRAGLOCK_DBG("File:%s, Group:%s", file, group);
89 if (ret != EINA_TRUE) {
90 DRAGLOCK_DBG("File:%s, Group:%s", file, group);
91 evas_object_del(layout);
94 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
96 evas_object_show(layout);
101 int draglock_init_svi(int *handle)
103 if (svi_init(handle) != SVI_SUCCESS) {
104 DRAGLOCK_ERR("Cannot initialize SVI.");
112 int draglock_fini_svi(int handle)
114 if (svi_fini(handle) != SVI_SUCCESS) {
115 DRAGLOCK_ERR("[Error] Cannot get vconf\n");
122 void draglock_play_sound(int handle, int unlock)
124 int ret = -1, val = 0;
126 ret = vconf_get_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &val);
127 DRAGLOCK_DBG("val = %d", val);
129 if (ret == 0 && val == 1) {
130 svi_play(handle, SVI_VIB_NONE,
131 unlock ? SVI_SND_OPERATION_UNLOCK :
132 SVI_SND_OPERATION_LOCK);