sys actions have status/info/progress dialogs that should work right for all

actions (so you know what is going on and have some feedback/status).


SVN revision: 25670
This commit is contained in:
Carsten Haitzler 2006-09-10 04:51:07 +00:00
parent a2691b6c1e
commit 71be7e7882
14 changed files with 1457 additions and 18 deletions

View File

@ -56,7 +56,8 @@ default_shelf.edc \
default_preview.edc \
default_cslider.edc \
default_spectrum.edc \
default_color_well.edc
default_color_well.edc \
default_sys.edc
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \

View File

@ -74,5 +74,6 @@ collections {
#include "default_cslider.edc"
#include "default_spectrum.edc"
#include "default_color_well.edc"
#include "default_sys.edc"
}

1210
data/themes/default_sys.edc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -171,6 +171,7 @@ e_int_config_wallpaper_gradient.h \
e_color_dialog.h \
e_fdo_menu_to_order.h \
e_sys.h \
e_obj_dialog.h \
e_int_config_transitions.h
enlightenment_src = \
@ -317,6 +318,7 @@ e_color_dialog.c \
e_fdo_menu_to_order.c \
e_sys.c \
e_int_config_transitions.c \
e_obj_dialog.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

View File

@ -9,7 +9,7 @@ typedef struct _E_About E_About;
#ifndef E_ABOUT_H
#define E_ABOUT_H
#define E_ABOUT_TYPE 0xE0b01013
#define E_ABOUT_TYPE 0xE0b0101a
struct _E_About
{

View File

@ -9,7 +9,7 @@ typedef struct _E_Color_Dialog E_Color_Dialog;
#ifndef E_COLOR_DIALOG_H
#define E_COLOR_DIALOG_H
#define E_COLOR_DIALOG_TYPE 0xE0b01026
#define E_COLOR_DIALOG_TYPE 0xE0b0101c
struct _E_Color_Dialog
{

View File

@ -9,7 +9,7 @@ typedef struct _E_Entry_Dialog E_Entry_Dialog;
#ifndef E_ENTRY_DIALOG_H
#define E_ENTRY_DIALOG_H
#define E_ENTRY_DIALOG_TYPE 0xE0b01025
#define E_ENTRY_DIALOG_TYPE 0xE0b0101d
struct _E_Entry_Dialog
{

View File

@ -9,7 +9,7 @@ typedef struct _E_File_Dialog E_File_Dialog;
#ifndef E_FILE_DIALOG_H
#define E_FILE_DIALOG_H
#define E_FILE_DIALOG_TYPE 0xE0b01020
#define E_FILE_DIALOG_TYPE 0xE0b0101f
struct _E_File_Dialog
{

View File

@ -40,8 +40,8 @@ typedef struct _E_Gadcon_Client_Class E_Gadcon_Client_Class;
#ifndef E_GADCON_H
#define E_GADCON_H
#define E_GADCON_TYPE 0xE0b01022
#define E_GADCON_CLIENT_TYPE 0xE0b01023
#define E_GADCON_TYPE 0xE0b01006
#define E_GADCON_CLIENT_TYPE 0xE0b01007
struct _E_Gadcon
{

View File

@ -146,3 +146,4 @@
#include "e_fdo_menu_to_order.h"
#include "e_sys.h"
#include "e_int_config_transitions.h"
#include "e_obj_dialog.h"

129
src/bin/e_obj_dialog.c Normal file
View File

@ -0,0 +1,129 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/* local subsystem functions */
static void _e_obj_dialog_free(E_Obj_Dialog *od);
static void _e_obj_dialog_cb_delete(E_Win *win);
static void _e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
/* local subsystem globals */
/* externally accessible functions */
EAPI E_Obj_Dialog *
e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
{
E_Obj_Dialog *od;
E_Manager *man;
Evas_Object *o;
if (!con)
{
man = e_manager_current_get();
if (!man) return NULL;
con = e_container_current_get(man);
if (!con) con = e_container_number_get(man, 0);
if (!con) return NULL;
}
od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_free);
if (!od) return NULL;
od->win = e_win_new(con);
if (!od->win)
{
free(od);
return NULL;
}
e_win_delete_callback_set(od->win, _e_obj_dialog_cb_delete);
od->win->data = od;
e_win_dialog_set(od->win, 1);
e_win_name_class_set(od->win, class_name, class_class);
e_win_title_set(od->win, title);
o = edje_object_add(e_win_evas_get(od->win));
od->bg_object = o;
e_win_centered_set(od->win, 1);
return od;
}
EAPI void
e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
if (od->win->border->internal_icon)
{
evas_stringshare_del(od->win->border->internal_icon);
od->win->border->internal_icon = NULL;
}
if (icon)
od->win->border->internal_icon = evas_stringshare_add(icon);
}
EAPI void
e_obj_dialog_show(E_Obj_Dialog *od)
{
Evas_Coord mw, mh, w, h;
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
edje_object_size_min_calc(od->bg_object, &mw, &mh);
evas_object_resize(od->bg_object, mw, mh);
e_win_resize(od->win, mw, mh);
e_win_size_min_set(od->win, mw, mh);
e_win_size_max_set(od->win, mw, mh);
e_win_show(od->win);
}
EAPI void
e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
edje_object_part_text_set(od->bg_object, part, text);
}
EAPI void
e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj)
{
E_OBJECT_CHECK(od);
E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
e_theme_edje_object_set(od->bg_object, theme_cat, theme_obj);
evas_object_move(od->bg_object, 0, 0);
evas_object_show(od->bg_object);
edje_object_signal_callback_add(od->bg_object, "e,action,close", "",
_e_obj_dialog_cb_close, od);
}
/* local subsystem functions */
static void
_e_obj_dialog_free(E_Obj_Dialog *od)
{
if (od->bg_object) evas_object_del(od->bg_object);
e_object_del(E_OBJECT(od->win));
free(od);
}
static void
_e_obj_dialog_cb_delete(E_Win *win)
{
E_Obj_Dialog *od;
od = win->data;
e_object_del(E_OBJECT(od));
}
static void
_e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_Obj_Dialog *od;
od = data;
e_object_del(E_OBJECT(od));
}

