3 /* local subsystem functions */
4 static Eina_Bool _e_sys_cb_timer(void *data);
5 static Eina_Bool _e_sys_cb_exit(void *data, int type, void *event);
6 static void _e_sys_cb_logout_logout(void *data, E_Dialog *dia);
7 static void _e_sys_cb_logout_wait(void *data, E_Dialog *dia);
8 static void _e_sys_cb_logout_abort(void *data, E_Dialog *dia);
9 static Eina_Bool _e_sys_cb_logout_timer(void *data);
10 static void _e_sys_logout_after(void);
11 static void _e_sys_logout_begin(E_Sys_Action a_after, Eina_Bool raw);
12 static void _e_sys_current_action(void);
13 static void _e_sys_action_failed(void);
14 static int _e_sys_action_do(E_Sys_Action a, char *param, Eina_Bool raw);
15 static void _e_sys_dialog_cb_delete(E_Obj_Dialog *od);
17 static Ecore_Event_Handler *_e_sys_exe_exit_handler = NULL;
18 static Ecore_Exe *_e_sys_halt_check_exe = NULL;
19 static Ecore_Exe *_e_sys_reboot_check_exe = NULL;
20 static Ecore_Exe *_e_sys_suspend_check_exe = NULL;
21 static Ecore_Exe *_e_sys_hibernate_check_exe = NULL;
22 static int _e_sys_can_halt = 0;
23 static int _e_sys_can_reboot = 0;
24 static int _e_sys_can_suspend = 0;
25 static int _e_sys_can_hibernate = 0;
27 static E_Sys_Action _e_sys_action_current = E_SYS_NONE;
28 static E_Sys_Action _e_sys_action_after = E_SYS_NONE;
29 static Eina_Bool _e_sys_action_after_raw = EINA_FALSE;
30 static Ecore_Exe *_e_sys_exe = NULL;
31 static double _e_sys_begin_time = 0.0;
32 static double _e_sys_logout_begin_time = 0.0;
33 static Ecore_Timer *_e_sys_logout_timer = NULL;
34 static E_Obj_Dialog *_e_sys_dialog = NULL;
35 static E_Dialog *_e_sys_logout_confirm_dialog = NULL;
36 static Ecore_Timer *_e_sys_susp_hib_check_timer = NULL;
37 static double _e_sys_susp_hib_check_last_tick = 0.0;
38 static void (*_e_sys_suspend_func) (void) = NULL;
39 static void (*_e_sys_hibernate_func) (void) = NULL;
40 static void (*_e_sys_reboot_func) (void) = NULL;
41 static void (*_e_sys_shutdown_func) (void) = NULL;
42 static void (*_e_sys_logout_func) (void) = NULL;
43 static void (*_e_sys_resume_func) (void) = NULL;
45 static const int E_LOGOUT_AUTO_TIME = 60;
46 static const int E_LOGOUT_WAIT_TIME = 15;
48 /* externally accessible functions */
52 /* this is not optimal - but it does work cleanly */
53 _e_sys_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
54 _e_sys_cb_exit, NULL);
55 /* delay this for 1.0 seconds while the rest of e starts up */
56 ecore_timer_add(1.0, _e_sys_cb_timer, NULL);
63 if (_e_sys_exe_exit_handler)
64 ecore_event_handler_del(_e_sys_exe_exit_handler);
65 _e_sys_exe_exit_handler = NULL;
66 _e_sys_halt_check_exe = NULL;
67 _e_sys_reboot_check_exe = NULL;
68 _e_sys_suspend_check_exe = NULL;
69 _e_sys_hibernate_check_exe = NULL;
74 e_sys_action_possible_get(E_Sys_Action a)
88 return _e_sys_can_halt;
91 return _e_sys_can_reboot;
94 return _e_sys_can_suspend;
97 return _e_sys_can_hibernate;
106 e_sys_action_do(E_Sys_Action a, char *param)
110 if (_e_sys_action_current != E_SYS_NONE)
112 _e_sys_current_action();
122 case E_SYS_HIBERNATE:
124 ret = _e_sys_action_do(a, param, EINA_FALSE);
128 if (!e_util_immortal_check())
130 if (_e_sys_shutdown_func) _e_sys_shutdown_func();
131 else _e_sys_logout_begin(a, EINA_FALSE);
136 if (!e_util_immortal_check())
138 if (_e_sys_reboot_func) _e_sys_reboot_func();
139 else _e_sys_logout_begin(a, EINA_FALSE);
148 if (ret) _e_sys_action_current = a;
149 else _e_sys_action_current = E_SYS_NONE;
155 e_sys_action_raw_do(E_Sys_Action a, char *param)
159 if (_e_sys_action_current != E_SYS_NONE)
161 _e_sys_current_action();
171 case E_SYS_HIBERNATE:
173 ret = _e_sys_action_do(a, param, EINA_TRUE);
178 if (!e_util_immortal_check()) _e_sys_logout_begin(a, EINA_TRUE);
186 if (ret) _e_sys_action_current = a;
187 else _e_sys_action_current = E_SYS_NONE;
192 static Eina_List *extra_actions = NULL;
194 EAPI E_Sys_Con_Action *
195 e_sys_con_extra_action_register(const char *label,
196 const char *icon_group,
197 const char *button_name,
198 void (*func)(void *data),
201 E_Sys_Con_Action *sca;
203 sca = E_NEW(E_Sys_Con_Action, 1);
205 sca->label = eina_stringshare_add(label);
207 sca->icon_group = eina_stringshare_add(icon_group);
209 sca->button_name = eina_stringshare_add(button_name);
212 extra_actions = eina_list_append(extra_actions, sca);
217 e_sys_con_extra_action_unregister(E_Sys_Con_Action *sca)
219 extra_actions = eina_list_remove(extra_actions, sca);
220 if (sca->label) eina_stringshare_del(sca->label);
221 if (sca->icon_group) eina_stringshare_del(sca->icon_group);
222 if (sca->button_name) eina_stringshare_del(sca->button_name);
226 EAPI const Eina_List *
227 e_sys_con_extra_action_list_get(void)
229 return extra_actions;
233 e_sys_handlers_set(void (*suspend_func) (void),
234 void (*hibernate_func) (void),
235 void (*reboot_func) (void),
236 void (*shutdown_func) (void),
237 void (*logout_func) (void),
238 void (*resume_func) (void))
240 _e_sys_suspend_func = suspend_func;
241 _e_sys_hibernate_func = hibernate_func;
242 _e_sys_reboot_func = reboot_func;
243 _e_sys_shutdown_func = shutdown_func;
244 _e_sys_logout_func = logout_func;
245 _e_sys_resume_func = resume_func;
249 _e_sys_susp_hib_check_timer_cb(void *data __UNUSED__)
251 double t = ecore_time_unix_get();
253 if ((t - _e_sys_susp_hib_check_last_tick) > 0.2)
255 _e_sys_susp_hib_check_timer = NULL;
258 e_object_del(E_OBJECT(_e_sys_dialog));
259 _e_sys_dialog = NULL;
261 if (_e_sys_resume_func) _e_sys_resume_func();
264 _e_sys_susp_hib_check_last_tick = t;
269 _e_sys_susp_hib_check(void)
271 if (_e_sys_susp_hib_check_timer)
272 ecore_timer_del(_e_sys_susp_hib_check_timer);
273 _e_sys_susp_hib_check_last_tick = ecore_time_unix_get();
274 _e_sys_susp_hib_check_timer =
275 ecore_timer_add(0.1, _e_sys_susp_hib_check_timer_cb, NULL);
278 /* local subsystem functions */
280 _e_sys_cb_timer(void *data __UNUSED__)
282 /* exec out sys helper and ask it to test if we are allowed to do these
287 e_init_status_set(_("Checking System Permissions"));
288 snprintf(buf, sizeof(buf),
289 "%s/enlightenment/utils/enlightenment_sys -t halt",
291 _e_sys_halt_check_exe = ecore_exe_run(buf, NULL);
292 snprintf(buf, sizeof(buf),
293 "%s/enlightenment/utils/enlightenment_sys -t reboot",
295 _e_sys_reboot_check_exe = ecore_exe_run(buf, NULL);
296 snprintf(buf, sizeof(buf),
297 "%s/enlightenment/utils/enlightenment_sys -t suspend",
299 _e_sys_suspend_check_exe = ecore_exe_run(buf, NULL);
300 snprintf(buf, sizeof(buf),
301 "%s/enlightenment/utils/enlightenment_sys -t hibernate",
303 _e_sys_hibernate_check_exe = ecore_exe_run(buf, NULL);
304 return ECORE_CALLBACK_CANCEL;
308 _e_sys_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
310 Ecore_Exe_Event_Del *ev;
313 if ((_e_sys_exe) && (ev->exe == _e_sys_exe))
315 if (ev->exit_code != 0) _e_sys_action_failed();
316 if (((_e_sys_action_current != E_SYS_HALT) &&
317 (_e_sys_action_current != E_SYS_HALT_NOW) &&
318 (_e_sys_action_current != E_SYS_REBOOT)) ||
319 (ev->exit_code != 0))
323 e_object_del(E_OBJECT(_e_sys_dialog));
324 _e_sys_dialog = NULL;
327 _e_sys_action_current = E_SYS_NONE;
329 return ECORE_CALLBACK_RENEW;
331 if ((_e_sys_halt_check_exe) && (ev->exe == _e_sys_halt_check_exe))
333 e_init_status_set(_("System Check Done"));
334 /* exit_code: 0 == OK, 5 == suid root removed, 7 == group id error
335 * 10 == permission denied, 20 == action undefined */
336 if (ev->exit_code == 0)
339 _e_sys_halt_check_exe = NULL;
342 else if ((_e_sys_reboot_check_exe) && (ev->exe == _e_sys_reboot_check_exe))
344 e_init_status_set(_("System Check Done"));
345 if (ev->exit_code == 0)
347 _e_sys_can_reboot = 1;
348 _e_sys_reboot_check_exe = NULL;
351 else if ((_e_sys_suspend_check_exe) && (ev->exe == _e_sys_suspend_check_exe))
353 e_init_status_set(_("System Check Done"));
354 if (ev->exit_code == 0)
356 _e_sys_can_suspend = 1;
357 _e_sys_suspend_check_exe = NULL;
360 else if ((_e_sys_hibernate_check_exe) && (ev->exe == _e_sys_hibernate_check_exe))
362 e_init_status_set(_("System Check Done"));
363 if (ev->exit_code == 0)
365 _e_sys_can_hibernate = 1;
366 _e_sys_hibernate_check_exe = NULL;
369 return ECORE_CALLBACK_RENEW;
373 _e_sys_cb_logout_logout(void *data __UNUSED__, E_Dialog *dia)
375 if (_e_sys_logout_timer)
377 ecore_timer_del(_e_sys_logout_timer);
378 _e_sys_logout_timer = NULL;
380 _e_sys_logout_begin_time = 0.0;
381 _e_sys_logout_after();
382 e_object_del(E_OBJECT(dia));
383 _e_sys_logout_confirm_dialog = NULL;
387 _e_sys_cb_logout_wait(void *data __UNUSED__, E_Dialog *dia)
389 if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer);
390 _e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL);
391 _e_sys_logout_begin_time = ecore_time_get();
392 e_object_del(E_OBJECT(dia));
393 _e_sys_logout_confirm_dialog = NULL;
397 _e_sys_cb_logout_abort(void *data __UNUSED__, E_Dialog *dia)
399 if (_e_sys_logout_timer)
401 ecore_timer_del(_e_sys_logout_timer);
402 _e_sys_logout_timer = NULL;
404 _e_sys_logout_begin_time = 0.0;
405 e_object_del(E_OBJECT(dia));
406 _e_sys_logout_confirm_dialog = NULL;
407 _e_sys_action_current = E_SYS_NONE;
408 _e_sys_action_after = E_SYS_NONE;
409 _e_sys_action_after_raw = EINA_FALSE;
412 e_object_del(E_OBJECT(_e_sys_dialog));
413 _e_sys_dialog = NULL;
418 _e_sys_logout_confirm_dialog_update(int remaining)
422 if (!_e_sys_logout_confirm_dialog)
424 fputs("ERROR: updating logout confirm dialog, but none exists!\n",
429 snprintf(txt, sizeof(txt),
430 _("Logout is taking too long.<br>"
431 "Some applications refuse to close.<br>"
432 "Do you want to finish the logout<br>"
433 "anyway without closing these<br>"
434 "applications first?<br><br>"
435 "Auto logout in %d seconds."), remaining);
437 e_dialog_text_set(_e_sys_logout_confirm_dialog, txt);
441 _e_sys_cb_logout_timer(void *data __UNUSED__)
447 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
449 if (!bd->internal) pending++;
451 if (pending == 0) goto after;
452 else if (_e_sys_logout_confirm_dialog)
454 int remaining = E_LOGOUT_AUTO_TIME -
455 round(ecore_loop_time_get() - _e_sys_logout_begin_time);
456 /* it has taken 60 (E_LOGOUT_AUTO_TIME) seconds of waiting the
457 * confirm dialog and we still have apps that will not go
458 * away. Do the action as user may be far away or forgot it.
460 * NOTE: this is the behavior for many operating systems and I
461 * guess the reason is people that hit "shutdown" and
462 * put their laptops in their backpacks in the hope
463 * everything will be turned off properly.
467 _e_sys_logout_confirm_dialog_update(remaining);
468 return ECORE_CALLBACK_RENEW;
472 _e_sys_cb_logout_logout(NULL, _e_sys_logout_confirm_dialog);
473 return ECORE_CALLBACK_CANCEL;
478 /* it has taken 15 seconds of waiting and we still have apps that
481 double now = ecore_loop_time_get();
482 if ((now - _e_sys_logout_begin_time) > E_LOGOUT_WAIT_TIME)
486 dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_logout_slow");
489 _e_sys_logout_confirm_dialog = dia;
490 e_dialog_title_set(dia, _("Logout problems"));
491 e_dialog_icon_set(dia, "system-log-out", 64);
492 e_dialog_button_add(dia, _("Logout now"), NULL,
493 _e_sys_cb_logout_logout, NULL);
494 e_dialog_button_add(dia, _("Wait longer"), NULL,
495 _e_sys_cb_logout_wait, NULL);
496 e_dialog_button_add(dia, _("Cancel Logout"), NULL,
497 _e_sys_cb_logout_abort, NULL);
498 e_dialog_button_focus_num(dia, 1);
499 _e_sys_logout_confirm_dialog_update(E_LOGOUT_AUTO_TIME);
500 e_win_centered_set(dia->win, 1);
502 _e_sys_logout_begin_time = now;
504 return ECORE_CALLBACK_RENEW;
507 return ECORE_CALLBACK_RENEW;
509 _e_sys_logout_after();
510 _e_sys_logout_timer = NULL;
511 return ECORE_CALLBACK_CANCEL;
515 _e_sys_logout_after(void)
519 e_object_del(E_OBJECT(_e_sys_dialog));
520 _e_sys_dialog = NULL;
522 _e_sys_action_current = _e_sys_action_after;
523 _e_sys_action_do(_e_sys_action_after, NULL, _e_sys_action_after_raw);
524 _e_sys_action_after = E_SYS_NONE;
525 _e_sys_action_after_raw = EINA_FALSE;
529 _e_sys_logout_begin(E_Sys_Action a_after, Eina_Bool raw)
535 /* start logout - at end do the a_after action */
538 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
539 _("Logout in progress"), "E", "_sys_logout");
540 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
541 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
542 _("Logout in progress.<br>"
543 "<hilight>Please wait.</hilight>"));
544 e_obj_dialog_show(od);
545 e_obj_dialog_icon_set(od, "system-log-out");
546 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
549 _e_sys_action_after = a_after;
550 _e_sys_action_after_raw = raw;
551 EINA_LIST_FOREACH(e_border_client_list(), l, bd)
553 e_border_act_close_begin(bd);
555 /* and poll to see if all pending windows are gone yet every 0.5 sec */
556 _e_sys_logout_begin_time = ecore_time_get();
557 if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer);
558 _e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL);
562 _e_sys_current_action(void)
564 /* display dialog that currently an action is in progress */
567 dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
568 "E", "_sys_error_action_busy");
571 e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
572 e_dialog_icon_set(dia, "enlightenment/sys", 64);
573 switch (_e_sys_action_current)
576 e_dialog_text_set(dia, _("Logging out.<br>"
577 "You cannot perform other system actions<br>"
578 "once a logout has begun."));
583 e_dialog_text_set(dia, _("Powering off.<br>"
584 "You cannot do any other system actions<br>"
585 "once a shutdown has been started."));
589 e_dialog_text_set(dia, _("Resetting.<br>"
590 "You cannot do any other system actions<br>"
591 "once a reboot has begun."));
595 e_dialog_text_set(dia, _("Suspending.<br>"
596 "Until suspend is complete you cannot perform<br>"
597 "any other system actions."));
600 case E_SYS_HIBERNATE:
601 e_dialog_text_set(dia, _("Hibernating.<br>"
602 "You cannot perform any other system actions<br>"
603 "until this is complete."));
607 e_dialog_text_set(dia, _("EEK! This should not happen"));
610 e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
611 e_dialog_button_focus_num(dia, 0);
612 e_win_centered_set(dia->win, 1);
617 _e_sys_action_failed(void)
619 /* display dialog that the current action failed */
622 dia = e_dialog_new(e_container_current_get(e_manager_current_get()),
623 "E", "_sys_error_action_failed");
626 e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
627 e_dialog_icon_set(dia, "enlightenment/sys", 64);
628 switch (_e_sys_action_current)
632 e_dialog_text_set(dia, _("Power off failed."));
636 e_dialog_text_set(dia, _("Reset failed."));
640 e_dialog_text_set(dia, _("Suspend failed."));
643 case E_SYS_HIBERNATE:
644 e_dialog_text_set(dia, _("Hibernate failed."));
648 e_dialog_text_set(dia, _("EEK! This should not happen"));
651 e_dialog_button_add(dia, _("OK"), NULL, NULL, NULL);
652 e_dialog_button_focus_num(dia, 0);
653 e_win_centered_set(dia->win, 1);
658 _e_sys_action_do(E_Sys_Action a, char *param __UNUSED__, Eina_Bool raw)
666 // XXX TODO: check for e_fm_op_registry entries and confirm
667 if (!e_util_immortal_check())
668 ecore_main_loop_quit();
674 // XXX TODO: check for e_fm_op_registry entries and confirm
675 // FIXME: we dont share out immortal info to restarted e. :(
676 // if (!e_util_immortal_check())
679 ecore_main_loop_quit();
690 // XXX TODO: check for e_fm_op_registry entries and confirm
693 _e_sys_logout_begin(E_SYS_EXIT, raw);
697 if (_e_sys_logout_func)
699 _e_sys_logout_func();
704 _e_sys_logout_begin(E_SYS_EXIT, raw);
711 /* shutdown -h now */
712 if (e_util_immortal_check()) return 0;
713 snprintf(buf, sizeof(buf),
714 "%s/enlightenment/utils/enlightenment_sys halt",
718 if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
719 _e_sys_current_action();
726 _e_sys_begin_time = ecore_time_get();
727 _e_sys_exe = ecore_exe_run(buf, NULL);
731 if (_e_sys_shutdown_func)
733 _e_sys_shutdown_func();
738 _e_sys_begin_time = ecore_time_get();
739 _e_sys_exe = ecore_exe_run(buf, NULL);
740 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
741 _("Power off"), "E", "_sys_halt");
742 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
743 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
745 "<hilight>Please wait.</hilight>"));
746 e_obj_dialog_show(od);
747 e_obj_dialog_icon_set(od, "system-shutdown");
748 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
749 e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
753 /* FIXME: display halt status */
758 /* shutdown -r now */
759 if (e_util_immortal_check()) return 0;
760 snprintf(buf, sizeof(buf),
761 "%s/enlightenment/utils/enlightenment_sys reboot",
765 if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
766 _e_sys_current_action();
773 _e_sys_begin_time = ecore_time_get();
774 _e_sys_exe = ecore_exe_run(buf, NULL);
778 if (_e_sys_reboot_func)
780 _e_sys_reboot_func();
785 _e_sys_begin_time = ecore_time_get();
786 _e_sys_exe = ecore_exe_run(buf, NULL);
787 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
788 _("Resetting"), "E", "_sys_reboot");
789 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
790 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
792 "<hilight>Please wait.</hilight>"));
793 e_obj_dialog_show(od);
794 e_obj_dialog_icon_set(od, "system-restart");
795 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
796 e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
800 /* FIXME: display reboot status */
805 /* /etc/acpi/sleep.sh force */
806 snprintf(buf, sizeof(buf),
807 "%s/enlightenment/utils/enlightenment_sys suspend",
811 if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
812 _e_sys_current_action();
819 _e_sys_susp_hib_check();
820 if (e_config->desklock_on_suspend)
821 e_desklock_show(EINA_TRUE);
822 _e_sys_begin_time = ecore_time_get();
823 _e_sys_exe = ecore_exe_run(buf, NULL);
827 if (_e_sys_suspend_func)
829 _e_sys_suspend_func();
834 if (e_config->desklock_on_suspend)
835 e_desklock_show(EINA_TRUE);
837 _e_sys_susp_hib_check();
839 _e_sys_begin_time = ecore_time_get();
840 _e_sys_exe = ecore_exe_run(buf, NULL);
841 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
842 _("Suspending"), "E", "_sys_suspend");
843 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
844 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
846 "<hilight>Please wait.</hilight>"));
847 e_obj_dialog_show(od);
848 e_obj_dialog_icon_set(od, "system-suspend");
849 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
850 e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
854 /* FIXME: display suspend status */
858 case E_SYS_HIBERNATE:
859 /* /etc/acpi/hibernate.sh force */
860 snprintf(buf, sizeof(buf),
861 "%s/enlightenment/utils/enlightenment_sys hibernate",
865 if ((ecore_time_get() - _e_sys_begin_time) > 2.0)
866 _e_sys_current_action();
871 if (_e_sys_hibernate_func)
873 _e_sys_hibernate_func();
880 if (e_config->desklock_on_suspend)
881 e_desklock_show(EINA_TRUE);
883 _e_sys_susp_hib_check();
884 _e_sys_begin_time = ecore_time_get();
885 _e_sys_exe = ecore_exe_run(buf, NULL);
889 if (e_config->desklock_on_suspend)
890 e_desklock_show(EINA_TRUE);
892 _e_sys_susp_hib_check();
894 _e_sys_begin_time = ecore_time_get();
895 _e_sys_exe = ecore_exe_run(buf, NULL);
896 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
897 _("Hibernating"), "E", "_sys_hibernate");
898 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
899 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
901 "<hilight>Please wait.</hilight>"));
902 e_obj_dialog_show(od);
903 e_obj_dialog_icon_set(od, "system-suspend-hibernate");
904 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
906 e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
909 /* FIXME: display hibernate status */
920 _e_sys_dialog_cb_delete(E_Obj_Dialog *od __UNUSED__)
922 /* If we don't NULL out the _e_sys_dialog, then the
923 * ECORE_EXE_EVENT_DEL callback will trigger and segv if the window
924 * is deleted in some other way. */
925 _e_sys_dialog = NULL;