2 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * This file is part of <phone-lock>
5 * Written by <Seungtaek Chung> <seungtaek.chung@samsung.com>, <Mi-Ju Lee> <miju52.lee@samsung.com>, <Xi Zhichan> <zhichan.xi@samsung.com>
7 * PROPRIETARY/CONFIDENTIAL
9 * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
10 * You shall not disclose such Confidential Information and shall use it only in accordance
11 * with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
12 * SAMSUNG make no representations or warranties about the suitability of the software,
13 * either express or implied, including but not limited to the implied warranties of merchantability,
14 * fitness for a particular purpose, or non-infringement.
15 * SAMSUNG shall not be liable for any damages suffered by licensee as a result of using,
16 * modifying or distributing this software or its derivatives.
20 #include <appcore-efl.h>
21 #include <ui-gadget.h>
26 #include "phone-lock.h"
27 #include "phone-lock-util.h"
28 #include "phone-lock-ui.h"
29 #include "phone-lock-string.h"
31 static void _phone_lock_alpha_ug_layout_cb(struct ui_gadget *ug,
32 enum ug_mode mode, void *priv)
34 struct appdata *ad = NULL;
41 base = ug_get_layout(ug);
46 case UG_MODE_FULLVIEW:
47 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
49 elm_win_resize_object_add(ad->win, base);
50 evas_object_show(base);
52 case UG_MODE_FRAMEVIEW:
59 static void _phone_lock_alpha_ug_result_cb(struct ui_gadget *ug,
60 bundle * result, void *priv)
62 struct appdata *ad = (struct appdata *)priv;
63 const char *val1 = NULL, *val2 = NULL;
68 ad = (struct appdata *)priv;
70 val1 = bundle_get_val(result, "name");
75 if (!strcmp(val1, "phonelock-ug")) {
76 val2 = bundle_get_val(result, "result");
80 if (!strcmp(val2, "success")) {
81 _DBG("password verified. Unlock!\n");
83 } else if (!strcmp(val1, "phonelock-ug-alpha")) {
84 val2 = bundle_get_val(result, "result");
92 static void _phone_lock_alpha_ug_destroy_cb(struct ui_gadget *ug, void *priv)
94 struct appdata *ad = (struct appdata *)priv;
101 phone_lock_send_cmd("unlock");
104 int phone_lock_show_alpha_ug(struct appdata *ad)
106 _DBG("%s,%d", __func__, __LINE__);
109 struct ug_cbs cbs = { 0, };
111 cbs.layout_cb = _phone_lock_alpha_ug_layout_cb;
112 cbs.result_cb = _phone_lock_alpha_ug_result_cb;
113 cbs.destroy_cb = _phone_lock_alpha_ug_destroy_cb;
114 cbs.priv = (void *)ad;
117 bundle_add(b, "phone-lock-type", "phone-lock");
118 bundle_add(b, "window-type", "alpha");
120 elm_win_alpha_set(ad->win, TRUE);
121 evas_object_color_set(ad->win, 0, 0, 0, 0);
123 Evas_Object *bg = elm_bg_add(ad->win);
124 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
126 evas_object_color_set(bg, 255, 255, 255, 120);
127 elm_win_resize_object_add(ad->win, bg);
128 evas_object_show(bg);
130 ecore_x_icccm_name_class_set(elm_win_xwindow_get(ad->win),
131 "LOCK_SCREEN", "LOCK_SCREEN");
133 UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
134 ug_create(NULL, "phone-lock-efl", UG_MODE_FULLVIEW, b, &cbs);
140 evas_object_show(ad->win);
141 phone_lock_set_win_prop(ad, ECORE_X_WINDOW_TYPE_NOTIFICATION);