30
src/bin/e_obj_dialog.h Normal file
View File

@ -0,0 +1,30 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_Obj_Dialog E_Obj_Dialog;
#else
#ifndef E_OBJ_DIALOG_H
#define E_OBJ_DIALOG_H
#define E_OBJ_DIALOG_TYPE 0xE0b0101b
struct _E_Obj_Dialog
{
E_Object e_obj_inherit;
E_Win *win;
Evas_Object *bg_object;
void *data;
};
EAPI E_Obj_Dialog *e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class);
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);
#endif
#endif

View File

@ -9,7 +9,7 @@ typedef struct _E_Shelf E_Shelf;
#ifndef E_SHELF_H
#define E_SHELF_H
#define E_SHELF_TYPE 0xE0b01024
#define E_SHELF_TYPE 0xE0b0101e
struct _E_Shelf
{

View File

@ -30,6 +30,7 @@ static E_Sys_Action _e_sys_action_after = E_SYS_NONE;
static Ecore_Exe *_e_sys_exe = NULL;
static double _e_sys_logout_begin_time = 0.0;
static Ecore_Timer *_e_sys_logout_timer = NULL;
static E_Obj_Dialog *_e_sys_dialog = NULL;
/* externally accessible functions */
EAPI int
@ -134,11 +135,18 @@ _e_sys_cb_exit(void *data, int type, void *event)
if ((_e_sys_exe) && (ev->exe == _e_sys_exe))
{
if (ev->exit_code != 0) _e_sys_action_failed();
if (((_e_sys_action_current != E_SYS_HALT) &&
(_e_sys_action_current != E_SYS_REBOOT)) ||
(ev->exit_code != 0))
{
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
}
_e_sys_action_current = E_SYS_NONE;
_e_sys_exe = NULL;
/* if we have a suspend or hibernate status popup/dialog - close it
* here as we have finished suspend/hibernate (and probably just
* came back out of suspend/hibernate */
return 1;
}
if ((_e_sys_halt_check_exe) && (ev->exe == _e_sys_halt_check_exe))
@ -212,6 +220,11 @@ _e_sys_cb_logout_abort(void *data, E_Dialog *dia)
e_object_del(E_OBJECT(dia));
_e_sys_action_current = E_SYS_NONE;
_e_sys_action_after = E_SYS_NONE;
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
}
static int
@ -255,7 +268,7 @@ _e_sys_cb_logout_timer(void *data)
e_dialog_button_focus_num(dia, 1);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
_e_sys_logout_begin_time = ecore_time_get() + (60 * 60 * 24 * 365);
_e_sys_logout_begin_time = 0.0;
}
_e_sys_logout_timer = NULL;
return 0;
@ -271,8 +284,13 @@ _e_sys_cb_logout_timer(void *data)
static void
_e_sys_logout_after(void)
{
if (_e_sys_dialog)
{
e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = NULL;
}
_e_sys_action_current = _e_sys_action_after;
_e_sys_action_do(_e_sys_action_after, NULL);
_e_sys_action_current = E_SYS_NONE;
_e_sys_action_after = E_SYS_NONE;
}
@ -280,14 +298,20 @@ static void
_e_sys_logout_begin(E_Sys_Action a_after)
{
Evas_List *l;
E_Obj_Dialog *od;
/* start logout - at end do the a_after action */
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Logout in progress"), "E", "_sys_logout");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Logout is currently in progress.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "enlightenment/logout");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
_e_sys_action_after = a_after;
/* FIXME: go through to every window and if it wants delete req - ask
* it to delete, otherwise just close it. set handler for window
* deletes, and once all windows are deleted - exit, OR if a timer
* expires - pop up dialog saying something is not responding
*/
for (l = e_border_client_list(); l; l = l->next)
{
E_Border *bd;
@ -410,6 +434,7 @@ static int
_e_sys_action_do(E_Sys_Action a, char *param)
{
char buf[4096];
E_Obj_Dialog *od;
switch (a)
{
@ -439,6 +464,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
else
{
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Shutting down"), "E", "_sys_halt");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Shutting down your Computer.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "enlightenment/logout");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
/* FIXME: display halt status */
}
break;
@ -455,6 +490,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
else
{
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Rebooting"), "E", "_sys_reboot");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Rebooting your Computer.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "enlightenment/logout");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
/* FIXME: display reboot status */
}
break;
@ -470,6 +515,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
else
{
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Suspending"), "E", "_sys_suspend");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Suspending your Computer.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "enlightenment/logout");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
/* FIXME: display suspend status */
}
break;
@ -485,6 +540,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
else
{
_e_sys_exe = ecore_exe_run(buf, NULL);
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
_("Hibernating"), "E", "_sys_hibernate");
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
_("Hibernating your Computer.<br>"
"<hilight>Please wait.</hilight>"));
e_obj_dialog_show(od);
e_obj_dialog_icon_set(od, "enlightenment/logout");
if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
_e_sys_dialog = od;
/* FIXME: display hibernate status */
}
break;