summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2007-03-24 22:53:16 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2007-03-24 22:53:16 +0000
commit4e1e51af46dc15ddc7cd2dd420672c99e5edf459 (patch)
tree87a62c13bfa9ddc93f6c53d000168aafae3b1a94 /src
parentc9a8d12b0872f2dd609d15eb2a35b6091ddf8cfa (diff)
Convert startup code to e_order.
SVN revision: 29056
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_init.c32
-rw-r--r--src/bin/e_init.h2
-rw-r--r--src/bin/e_order.c2
-rw-r--r--src/bin/e_startup.c82
4 files changed, 39 insertions, 79 deletions
diff --git a/src/bin/e_init.c b/src/bin/e_init.c
index 2405f2f..2c1700b 100644
--- a/src/bin/e_init.c
+++ b/src/bin/e_init.c
@@ -199,12 +199,10 @@ e_init_done(void)
199} 199}
200 200
201EAPI void 201EAPI void
202e_init_icons_app_add(E_App *app) 202e_init_icons_desktop_add(Efreet_Desktop *desktop)
203{ 203{
204 Evas_Object *o; 204 Evas_Object *o;
205 205 char buf[128];
206 E_OBJECT_CHECK(app);
207 E_OBJECT_TYPE_CHECK(app, E_APP_TYPE);
208 206
209 if (!_e_init_evas) return; 207 if (!_e_init_evas) return;
210 208
@@ -231,17 +229,21 @@ e_init_icons_app_add(E_App *app)
231 evas_object_show(o); 229 evas_object_show(o);
232 } 230 }
233 231
234 o = e_app_icon_add(app, _e_init_evas); 232 snprintf(buf, sizeof(buf), "%dx%d", _e_init_icon_size, _e_init_icon_size);
235 evas_object_resize(o, _e_init_icon_size, _e_init_icon_size); 233 o = e_util_desktop_icon_add(desktop, buf, _e_init_evas);
236 e_box_pack_end(_e_init_icon_box, o); 234 if (o)
237 e_box_pack_options_set(o, 235 {
238 0, 0, 236 evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
239 0, 0, 237 e_box_pack_end(_e_init_icon_box, o);
240 0.5, 0.5, 238 e_box_pack_options_set(o,
241 _e_init_icon_size, _e_init_icon_size, 239 0, 0,
242 _e_init_icon_size, _e_init_icon_size); 240 0, 0,
243 evas_object_show(o); 241 0.5, 0.5,
244 _e_init_icon_list = evas_list_append(_e_init_icon_list, o); 242 _e_init_icon_size, _e_init_icon_size,
243 _e_init_icon_size, _e_init_icon_size);
244 evas_object_show(o);
245 _e_init_icon_list = evas_list_append(_e_init_icon_list, o);
246 }
245} 247}
246 248
247static void 249static void
diff --git a/src/bin/e_init.h b/src/bin/e_init.h
index b33fcc8..adc1b6f 100644
--- a/src/bin/e_init.h
+++ b/src/bin/e_init.h
@@ -16,7 +16,7 @@ EAPI void e_init_status_set(const char *str);
16EAPI Ecore_X_Window e_init_window_get(void); 16EAPI Ecore_X_Window e_init_window_get(void);
17EAPI void e_init_done(void); 17EAPI void e_init_done(void);
18 18
19EAPI void e_init_icons_app_add(E_App *app); 19EAPI void e_init_icons_desktop_add(Efreet_Desktop *desktop);
20 20
21#endif 21#endif
22#endif 22#endif
diff --git a/src/bin/e_order.c b/src/bin/e_order.c
index b11540c..0590e4c 100644
--- a/src/bin/e_order.c
+++ b/src/bin/e_order.c
@@ -43,7 +43,7 @@ e_order_new(const char *path)
43 { 43 {
44 Efreet_Desktop *desktop; 44 Efreet_Desktop *desktop;
45 desktop = efreet_util_desktop_by_file_id_get(buf); 45 desktop = efreet_util_desktop_by_file_id_get(buf);
46 if (desktop) evas_list_append(eo->desktops, desktop); 46 if (desktop) eo->desktops = evas_list_append(eo->desktops, desktop);
47 } 47 }
48 } 48 }
49 } 49 }
diff --git a/src/bin/e_startup.c b/src/bin/e_startup.c
index b3b96c8..9f17e32 100644
--- a/src/bin/e_startup.c
+++ b/src/bin/e_startup.c
@@ -3,18 +3,18 @@
3 */ 3 */
4#include "e.h" 4#include "e.h"
5 5
6/* TODO:
7 * - Need some kind of "wait for exit" system, maybe register with
8 * e_config? startup and restart apps could also be in e_config
9 */
10
6/* local subsystem functions */ 11/* local subsystem functions */
7static void _e_startup(void); 12static void _e_startup(void);
8static int _e_startup_timeout_cb(void *data); 13static void _e_startup_next_cb(void *data);
9static int _e_startup_next_cb(void *data);
10static void _e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch);
11 14
12/* local subsystem globals */ 15/* local subsystem globals */
13static E_App *startup_apps = NULL; 16static E_Order *startup_apps = NULL;
14static int start_app_pos = -1; 17static int start_app_pos = -1;
15static Ecore_Timer *next_timer = NULL;
16static Ecore_Timer *timeout_timer = NULL;
17static E_App *waiting_app = NULL;
18 18
19/* externally accessible functions */ 19/* externally accessible functions */
20EAPI void 20EAPI void
@@ -25,16 +25,15 @@ e_startup(E_Startup_Mode mode)
25 25
26 homedir = e_user_homedir_get(); 26 homedir = e_user_homedir_get();
27 if (mode == E_STARTUP_START) 27 if (mode == E_STARTUP_START)
28 snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup", homedir); 28 snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup/.order", homedir);
29 else if (mode == E_STARTUP_RESTART) 29 else if (mode == E_STARTUP_RESTART)
30 snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart", homedir); 30 snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart/.order", homedir);
31 startup_apps = e_app_new(buf, 1); 31 startup_apps = e_order_new(buf);
32 if (!startup_apps) 32 if (!startup_apps)
33 { 33 {
34// e_init_hide(); 34// e_init_hide();
35 return; 35 return;
36 } 36 }
37 e_app_change_callback_add(_e_startup_app_exit_cb, NULL);
38 start_app_pos = 0; 37 start_app_pos = 0;
39 _e_startup(); 38 _e_startup();
40} 39}
@@ -43,7 +42,7 @@ e_startup(E_Startup_Mode mode)
43static void 42static void
44_e_startup(void) 43_e_startup(void)
45{ 44{
46 E_App *a; 45 Efreet_Desktop *desktop;
47 char buf[4096]; 46 char buf[4096];
48 47
49 if (!startup_apps) 48 if (!startup_apps)
@@ -51,66 +50,25 @@ _e_startup(void)
51 e_init_done(); 50 e_init_done();
52 return; 51 return;
53 } 52 }
54 a = evas_list_nth(startup_apps->subapps, start_app_pos); 53 desktop = evas_list_nth(startup_apps->desktops, start_app_pos);
55 start_app_pos++; 54 start_app_pos++;
56 if (!a) 55 if (!desktop)
57 { 56 {
58 e_object_unref(E_OBJECT(startup_apps)); 57 e_object_del(E_OBJECT(startup_apps));
59 startup_apps = NULL; 58 startup_apps = NULL;
60 start_app_pos = -1; 59 start_app_pos = -1;
61 waiting_app = NULL;
62 e_app_change_callback_del(_e_startup_app_exit_cb, NULL);
63 e_init_done(); 60 e_init_done();
64 return; 61 return;
65 } 62 }
66 e_app_exec(NULL, a, NULL, NULL, NULL); 63 e_exec(NULL, desktop, NULL, NULL, NULL);
67 snprintf(buf, sizeof(buf), _("Starting %s"), a->name); 64 snprintf(buf, sizeof(buf), _("Starting %s"), desktop->name);
68 e_init_status_set(buf); 65 e_init_status_set(buf);
69 e_init_icons_app_add(a); 66 e_init_icons_desktop_add(desktop);
70 if (a->wait_exit) 67 ecore_job_add(_e_startup_next_cb, NULL);
71 {
72 timeout_timer = ecore_timer_add(10.0, _e_startup_timeout_cb, NULL);
73 waiting_app = a;
74 }
75 else
76 {
77 timeout_timer = ecore_timer_add(0.0, _e_startup_next_cb, NULL);
78 waiting_app = NULL;
79 }
80} 68}
81 69
82static int 70static void
83_e_startup_timeout_cb(void *data)
84{
85 timeout_timer = NULL;
86 waiting_app = NULL;
87 /* FIXME: error dialog or log etc..... */
88 _e_startup();
89 return 0;
90}
91
92static int
93_e_startup_next_cb(void *data) 71_e_startup_next_cb(void *data)
94{ 72{
95 next_timer = NULL;
96 _e_startup(); 73 _e_startup();
97 return 0;
98}
99
100static void
101_e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch)
102{
103 if (ch == E_APP_EXIT)
104 {
105 if (a == waiting_app)
106 {
107 waiting_app = NULL;
108 if (timeout_timer)
109 {
110 ecore_timer_del(timeout_timer);
111 timeout_timer = NULL;
112 }
113 _e_startup();
114 }
115 }
116} 74}