Convert startup code to e_order.

SVN revision: 29056
devs/princeamd/enlightenment-0.17-elive
Sebastian Dransfeld 16 years ago
parent c9a8d12b08
commit 4e1e51af46
  1. 32
      src/bin/e_init.c
  2. 2
      src/bin/e_init.h
  3. 2
      src/bin/e_order.c
  4. 82
      src/bin/e_startup.c

@ -199,12 +199,10 @@ e_init_done(void)
}
EAPI void
e_init_icons_app_add(E_App *app)
e_init_icons_desktop_add(Efreet_Desktop *desktop)
{
Evas_Object *o;
E_OBJECT_CHECK(app);
E_OBJECT_TYPE_CHECK(app, E_APP_TYPE);
char buf[128];
if (!_e_init_evas) return;
@ -231,17 +229,21 @@ e_init_icons_app_add(E_App *app)
evas_object_show(o);
}
o = e_app_icon_add(app, _e_init_evas);
evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
e_box_pack_end(_e_init_icon_box, o);
e_box_pack_options_set(o,
0, 0,
0, 0,
0.5, 0.5,
_e_init_icon_size, _e_init_icon_size,
_e_init_icon_size, _e_init_icon_size);
evas_object_show(o);
_e_init_icon_list = evas_list_append(_e_init_icon_list, o);
snprintf(buf, sizeof(buf), "%dx%d", _e_init_icon_size, _e_init_icon_size);
o = e_util_desktop_icon_add(desktop, buf, _e_init_evas);
if (o)
{
evas_object_resize(o, _e_init_icon_size, _e_init_icon_size);
e_box_pack_end(_e_init_icon_box, o);
e_box_pack_options_set(o,
0, 0,
0, 0,
0.5, 0.5,
_e_init_icon_size, _e_init_icon_size,
_e_init_icon_size, _e_init_icon_size);
evas_object_show(o);
_e_init_icon_list = evas_list_append(_e_init_icon_list, o);
}
}
static void

@ -16,7 +16,7 @@ EAPI void e_init_status_set(const char *str);
EAPI Ecore_X_Window e_init_window_get(void);
EAPI void e_init_done(void);
EAPI void e_init_icons_app_add(E_App *app);
EAPI void e_init_icons_desktop_add(Efreet_Desktop *desktop);
#endif
#endif

@ -43,7 +43,7 @@ e_order_new(const char *path)
{
Efreet_Desktop *desktop;
desktop = efreet_util_desktop_by_file_id_get(buf);
if (desktop) evas_list_append(eo->desktops, desktop);
if (desktop) eo->desktops = evas_list_append(eo->desktops, desktop);
}
}
}

@ -3,18 +3,18 @@
*/
#include "e.h"
/* TODO:
* - Need some kind of "wait for exit" system, maybe register with
* e_config? startup and restart apps could also be in e_config
*/
/* local subsystem functions */
static void _e_startup(void);
static int _e_startup_timeout_cb(void *data);
static int _e_startup_next_cb(void *data);
static void _e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch);
static void _e_startup_next_cb(void *data);
/* local subsystem globals */
static E_App *startup_apps = NULL;
static int start_app_pos = -1;
static Ecore_Timer *next_timer = NULL;
static Ecore_Timer *timeout_timer = NULL;
static E_App *waiting_app = NULL;
static E_Order *startup_apps = NULL;
static int start_app_pos = -1;
/* externally accessible functions */
EAPI void
@ -25,16 +25,15 @@ e_startup(E_Startup_Mode mode)
homedir = e_user_homedir_get();
if (mode == E_STARTUP_START)
snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup", homedir);
snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup/.order", homedir);
else if (mode == E_STARTUP_RESTART)
snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart", homedir);
startup_apps = e_app_new(buf, 1);
snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart/.order", homedir);
startup_apps = e_order_new(buf);
if (!startup_apps)
{
// e_init_hide();
return;
}
e_app_change_callback_add(_e_startup_app_exit_cb, NULL);
start_app_pos = 0;
_e_startup();
}
@ -43,7 +42,7 @@ e_startup(E_Startup_Mode mode)
static void
_e_startup(void)
{
E_App *a;
Efreet_Desktop *desktop;
char buf[4096];
if (!startup_apps)
@ -51,66 +50,25 @@ _e_startup(void)
e_init_done();
return;
}
a = evas_list_nth(startup_apps->subapps, start_app_pos);
desktop = evas_list_nth(startup_apps->desktops, start_app_pos);
start_app_pos++;
if (!a)
if (!desktop)
{
e_object_unref(E_OBJECT(startup_apps));
e_object_del(E_OBJECT(startup_apps));
startup_apps = NULL;
start_app_pos = -1;
waiting_app = NULL;
e_app_change_callback_del(_e_startup_app_exit_cb, NULL);
e_init_done();
return;
}
e_app_exec(NULL, a, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), _("Starting %s"), a->name);
e_exec(NULL, desktop, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), _("Starting %s"), desktop->name);
e_init_status_set(buf);
e_init_icons_app_add(a);
if (a->wait_exit)
{
timeout_timer = ecore_timer_add(10.0, _e_startup_timeout_cb, NULL);
waiting_app = a;
}
else
{
timeout_timer = ecore_timer_add(0.0, _e_startup_next_cb, NULL);
waiting_app = NULL;
}
e_init_icons_desktop_add(desktop);
ecore_job_add(_e_startup_next_cb, NULL);
}
static int
_e_startup_timeout_cb(void *data)
{
timeout_timer = NULL;
waiting_app = NULL;
/* FIXME: error dialog or log etc..... */
_e_startup();
return 0;
}
static int
static void
_e_startup_next_cb(void *data)
{
next_timer = NULL;
_e_startup();
return 0;
}
static void
_e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch)
{
if (ch == E_APP_EXIT)
{
if (a == waiting_app)
{
waiting_app = NULL;
if (timeout_timer)
{
ecore_timer_del(timeout_timer);
timeout_timer = NULL;
}
_e_startup();
}
}
}

Loading…
Cancel
Save