summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2006-09-10 04:51:07 +0000
committerCarsten Haitzler <raster@rasterman.com>2006-09-10 04:51:07 +0000
commit71be7e7882046f53831a8f4101014b516846dd26 (patch)
treefd2a3a8bfa175491919b61b3cd110615b960e792 /src/bin
parenta2691b6c1eabdfd036b57ad971164cb35fcb513c (diff)
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/Makefile.am2
-rw-r--r--src/bin/e_about.h2
-rw-r--r--src/bin/e_color_dialog.h2
-rw-r--r--src/bin/e_entry_dialog.h2
-rw-r--r--src/bin/e_file_dialog.h2
-rw-r--r--src/bin/e_gadcon.h4
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_obj_dialog.c129
-rw-r--r--src/bin/e_obj_dialog.h30
-rw-r--r--src/bin/e_shelf.h2
-rw-r--r--src/bin/e_sys.c85
11 files changed, 244 insertions, 17 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index eb45291..7488101 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -171,6 +171,7 @@ e_int_config_wallpaper_gradient.h \
171e_color_dialog.h \ 171e_color_dialog.h \
172e_fdo_menu_to_order.h \ 172e_fdo_menu_to_order.h \
173e_sys.h \ 173e_sys.h \
174e_obj_dialog.h \
174e_int_config_transitions.h 175e_int_config_transitions.h
175 176
176enlightenment_src = \ 177enlightenment_src = \
@@ -317,6 +318,7 @@ e_color_dialog.c \
317e_fdo_menu_to_order.c \ 318e_fdo_menu_to_order.c \
318e_sys.c \ 319e_sys.c \
319e_int_config_transitions.c \ 320e_int_config_transitions.c \
321e_obj_dialog.c \
320$(ENLIGHTENMENTHEADERS) 322$(ENLIGHTENMENTHEADERS)
321 323
322enlightenment_SOURCES = \ 324enlightenment_SOURCES = \
diff --git a/src/bin/e_about.h b/src/bin/e_about.h
index f73404f..1fc76ce 100644
--- a/src/bin/e_about.h
+++ b/src/bin/e_about.h
@@ -9,7 +9,7 @@ typedef struct _E_About E_About;
9#ifndef E_ABOUT_H 9#ifndef E_ABOUT_H
10#define E_ABOUT_H 10#define E_ABOUT_H
11 11
12#define E_ABOUT_TYPE 0xE0b01013 12#define E_ABOUT_TYPE 0xE0b0101a
13 13
14struct _E_About 14struct _E_About
15{ 15{
diff --git a/src/bin/e_color_dialog.h b/src/bin/e_color_dialog.h
index 5616ccf..0311f0b 100644
--- a/src/bin/e_color_dialog.h
+++ b/src/bin/e_color_dialog.h
@@ -9,7 +9,7 @@ typedef struct _E_Color_Dialog E_Color_Dialog;
9#ifndef E_COLOR_DIALOG_H 9#ifndef E_COLOR_DIALOG_H
10#define E_COLOR_DIALOG_H 10#define E_COLOR_DIALOG_H
11 11
12#define E_COLOR_DIALOG_TYPE 0xE0b01026 12#define E_COLOR_DIALOG_TYPE 0xE0b0101c
13 13
14struct _E_Color_Dialog 14struct _E_Color_Dialog
15{ 15{
diff --git a/src/bin/e_entry_dialog.h b/src/bin/e_entry_dialog.h
index f6603d9..2224938 100644
--- a/src/bin/e_entry_dialog.h
+++ b/src/bin/e_entry_dialog.h
@@ -9,7 +9,7 @@ typedef struct _E_Entry_Dialog E_Entry_Dialog;
9#ifndef E_ENTRY_DIALOG_H 9#ifndef E_ENTRY_DIALOG_H
10#define E_ENTRY_DIALOG_H 10#define E_ENTRY_DIALOG_H
11 11
12#define E_ENTRY_DIALOG_TYPE 0xE0b01025 12#define E_ENTRY_DIALOG_TYPE 0xE0b0101d
13 13
14struct _E_Entry_Dialog 14struct _E_Entry_Dialog
15{ 15{
diff --git a/src/bin/e_file_dialog.h b/src/bin/e_file_dialog.h
index 855d4c6..4cd99f5 100644
--- a/src/bin/e_file_dialog.h
+++ b/src/bin/e_file_dialog.h
@@ -9,7 +9,7 @@ typedef struct _E_File_Dialog E_File_Dialog;
9#ifndef E_FILE_DIALOG_H 9#ifndef E_FILE_DIALOG_H
10#define E_FILE_DIALOG_H 10#define E_FILE_DIALOG_H
11 11
12#define E_FILE_DIALOG_TYPE 0xE0b01020 12#define E_FILE_DIALOG_TYPE 0xE0b0101f
13 13
14struct _E_File_Dialog 14struct _E_File_Dialog
15{ 15{
diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h
index 7c4d8e1..51ed495 100644
--- a/src/bin/e_gadcon.h
+++ b/src/bin/e_gadcon.h
@@ -40,8 +40,8 @@ typedef struct _E_Gadcon_Client_Class E_Gadcon_Client_Class;
40#ifndef E_GADCON_H 40#ifndef E_GADCON_H
41#define E_GADCON_H 41#define E_GADCON_H
42 42
43#define E_GADCON_TYPE 0xE0b01022 43#define E_GADCON_TYPE 0xE0b01006
44#define E_GADCON_CLIENT_TYPE 0xE0b01023 44#define E_GADCON_CLIENT_TYPE 0xE0b01007
45 45
46struct _E_Gadcon 46struct _E_Gadcon
47{ 47{
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index d9a6075..3bfdaae 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -146,3 +146,4 @@
146#include "e_fdo_menu_to_order.h" 146#include "e_fdo_menu_to_order.h"
147#include "e_sys.h" 147#include "e_sys.h"
148#include "e_int_config_transitions.h" 148#include "e_int_config_transitions.h"
149#include "e_obj_dialog.h"
diff --git a/src/bin/e_obj_dialog.c b/src/bin/e_obj_dialog.c
new file mode 100644
index 0000000..7217208
--- /dev/null
+++ b/src/bin/e_obj_dialog.c
@@ -0,0 +1,129 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#include "e.h"
5
6/* local subsystem functions */
7static void _e_obj_dialog_free(E_Obj_Dialog *od);
8static void _e_obj_dialog_cb_delete(E_Win *win);
9static void _e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source);
10
11/* local subsystem globals */
12
13/* externally accessible functions */
14
15EAPI E_Obj_Dialog *
16e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
17{
18 E_Obj_Dialog *od;
19 E_Manager *man;
20 Evas_Object *o;
21
22 if (!con)
23 {
24 man = e_manager_current_get();
25 if (!man) return NULL;
26 con = e_container_current_get(man);
27 if (!con) con = e_container_number_get(man, 0);
28 if (!con) return NULL;
29 }
30 od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_free);
31 if (!od) return NULL;
32 od->win = e_win_new(con);
33 if (!od->win)
34 {
35 free(od);
36 return NULL;
37 }
38 e_win_delete_callback_set(od->win, _e_obj_dialog_cb_delete);
39 od->win->data = od;
40 e_win_dialog_set(od->win, 1);
41 e_win_name_class_set(od->win, class_name, class_class);
42 e_win_title_set(od->win, title);
43
44 o = edje_object_add(e_win_evas_get(od->win));
45 od->bg_object = o;
46
47 e_win_centered_set(od->win, 1);
48
49 return od;
50}
51
52EAPI void
53e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon)
54{
55 E_OBJECT_CHECK(od);
56 E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
57 if (od->win->border->internal_icon)
58 {
59 evas_stringshare_del(od->win->border->internal_icon);
60 od->win->border->internal_icon = NULL;
61 }
62 if (icon)
63 od->win->border->internal_icon = evas_stringshare_add(icon);
64}
65
66EAPI void
67e_obj_dialog_show(E_Obj_Dialog *od)
68{
69 Evas_Coord mw, mh, w, h;
70
71 E_OBJECT_CHECK(od);
72 E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
73
74 edje_object_size_min_calc(od->bg_object, &mw, &mh);
75 evas_object_resize(od->bg_object, mw, mh);
76 e_win_resize(od->win, mw, mh);
77 e_win_size_min_set(od->win, mw, mh);
78 e_win_size_max_set(od->win, mw, mh);
79
80 e_win_show(od->win);
81}
82
83EAPI void
84e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text)
85{
86 E_OBJECT_CHECK(od);
87 E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
88 edje_object_part_text_set(od->bg_object, part, text);
89}
90
91EAPI void
92e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj)
93{
94 E_OBJECT_CHECK(od);
95 E_OBJECT_TYPE_CHECK(od, E_OBJ_DIALOG_TYPE);
96
97 e_theme_edje_object_set(od->bg_object, theme_cat, theme_obj);
98 evas_object_move(od->bg_object, 0, 0);
99 evas_object_show(od->bg_object);
100 edje_object_signal_callback_add(od->bg_object, "e,action,close", "",
101 _e_obj_dialog_cb_close, od);
102}
103
104/* local subsystem functions */
105static void
106_e_obj_dialog_free(E_Obj_Dialog *od)
107{
108 if (od->bg_object) evas_object_del(od->bg_object);
109 e_object_del(E_OBJECT(od->win));
110 free(od);
111}
112
113static void
114_e_obj_dialog_cb_delete(E_Win *win)
115{
116 E_Obj_Dialog *od;
117
118 od = win->data;
119 e_object_del(E_OBJECT(od));
120}
121
122static void
123_e_obj_dialog_cb_close(void *data, Evas_Object *obj, const char *emission, const char *source)
124{
125 E_Obj_Dialog *od;
126
127 od = data;
128 e_object_del(E_OBJECT(od));
129}
diff --git a/src/bin/e_obj_dialog.h b/src/bin/e_obj_dialog.h
new file mode 100644
index 0000000..9f6728f
--- /dev/null
+++ b/src/bin/e_obj_dialog.h
@@ -0,0 +1,30 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#ifdef E_TYPEDEFS
5
6typedef struct _E_Obj_Dialog E_Obj_Dialog;
7
8#else
9#ifndef E_OBJ_DIALOG_H
10#define E_OBJ_DIALOG_H
11
12#define E_OBJ_DIALOG_TYPE 0xE0b0101b
13
14struct _E_Obj_Dialog
15{
16 E_Object e_obj_inherit;
17
18 E_Win *win;
19 Evas_Object *bg_object;
20 void *data;
21};
22
23EAPI E_Obj_Dialog *e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class);
24EAPI void e_obj_dialog_icon_set(E_Obj_Dialog *od, char *icon);
25EAPI void e_obj_dialog_show(E_Obj_Dialog *od);
26EAPI void e_obj_dialog_obj_part_text_set(E_Obj_Dialog *od, char *part, char *text);
27EAPI void e_obj_dialog_obj_theme_set(E_Obj_Dialog *od, char *theme_cat, char *theme_obj);
28
29#endif
30#endif
diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h
index 0915635..66cbdea 100644
--- a/src/bin/e_shelf.h
+++ b/src/bin/e_shelf.h
@@ -9,7 +9,7 @@ typedef struct _E_Shelf E_Shelf;
9#ifndef E_SHELF_H 9#ifndef E_SHELF_H
10#define E_SHELF_H 10#define E_SHELF_H
11 11
12#define E_SHELF_TYPE 0xE0b01024 12#define E_SHELF_TYPE 0xE0b0101e
13 13
14struct _E_Shelf 14struct _E_Shelf
15{ 15{
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 427ec12..3ff0027 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -30,6 +30,7 @@ static E_Sys_Action _e_sys_action_after = E_SYS_NONE;
30static Ecore_Exe *_e_sys_exe = NULL; 30static Ecore_Exe *_e_sys_exe = NULL;
31static double _e_sys_logout_begin_time = 0.0; 31static double _e_sys_logout_begin_time = 0.0;
32static Ecore_Timer *_e_sys_logout_timer = NULL; 32static Ecore_Timer *_e_sys_logout_timer = NULL;
33static E_Obj_Dialog *_e_sys_dialog = NULL;
33 34
34/* externally accessible functions */ 35/* externally accessible functions */
35EAPI int 36EAPI int
@@ -134,11 +135,18 @@ _e_sys_cb_exit(void *data, int type, void *event)
134 if ((_e_sys_exe) && (ev->exe == _e_sys_exe)) 135 if ((_e_sys_exe) && (ev->exe == _e_sys_exe))
135 { 136 {
136 if (ev->exit_code != 0) _e_sys_action_failed(); 137 if (ev->exit_code != 0) _e_sys_action_failed();
138 if (((_e_sys_action_current != E_SYS_HALT) &&
139 (_e_sys_action_current != E_SYS_REBOOT)) ||
140 (ev->exit_code != 0))
141 {
142 if (_e_sys_dialog)
143 {
144 e_object_del(E_OBJECT(_e_sys_dialog));
145 _e_sys_dialog = NULL;
146 }
147 }
137 _e_sys_action_current = E_SYS_NONE; 148 _e_sys_action_current = E_SYS_NONE;
138 _e_sys_exe = NULL; 149 _e_sys_exe = NULL;
139 /* if we have a suspend or hibernate status popup/dialog - close it
140 * here as we have finished suspend/hibernate (and probably just
141 * came back out of suspend/hibernate */
142 return 1; 150 return 1;
143 } 151 }
144 if ((_e_sys_halt_check_exe) && (ev->exe == _e_sys_halt_check_exe)) 152 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)
212 e_object_del(E_OBJECT(dia)); 220 e_object_del(E_OBJECT(dia));
213 _e_sys_action_current = E_SYS_NONE; 221 _e_sys_action_current = E_SYS_NONE;
214 _e_sys_action_after = E_SYS_NONE; 222 _e_sys_action_after = E_SYS_NONE;
223 if (_e_sys_dialog)
224 {
225 e_object_del(E_OBJECT(_e_sys_dialog));
226 _e_sys_dialog = NULL;
227 }
215} 228}
216 229
217static int 230static int
@@ -255,7 +268,7 @@ _e_sys_cb_logout_timer(void *data)
255 e_dialog_button_focus_num(dia, 1); 268 e_dialog_button_focus_num(dia, 1);
256 e_win_centered_set(dia->win, 1); 269 e_win_centered_set(dia->win, 1);
257 e_dialog_show(dia); 270 e_dialog_show(dia);
258 _e_sys_logout_begin_time = ecore_time_get() + (60 * 60 * 24 * 365); 271 _e_sys_logout_begin_time = 0.0;
259 } 272 }
260 _e_sys_logout_timer = NULL; 273 _e_sys_logout_timer = NULL;
261 return 0; 274 return 0;
@@ -271,8 +284,13 @@ _e_sys_cb_logout_timer(void *data)
271static void 284static void
272_e_sys_logout_after(void) 285_e_sys_logout_after(void)
273{ 286{
287 if (_e_sys_dialog)
288 {
289 e_object_del(E_OBJECT(_e_sys_dialog));
290 _e_sys_dialog = NULL;
291 }
292 _e_sys_action_current = _e_sys_action_after;
274 _e_sys_action_do(_e_sys_action_after, NULL); 293 _e_sys_action_do(_e_sys_action_after, NULL);
275 _e_sys_action_current = E_SYS_NONE;
276 _e_sys_action_after = E_SYS_NONE; 294 _e_sys_action_after = E_SYS_NONE;
277} 295}
278 296
@@ -280,14 +298,20 @@ static void
280_e_sys_logout_begin(E_Sys_Action a_after) 298_e_sys_logout_begin(E_Sys_Action a_after)
281{ 299{
282 Evas_List *l; 300 Evas_List *l;
301 E_Obj_Dialog *od;
283 302
284 /* start logout - at end do the a_after action */ 303 /* start logout - at end do the a_after action */
304 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
305 _("Logout in progress"), "E", "_sys_logout");
306 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
307 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
308 _("Logout is currently in progress.<br>"
309 "<hilight>Please wait.</hilight>"));
310 e_obj_dialog_show(od);
311 e_obj_dialog_icon_set(od, "enlightenment/logout");
312 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
313 _e_sys_dialog = od;
285 _e_sys_action_after = a_after; 314 _e_sys_action_after = a_after;
286 /* FIXME: go through to every window and if it wants delete req - ask
287 * it to delete, otherwise just close it. set handler for window
288 * deletes, and once all windows are deleted - exit, OR if a timer
289 * expires - pop up dialog saying something is not responding
290 */
291 for (l = e_border_client_list(); l; l = l->next) 315 for (l = e_border_client_list(); l; l = l->next)
292 { 316 {
293 E_Border *bd; 317 E_Border *bd;
@@ -410,6 +434,7 @@ static int
410_e_sys_action_do(E_Sys_Action a, char *param) 434_e_sys_action_do(E_Sys_Action a, char *param)
411{ 435{
412 char buf[4096]; 436 char buf[4096];
437 E_Obj_Dialog *od;
413 438
414 switch (a) 439 switch (a)
415 { 440 {
@@ -439,6 +464,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
439 else 464 else
440 { 465 {
441 _e_sys_exe = ecore_exe_run(buf, NULL); 466 _e_sys_exe = ecore_exe_run(buf, NULL);
467 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
468 _("Shutting down"), "E", "_sys_halt");
469 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
470 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
471 _("Shutting down your Computer.<br>"
472 "<hilight>Please wait.</hilight>"));
473 e_obj_dialog_show(od);
474 e_obj_dialog_icon_set(od, "enlightenment/logout");
475 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
476 _e_sys_dialog = od;
442 /* FIXME: display halt status */ 477 /* FIXME: display halt status */
443 } 478 }
444 break; 479 break;
@@ -455,6 +490,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
455 else 490 else
456 { 491 {
457 _e_sys_exe = ecore_exe_run(buf, NULL); 492 _e_sys_exe = ecore_exe_run(buf, NULL);
493 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
494 _("Rebooting"), "E", "_sys_reboot");
495 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
496 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
497 _("Rebooting your Computer.<br>"
498 "<hilight>Please wait.</hilight>"));
499 e_obj_dialog_show(od);
500 e_obj_dialog_icon_set(od, "enlightenment/logout");
501 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
502 _e_sys_dialog = od;
458 /* FIXME: display reboot status */ 503 /* FIXME: display reboot status */
459 } 504 }
460 break; 505 break;
@@ -470,6 +515,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
470 else 515 else
471 { 516 {
472 _e_sys_exe = ecore_exe_run(buf, NULL); 517 _e_sys_exe = ecore_exe_run(buf, NULL);
518 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
519 _("Suspending"), "E", "_sys_suspend");
520 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
521 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
522 _("Suspending your Computer.<br>"
523 "<hilight>Please wait.</hilight>"));
524 e_obj_dialog_show(od);
525 e_obj_dialog_icon_set(od, "enlightenment/logout");
526 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
527 _e_sys_dialog = od;
473 /* FIXME: display suspend status */ 528 /* FIXME: display suspend status */
474 } 529 }
475 break; 530 break;
@@ -485,6 +540,16 @@ _e_sys_action_do(E_Sys_Action a, char *param)
485 else 540 else
486 { 541 {
487 _e_sys_exe = ecore_exe_run(buf, NULL); 542 _e_sys_exe = ecore_exe_run(buf, NULL);
543 od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
544 _("Hibernating"), "E", "_sys_hibernate");
545 e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
546 e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
547 _("Hibernating your Computer.<br>"
548 "<hilight>Please wait.</hilight>"));
549 e_obj_dialog_show(od);
550 e_obj_dialog_icon_set(od, "enlightenment/logout");
551 if (_e_sys_dialog) e_object_del(E_OBJECT(_e_sys_dialog));
552 _e_sys_dialog = od;
488 /* FIXME: display hibernate status */ 553 /* FIXME: display hibernate status */
489 } 554 }
490 break; 555 break;