forked from enlightenment/enlightenment
parent
4c71e24970
commit
4aec08c398
|
@ -45,10 +45,17 @@ e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_cl
|
|||
od->bg_object = o;
|
||||
|
||||
e_win_centered_set(od->win, 1);
|
||||
od->cb_delete = NULL;
|
||||
|
||||
return od;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_obj_dialog_cb_delete_set(E_Obj_Dialog *od, void (*func)(E_Obj_Dialog *od))
|
||||
{
|
||||
od->cb_delete = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon)
|
||||
{
|
||||
|
@ -116,6 +123,8 @@ _e_obj_dialog_cb_delete(E_Win *win)
|
|||
E_Obj_Dialog *od;
|
||||
|
||||
od = win->data;
|
||||
if (od->cb_delete)
|
||||
od->cb_delete(od);
|
||||
e_object_del(E_OBJECT(od));
|
||||
}
|
||||
|
||||
|
@ -125,5 +134,7 @@ _e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const
|
|||
E_Obj_Dialog *od;
|
||||
|
||||
od = data;
|
||||
if (od->cb_delete)
|
||||
od->cb_delete(od);
|
||||
e_object_del(E_OBJECT(od));
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ struct _E_Obj_Dialog
|
|||
E_Win *win;
|
||||
Evas_Object *bg_object;
|
||||
void *data;
|
||||
void (*cb_delete)(E_Obj_Dialog *od);
|
||||
};
|
||||
|
||||
EAPI E_Obj_Dialog *e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class);
|
||||
|
@ -25,6 +26,7 @@ EAPI void e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon);
|
|||
EAPI void e_obj_dialog_show(E_Obj_Dialog *od);
|
||||
EAPI void e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text);
|
||||
EAPI void e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj);
|
||||
EAPI void e_obj_dialog_cb_delete_set(E_Obj_Dialog *od, void (*func)(E_Obj_Dialog *od));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@ static void _e_sys_logout_begin(E_Sys_Action a_after);
|
|||
static void _e_sys_current_action(void);
|
||||
static void _e_sys_action_failed(void);
|
||||
static int _e_sys_action_do(E_Sys_Action a, char *param);
|
||||
static void _e_sys_dialog_cb_delete(E_Obj_Dialog * od);
|
||||
|
||||
static Ecore_Event_Handler *_e_sys_exe_exit_handler = NULL;
|
||||
static Ecore_Exe *_e_sys_halt_check_exe = NULL;
|
||||
|
@ -482,6 +483,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
e_obj_dialog_show(od);
|
||||
e_obj_dialog_icon_set(od, "enlightenment/halt");
|
||||
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
|
||||
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
|
||||
_e_sys_dialog = od;
|
||||
/* FIXME: display halt status */
|
||||
}
|
||||
|
@ -508,6 +510,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
e_obj_dialog_show(od);
|
||||
e_obj_dialog_icon_set(od, "enlightenment/reboot");
|
||||
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
|
||||
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
|
||||
_e_sys_dialog = od;
|
||||
/* FIXME: display reboot status */
|
||||
}
|
||||
|
@ -533,6 +536,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
e_obj_dialog_show(od);
|
||||
e_obj_dialog_icon_set(od, "enlightenment/suspend");
|
||||
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
|
||||
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
|
||||
_e_sys_dialog = od;
|
||||
/* FIXME: display suspend status */
|
||||
}
|
||||
|
@ -559,6 +563,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
e_obj_dialog_icon_set(od, "enlightenment/hibernate");
|
||||
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
|
||||
_e_sys_dialog = od;
|
||||
e_obj_dialog_cb_delete_set(od, _e_sys_dialog_cb_delete);
|
||||
/* FIXME: display hibernate status */
|
||||
}
|
||||
break;
|
||||
|
@ -567,3 +572,11 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _e_sys_dialog_cb_delete(E_Obj_Dialog * od)
|
||||
{
|
||||
/* If we don't NULL out the _e_sys_dialog, then the
|
||||
* ECORE_EXE_EVENT_DEL callback will trigger and segv if the window
|
||||
* is deleted in some other way. */
|
||||
_e_sys_dialog = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue