forked from enlightenment/enlightenment
exit and restart actions. are you sure exit dialog. :)
SVN revision: 16765
This commit is contained in:
parent
abba9ff511
commit
da7300c038
|
@ -10,7 +10,7 @@ styles
|
|||
{
|
||||
style {
|
||||
name: "dialog_style";
|
||||
base: "font=Edje-Vera font_size=10 align=left color=#000 style=shadow shadow_color=#ffffff80 wrap=word";
|
||||
base: "font=Edje-Vera font_size=10 align=center color=#000 style=shadow shadow_color=#ffffff80 wrap=word";
|
||||
|
||||
tag: "br" "\n";
|
||||
tag: "hilight" "+ font=Edje-Vera-Bold style=glow color=#fff glow2_color=#fe87 glow_color=#fa14";
|
||||
|
@ -319,6 +319,12 @@ group {
|
|||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
offset: 8 8;
|
||||
}
|
||||
rel2 {
|
||||
offset: -9 -9;
|
||||
}
|
||||
text {
|
||||
style: "dialog_style";
|
||||
min: 1 1;
|
||||
|
|
|
@ -887,6 +887,38 @@ ACT_FN_GO(edit_mode_toggle)
|
|||
e_gadman_mode_set(((E_Container *)obj)->gadman, E_GADMAN_MODE_NORMAL);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
static void
|
||||
_e_actions_cb_exit_dialog_ok(void *data, E_Dialog *dia)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
ACT_FN_GO(exit)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
|
||||
dia = e_dialog_new(e_container_current_get(e_manager_current_get()));
|
||||
e_dialog_title_set(dia, _("Are you sure you want to exit?"));
|
||||
e_dialog_text_set(dia,
|
||||
_("You requested to exit Enlightenment.<br>"
|
||||
"<br>"
|
||||
"Are you sure you want to exit?"
|
||||
));
|
||||
e_dialog_icon_set(dia, "enlightenment/exit", 32);
|
||||
e_dialog_button_add(dia, _("Yes"), NULL, _e_actions_cb_exit_dialog_ok, NULL);
|
||||
e_dialog_button_add(dia, _("No"), NULL, NULL, NULL);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
e_dialog_show(dia);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
ACT_FN_GO(restart)
|
||||
{
|
||||
restart = 1;
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_Hash *actions = NULL;
|
||||
|
||||
|
@ -958,6 +990,9 @@ e_actions_init(void)
|
|||
|
||||
ACT_GO(edit_mode_toggle);
|
||||
|
||||
ACT_GO(restart);
|
||||
ACT_GO(exit);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -908,14 +908,23 @@ e_config_init(void)
|
|||
eb->params = strdup("");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
/* should do these - can't yet due to other things missing... */
|
||||
eb = E_NEW(E_Config_Binding_Key, 1);
|
||||
eb->context = E_BINDING_CONTEXT_ANY;
|
||||
eb->key = strdup("End");
|
||||
eb->modifiers = E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT;
|
||||
eb->any_mod = 0;
|
||||
eb->action = strdup("restart");
|
||||
eb->params = strdup("");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
/* need a yes/no dialog for these - to stop accidental logouts. for this
|
||||
* i'd make a special case that can ask u to log out, restart or shut down
|
||||
* or even reboot (if you have permissions to do so)
|
||||
*/
|
||||
/* CTRL+ALT Delete - logout */
|
||||
/* CTRL+ALT End - restart */
|
||||
eb = E_NEW(E_Config_Binding_Key, 1);
|
||||
eb->context = E_BINDING_CONTEXT_ANY;
|
||||
eb->key = strdup("Delete");
|
||||
eb->modifiers = E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT;
|
||||
eb->any_mod = 0;
|
||||
eb->action = strdup("exit");
|
||||
eb->params = strdup("");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
/* need to support fullscreen anyway for this - ie netwm and the border
|
||||
* system need to handle this as well as possibly using xrandr/xvidmode
|
||||
|
|
|
@ -129,13 +129,13 @@ e_dialog_text_set(E_Dialog *dia, char *text)
|
|||
}
|
||||
|
||||
void
|
||||
e_dialog_icon_set(E_Dialog *dia, char *icon)
|
||||
e_dialog_icon_set(E_Dialog *dia, char *icon, Evas_Coord size)
|
||||
{
|
||||
if (icon)
|
||||
{
|
||||
dia->icon_object = edje_object_add(e_win_evas_get(dia->win));
|
||||
e_util_edje_icon_set(dia->icon_object, icon);
|
||||
edje_extern_object_min_size_set(dia->icon_object, 64, 64);
|
||||
edje_extern_object_min_size_set(dia->icon_object, size, size);
|
||||
edje_object_part_swallow(dia->bg_object, "icon_swallow", dia->icon_object);
|
||||
evas_object_show(dia->icon_object);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ EAPI E_Dialog *e_dialog_new (E_Container *con);
|
|||
EAPI void e_dialog_button_add (E_Dialog *dia, char *label, char *icon, void (*func) (void *data, E_Dialog *dia), void *data);
|
||||
EAPI void e_dialog_title_set (E_Dialog *dia, char *title);
|
||||
EAPI void e_dialog_text_set (E_Dialog *dia, char *text);
|
||||
EAPI void e_dialog_icon_set (E_Dialog *dia, char *icon);
|
||||
EAPI void e_dialog_icon_set (E_Dialog *dia, char *icon, Evas_Coord size);
|
||||
EAPI void e_dialog_show (E_Dialog *dia);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -319,7 +319,11 @@ _e_int_menus_quit(void)
|
|||
static void
|
||||
_e_int_menus_quit_cb(void *data)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
E_Action *a;
|
||||
|
||||
a = e_action_find("exit");
|
||||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
_e_int_menus_quit_job = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -369,8 +373,10 @@ _e_int_menus_main_run(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
static void
|
||||
_e_int_menus_main_restart(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
restart = 1;
|
||||
_e_int_menus_quit();
|
||||
E_Action *a;
|
||||
|
||||
a = e_action_find("restart");
|
||||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -300,10 +300,11 @@ _e_test_internal(E_Container *con)
|
|||
e_object_del_attach_func_set(E_OBJECT(dia), _e_test_dialog_del);
|
||||
e_dialog_title_set(dia, "A Test Dialog");
|
||||
e_dialog_text_set(dia, "A Test Dialog<br>And another line<br><hilight>Hilighted Text</hilight>");
|
||||
e_dialog_icon_set(dia, "enlightenment/modules");
|
||||
e_dialog_icon_set(dia, "enlightenment/modules", 64);
|
||||
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
|
||||
e_dialog_button_add(dia, "Apply", "enlightenment/reset", NULL, NULL);
|
||||
e_dialog_button_add(dia, "Cancel", "enlightenment/exit", NULL, NULL);
|
||||
e_win_centered_set(dia->win);
|
||||
e_dialog_show(dia);
|
||||
}
|
||||
#elif 0
|
||||
|
|
Loading…
Reference in New Issue