4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #include <Elementary.h>
30 #define PREDEF_POWEROFF "poweroff"
32 static void response_poweroff_yes_clicked(void *data, Evas_Object * obj, void *event_info)
34 struct appdata *ad = (struct appdata *)data;
36 Evas_Coord w, h, size;
37 static bool multi = false;
45 if (ad && ad->popup && ad->win_main) {
46 release_evas_object(&(ad->popup));
48 rect = evas_object_rectangle_add(evas_object_evas_get(ad->win_main));
49 evas_object_geometry_get(ad->win_main, NULL, NULL, &w, &h);
51 evas_object_resize(rect, size, size);
52 evas_object_color_set(rect, 0, 0, 0, 255);
53 evas_object_show(rect);
56 /* if (vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, SYSTEMD_STOP_POWER_OFF) != 0)*/
57 if (sysman_call_predef_action(PREDEF_POWEROFF, 0) == -1)
58 _E("Failed to request poweroff to deviced");
61 static void response_poweroff_no_clicked(void *data, Evas_Object * obj, void *event_info)
68 static int show_poweroff_popup(struct appdata *ad)
73 ad->popup = load_normal_popup(ad,
74 _("IDS_ST_BODY_POWER_OFF"),
75 _("IDS_COM_BODY_OUR_PHONE_WILL_SHUT_DOWN"),
76 dgettext("sys_string","IDS_COM_SK_CANCEL"),
77 response_poweroff_no_clicked,
78 dgettext("sys_string","IDS_COM_SK_OK"),
79 response_poweroff_yes_clicked);
81 _E("Failed to make popup");
88 static int app_create(void *data)
91 struct appdata *ad = data;
94 ad->handler.def_term_fn = NULL;
95 ad->handler.def_timeout_fn = NULL;
97 win = create_win(PACKAGE);
103 ret = appcore_set_i18n(LANG_DOMAIN, LOCALE_DIR);
105 _E("FAIL: appcore_set_i18n()");
110 static int app_terminate(void *data)
112 struct appdata *ad = data;
114 release_evas_object(&(ad->win_main));
119 static int app_pause(void *data)
124 static int app_resume(void *data)
129 static int app_reset(bundle *b, void *data)
131 struct appdata *ad = data;
134 if (syspopup_has_popup(b)) {
139 ret = syspopup_create(b, &(ad->handler), ad->win_main, ad);
141 _E("Failed to create syspopup(%d)", ret);
145 evas_object_show(ad->win_main);
147 ret = show_poweroff_popup(ad);
149 _E("Failed to show poweroff popup (%d)", ret);
158 int main(int argc, char *argv[])
162 /* App life cycle management */
163 struct appcore_ops ops = {
164 .create = app_create,
165 .terminate = app_terminate,
167 .resume = app_resume,
171 memset(&ad, 0x0, sizeof(struct appdata));
174 return appcore_efl_main(PACKAGE, &argc, &argv, &ops);