forked from enlightenment/enlightenment
startup smoothing - smoothen startup with preload and defer to loop start
this moves a bunch of things that were being don after loop starts to before so they don't interrupt framerate as well as launch a thread that preloads file(s) - for now just edj theme files so stuff is pre-cached by the time loop starts later so we don't stall s much leading to smoother startup/fade in and better framerate. it's really visible (especially on my rpi3).
This commit is contained in:
parent
0d00264ca6
commit
b8afba1e49
6
TODO
6
TODO
|
@ -120,12 +120,6 @@ TODO:
|
|||
* edje needs logic to handle max texture size and to downsize to work
|
||||
* rpi max texture size is 2048...
|
||||
* dnd: remove e_dnd and use elm's dnd instead
|
||||
* defer signal emits for init splash and stuff like that until after
|
||||
mainloop and pre-caching theme file, wallpaper file, own binary,
|
||||
shared libs and module .so files etc. to minimize any stalls and
|
||||
have a smooth init (maybe on linux just open /proc/sefl/fd after we
|
||||
finally hit mainloop and go to sleep and just find every fd that is
|
||||
a path to a file and load the whole file into ram? simple and effective)
|
||||
* new gadgets:
|
||||
* be able to move, resize etc. without alt move/resize mode like old)
|
||||
* initial gadget bar setup dnd needs to be normal dnd
|
||||
|
|
|
@ -243,6 +243,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
|||
evas_object_data_set(o, "e_zone", zone);
|
||||
snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
|
||||
e_theme_edje_object_set(o, "base/theme/transitions", buf);
|
||||
edje_object_preload(o, EINA_FALSE);
|
||||
edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
|
||||
evas_object_move(o, zone->x, zone->y);
|
||||
evas_object_resize(o, zone->w, zone->h);
|
||||
|
@ -254,6 +255,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
|||
{
|
||||
o = edje_object_add(e_comp->evas);
|
||||
edje_object_file_set(o, bgfile, "e/desktop/background");
|
||||
edje_object_preload(o, EINA_FALSE);
|
||||
if (edje_object_data_get(o, "noanimation"))
|
||||
edje_object_animation_set(o, EINA_FALSE);
|
||||
}
|
||||
|
@ -264,6 +266,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
|
|||
(eina_str_has_extension(bgfile, ".bmp")))
|
||||
{
|
||||
o = e_icon_add(e_comp->evas);
|
||||
e_icon_preload_set(o, EINA_TRUE);
|
||||
e_icon_file_key_set(o, bgfile, NULL);
|
||||
e_icon_scale_size_set(o, 0);
|
||||
e_icon_fill_inside_set(o, 0);
|
||||
|
|
|
@ -567,14 +567,14 @@ e_gadcon_populate(E_Gadcon *gc)
|
|||
{
|
||||
Eina_List *l;
|
||||
E_Config_Gadcon_Client *cf_gcc;
|
||||
E_Gadcon_Client_Class *cc;
|
||||
int x = 0;
|
||||
|
||||
E_OBJECT_CHECK_RETURN(gc, EINA_FALSE);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, EINA_FALSE);
|
||||
e_gadcon_layout_freeze(gc->o_container);
|
||||
EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc)
|
||||
{
|
||||
E_Gadcon_Client_Class *cc;
|
||||
|
||||
if (!cf_gcc->name) continue;
|
||||
cc = eina_hash_find(providers, cf_gcc->name);
|
||||
if (cc)
|
||||
|
@ -590,9 +590,43 @@ e_gadcon_populate(E_Gadcon *gc)
|
|||
else
|
||||
e_gadcon_client_queue(gc, cf_gcc);
|
||||
}
|
||||
e_gadcon_layout_thaw(gc->o_container);
|
||||
if (gc->populated_classes && (!gc->populate_requests))
|
||||
_e_gadcon_event_populate(gc);
|
||||
if (!gc->toolbar)
|
||||
{
|
||||
EINA_LIST_FREE(gc->populate_requests, cc)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
e_main_ts(cc->name);
|
||||
if (gc->populate_class.func)
|
||||
gc->populate_class.func(gc->populate_class.data, gc, cc);
|
||||
else
|
||||
e_gadcon_populate_class(gc, cc);
|
||||
if (!eina_list_data_find(gc->populated_classes, cc))
|
||||
{
|
||||
gc->populated_classes = eina_list_append(gc->populated_classes, cc);
|
||||
if (gc->cf)
|
||||
{
|
||||
Eina_List *ll;
|
||||
|
||||
if (!gc->awaiting_classes) continue;
|
||||
ll = eina_hash_set(gc->awaiting_classes, cc->name, NULL);
|
||||
EINA_LIST_FREE(ll, cf_gcc)
|
||||
_e_gadcon_client_populate(gc, cc, cf_gcc);
|
||||
}
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s Done", cc->name);
|
||||
e_main_ts(buf);
|
||||
x++;
|
||||
}
|
||||
if (x && _modules_loaded) _e_gadcon_event_populate(gc);
|
||||
e_gadcon_layout_thaw(gc->o_container);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_gadcon_layout_thaw(gc->o_container);
|
||||
if (gc->populated_classes && (!gc->populate_requests))
|
||||
_e_gadcon_event_populate(gc);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
215
src/bin/e_main.c
215
src/bin/e_main.c
|
@ -79,7 +79,6 @@ static int _e_main_dirs_init(void);
|
|||
static int _e_main_dirs_shutdown(void);
|
||||
static int _e_main_path_init(void);
|
||||
static int _e_main_path_shutdown(void);
|
||||
static void _e_main_test_formats(void);
|
||||
static int _e_main_screens_init(void);
|
||||
static int _e_main_screens_shutdown(void);
|
||||
static void _e_main_desk_save(void);
|
||||
|
@ -206,10 +205,46 @@ _xdg_data_dirs_augment(void)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_main_shelf_init_job(void *data EINA_UNUSED)
|
||||
_precache_file(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata)
|
||||
{
|
||||
e_shelf_config_update();
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
Eina_List **precache_files = fdata;
|
||||
*precache_files = eina_list_append(*precache_files, strdup(key));
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void *
|
||||
_precache_thread(void *data, Eina_Thread thr EINA_UNUSED)
|
||||
{
|
||||
Eina_List *precache_files = data;
|
||||
char *path;
|
||||
double t = ecore_time_get();
|
||||
unsigned int sum = 0;
|
||||
unsigned int reads = 0;
|
||||
|
||||
|
||||
EINA_LIST_FREE(precache_files, path)
|
||||
{
|
||||
double tt = ecore_time_get();
|
||||
FILE *f = fopen(path, "r");
|
||||
unsigned char buf[4096];
|
||||
|
||||
if (f)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
while ((sz = fread(buf, 1, sizeof(buf), f)) > 0)
|
||||
{
|
||||
reads ++;
|
||||
sum = ((sum << 1) ^ buf[0]) + reads;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
printf("PRECACHE: [%1.5f] [%s] DONE\n", ecore_time_get() - tt, path);
|
||||
free(path);
|
||||
}
|
||||
printf("PRECACHE: TOTAL [%1.5f]\n", ecore_time_get() - t);
|
||||
printf("PRECACHE: SUM=%08x, READS=%i\n", sum, reads);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* externally accessible functions */
|
||||
|
@ -368,7 +403,11 @@ main(int argc, char **argv)
|
|||
}
|
||||
TS("Ecore Init Done");
|
||||
_e_main_shutdown_push(ecore_shutdown);
|
||||
|
||||
TS("E Comp Canvas Intercept Init");
|
||||
e_comp_canvas_intercept();
|
||||
TS("E Comp Canvas Intercept Init Done");
|
||||
|
||||
e_first_frame = getenv("E_FIRST_FRAME");
|
||||
if (e_first_frame && e_first_frame[0])
|
||||
e_first_frame_start_time = ecore_time_get();
|
||||
|
@ -616,6 +655,52 @@ main(int argc, char **argv)
|
|||
TS("E Paths Init Done");
|
||||
_e_main_shutdown_push(_e_main_path_shutdown);
|
||||
|
||||
TS("E_Precache");
|
||||
if (!getenv("E_NO_PRECACHE"))
|
||||
{
|
||||
const Eina_List *l;
|
||||
const Eina_List *theme_items = elm_theme_list_get(NULL);
|
||||
Eina_List *precache_files = NULL;
|
||||
Eina_Hash *files = eina_hash_string_superfast_new(NULL);
|
||||
Eina_Thread thr;
|
||||
int scr, dx, dy;
|
||||
// find all theme edj files to precache
|
||||
EINA_LIST_FOREACH(theme_items, l, s)
|
||||
{
|
||||
Eina_Bool search = EINA_FALSE;
|
||||
char *path = elm_theme_list_item_path_get(s, &search);
|
||||
if (path)
|
||||
{
|
||||
eina_hash_del(files, path, files);
|
||||
eina_hash_add(files, path, files);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
// go over the first 4 screens and all desks and find possible
|
||||
// background files and add them to our hash to precache
|
||||
for (scr = 0; scr < 4; scr++)
|
||||
{
|
||||
for (dy = 0; dy < e_config->zone_desks_y_count; dy++)
|
||||
{
|
||||
for (dx = 0; dx < e_config->zone_desks_x_count; dx++)
|
||||
{
|
||||
const char *bgfile = e_bg_file_get(scr, dx, dy);
|
||||
eina_hash_del(files, bgfile, files);
|
||||
eina_hash_add(files, bgfile, files);
|
||||
eina_stringshare_del(bgfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
eina_hash_foreach(files, _precache_file, &precache_files);
|
||||
eina_hash_free(files);
|
||||
if (!eina_thread_create(&thr, EINA_THREAD_BACKGROUND, -1,
|
||||
_precache_thread, precache_files))
|
||||
{
|
||||
ERR("Can't spawn file precache thread");
|
||||
}
|
||||
}
|
||||
TS("E_Precache Done");
|
||||
|
||||
TS("E_Ipc Init");
|
||||
if (!e_ipc_init()) _e_main_shutdown(-1);
|
||||
TS("E_Ipc Init Done");
|
||||
|
@ -768,21 +853,21 @@ main(int argc, char **argv)
|
|||
_e_main_shutdown_push(e_init_shutdown);
|
||||
}
|
||||
if (!((!e_config->show_splash) || (after_restart)))
|
||||
e_init_show();
|
||||
{
|
||||
TS("E_Splash Show");
|
||||
e_init_show();
|
||||
TS("E_Splash Show Done");
|
||||
}
|
||||
|
||||
if (!really_know)
|
||||
{
|
||||
TS("Test File Format Support");
|
||||
_e_main_test_formats();
|
||||
TS("Test File Format Support Done");
|
||||
}
|
||||
else
|
||||
{
|
||||
efreet_icon_extension_add(".svg");
|
||||
efreet_icon_extension_add(".jpg");
|
||||
efreet_icon_extension_add(".png");
|
||||
efreet_icon_extension_add(".edj");
|
||||
}
|
||||
TS("Add Icon Extensions");
|
||||
efreet_icon_extension_add(".svg");
|
||||
efreet_icon_extension_add(".svgz");
|
||||
efreet_icon_extension_add(".svg.gz");
|
||||
efreet_icon_extension_add(".jpg");
|
||||
efreet_icon_extension_add(".jpeg");
|
||||
efreet_icon_extension_add(".png");
|
||||
efreet_icon_extension_add(".edj");
|
||||
TS("Add Icon Extensions Done");
|
||||
|
||||
if (e_config->show_splash)
|
||||
e_init_status_set(_("Setup ACPI"));
|
||||
|
@ -1033,9 +1118,6 @@ main(int argc, char **argv)
|
|||
|
||||
if (e_config->show_splash)
|
||||
e_init_status_set(_("Load Modules"));
|
||||
TS("Load Modules");
|
||||
_e_main_modules_load(safe_mode);
|
||||
TS("Load Modules Done");
|
||||
|
||||
TS("Run Startup Apps");
|
||||
if (!nostartup)
|
||||
|
@ -1055,6 +1137,10 @@ main(int argc, char **argv)
|
|||
e_test();
|
||||
TS("E_Test Done");
|
||||
|
||||
TS("Load Modules");
|
||||
_e_main_modules_load(safe_mode);
|
||||
TS("Load Modules Done");
|
||||
|
||||
if (E_EFL_VERSION_MINIMUM(1, 17, 99))
|
||||
{
|
||||
if (e_config->show_splash)
|
||||
|
@ -1073,10 +1159,9 @@ main(int argc, char **argv)
|
|||
e_error_message_show(_("Enlightenment cannot set up its module system.\n"));
|
||||
_e_main_shutdown(-1);
|
||||
}
|
||||
e_shelf_config_update();
|
||||
TS("E_Shelf Init Done");
|
||||
|
||||
ecore_idle_enterer_before_add(_e_main_shelf_init_job, NULL);
|
||||
|
||||
_idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
|
||||
|
||||
if (e_config->show_splash)
|
||||
|
@ -1544,87 +1629,6 @@ _e_main_path_shutdown(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_main_test_formats(void)
|
||||
{
|
||||
Evas *evas;
|
||||
Ecore_Evas *ee;
|
||||
Evas_Object *im, *txt;
|
||||
Evas_Coord tw, th;
|
||||
char buff[PATH_MAX];
|
||||
char *types[] =
|
||||
{
|
||||
"svg",
|
||||
"jpg",
|
||||
"png",
|
||||
"edj"
|
||||
};
|
||||
unsigned int i, t_edj = 3;
|
||||
|
||||
if (e_config->show_splash)
|
||||
e_init_status_set(_("Testing Format Support"));
|
||||
|
||||
if (!(ee = ecore_evas_buffer_new(1, 1)))
|
||||
{
|
||||
e_error_message_show(_("Enlightenment found Evas can't create a buffer canvas. Please check\n"
|
||||
"Evas has Software Buffer engine support.\n"));
|
||||
_e_main_shutdown(-1);
|
||||
}
|
||||
evas = ecore_evas_get(ee);
|
||||
im = evas_object_image_add(evas);
|
||||
|
||||
for (i = 0; i < EINA_C_ARRAY_LENGTH(types); i++)
|
||||
{
|
||||
char b[128], *t = types[i];
|
||||
const char *key = NULL;
|
||||
|
||||
snprintf(b, sizeof(b), "data/images/test.%s", types[i]);
|
||||
e_prefix_data_concat_static(buff, b);
|
||||
if (i == t_edj)
|
||||
{
|
||||
t = "eet";
|
||||
key = "images/0";
|
||||
}
|
||||
evas_object_image_file_set(im, buff, key);
|
||||
switch (evas_object_image_load_error_get(im))
|
||||
{
|
||||
case EVAS_LOAD_ERROR_CORRUPT_FILE:
|
||||
case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
|
||||
case EVAS_LOAD_ERROR_PERMISSION_DENIED:
|
||||
e_error_message_show(_("Enlightenment cannot access test image for '%s' filetype. "
|
||||
"Check your install for setup issues.\n"), t);
|
||||
EINA_FALLTHROUGH;
|
||||
// fallthrough anyway as normally these files should work
|
||||
|
||||
case EVAS_LOAD_ERROR_NONE:
|
||||
snprintf(b, sizeof(b), ".%s", types[i]);
|
||||
efreet_icon_extension_add(b);
|
||||
break;
|
||||
|
||||
default:
|
||||
e_error_message_show(_("Enlightenment found Evas can't load '%s' files. "
|
||||
"Check Evas has '%s' loader support.\n"), t, t);
|
||||
if (i) _e_main_shutdown(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
evas_object_del(im);
|
||||
|
||||
txt = evas_object_text_add(evas);
|
||||
evas_object_text_font_set(txt, "Sans", 10);
|
||||
evas_object_text_text_set(txt, "Hello");
|
||||
evas_object_geometry_get(txt, NULL, NULL, &tw, &th);
|
||||
if ((tw <= 0) && (th <= 0))
|
||||
{
|
||||
e_error_message_show(_("Enlightenment found Evas can't load the 'Sans' font. Check Evas has fontconfig\n"
|
||||
"support and system fontconfig defines a 'Sans' font.\n"));
|
||||
_e_main_shutdown(-1);
|
||||
}
|
||||
evas_object_del(txt);
|
||||
ecore_evas_free(ee);
|
||||
}
|
||||
|
||||
static int
|
||||
_e_main_screens_init(void)
|
||||
{
|
||||
|
@ -1642,8 +1646,11 @@ _e_main_screens_init(void)
|
|||
e_error_message_show(_("Enlightenment cannot create a compositor.\n"));
|
||||
_e_main_shutdown(-1);
|
||||
}
|
||||
TS("Compositor Init Done");
|
||||
|
||||
TS("Desk Restore");
|
||||
_e_main_desk_restore();
|
||||
TS("Desk Restore Done");
|
||||
|
||||
#ifndef HAVE_WAYLAND_ONLY
|
||||
if (e_config->show_splash)
|
||||
|
|
|
@ -14,7 +14,6 @@ static void _e_module_cb_dialog_disable(void *data, E_Dialog *dia);
|
|||
static void _e_module_event_update_free(void *data, void *event);
|
||||
static int _e_module_sort_name(const void *d1, const void *d2);
|
||||
static void _e_module_whitelist_check(void);
|
||||
static Eina_Bool _e_module_desktop_list_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Eina_List *_e_modules = NULL;
|
||||
|
@ -22,112 +21,11 @@ static Eina_Hash *_e_modules_hash = NULL;
|
|||
static Eina_Bool _e_modules_initting = EINA_FALSE;
|
||||
static Eina_Bool _e_modules_init_end = EINA_FALSE;
|
||||
|
||||
static Eina_List *_e_module_path_monitors = NULL;
|
||||
static Eina_List *_e_module_path_lists = NULL;
|
||||
static Eina_List *handlers = NULL;
|
||||
static Eina_Hash *_e_module_path_hash = NULL;
|
||||
|
||||
E_API int E_EVENT_MODULE_UPDATE = 0;
|
||||
E_API int E_EVENT_MODULE_INIT_END = 0;
|
||||
|
||||
static Eina_Stringshare *mod_src_path = NULL;
|
||||
|
||||
static Eina_Bool
|
||||
_module_filter_cb(void *d EINA_UNUSED, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (lstat(info->path, &st)) return EINA_FALSE;
|
||||
return (info->path[info->name_start] != '.');
|
||||
}
|
||||
|
||||
static void
|
||||
_module_main_cb(void *d, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
|
||||
s = eina_hash_set(_e_module_path_hash, info->path + info->name_start, eina_stringshare_add(info->path));
|
||||
if (!s) return;
|
||||
if (!d)
|
||||
{
|
||||
if (!strstr(s, e_user_dir_get()))
|
||||
INF("REPLACING DUPLICATE MODULE PATH: %s -> %s", s, info->path);
|
||||
else
|
||||
{
|
||||
INF("NOT REPLACING DUPLICATE MODULE PATH: %s -X> %s", s, info->path);
|
||||
s = eina_hash_set(_e_module_path_hash, info->path + info->name_start, s);
|
||||
}
|
||||
}
|
||||
eina_stringshare_del(s);
|
||||
}
|
||||
|
||||
static void
|
||||
_module_done_cb(void *d EINA_UNUSED, Eio_File *ls)
|
||||
{
|
||||
_e_module_path_lists = eina_list_remove(_e_module_path_lists, ls);
|
||||
if (_e_module_path_lists) return;
|
||||
if (_e_modules_initting) e_module_all_load();
|
||||
else if (!_e_modules_init_end)
|
||||
{
|
||||
ecore_event_add(E_EVENT_MODULE_INIT_END, NULL, NULL, NULL);
|
||||
_e_modules_init_end = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_module_error_cb(void *d EINA_UNUSED, Eio_File *ls, int error EINA_UNUSED)
|
||||
{
|
||||
_e_module_path_lists = eina_list_remove(_e_module_path_lists, ls);
|
||||
if (_e_module_path_lists) return;
|
||||
if (_e_modules_initting) e_module_all_load();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_module_monitor_dir_create(void *d, int type EINA_UNUSED, Eio_Monitor_Event *ev)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
const char *path;
|
||||
|
||||
path = ecore_file_file_get(ev->filename);
|
||||
s = eina_hash_set(_e_module_path_hash, path, eina_stringshare_ref(ev->filename));
|
||||
if (!s) return ECORE_CALLBACK_RENEW;
|
||||
if ((!d) && (s != ev->filename))
|
||||
{
|
||||
if (!strstr(s, e_user_dir_get()))
|
||||
INF("REPLACING DUPLICATE MODULE PATH: %s -> %s", s, ev->filename);
|
||||
else
|
||||
{
|
||||
INF("NOT REPLACING DUPLICATE MODULE PATH: %s -X> %s", s, ev->filename);
|
||||
s = eina_hash_set(_e_module_path_hash, path, s);
|
||||
}
|
||||
}
|
||||
eina_stringshare_del(s);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_module_monitor_dir_del(void *d EINA_UNUSED, int type EINA_UNUSED, Eio_Monitor_Event *ev)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
const char *path;
|
||||
|
||||
path = ecore_file_file_get(ev->filename);
|
||||
s = eina_hash_find(_e_module_path_hash, path);
|
||||
if (s == ev->filename)
|
||||
eina_hash_del_by_key(_e_module_path_hash, path);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_module_monitor_error(void *d EINA_UNUSED, int type EINA_UNUSED, Eio_Monitor_Error *ev)
|
||||
{
|
||||
_e_module_path_monitors = eina_list_remove(_e_module_path_monitors, ev->monitor);
|
||||
eio_monitor_del(ev->monitor);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_module_is_nosave(const char *name)
|
||||
{
|
||||
|
@ -170,52 +68,11 @@ _module_is_important(const char *name)
|
|||
EINTERN int
|
||||
e_module_init(void)
|
||||
{
|
||||
Eina_List *module_paths;
|
||||
Eina_List *next_path;
|
||||
E_Path_Dir *epd;
|
||||
Eio_Monitor *mon;
|
||||
Eio_File *ls;
|
||||
|
||||
if (_e_modules_hash) return 1;
|
||||
E_EVENT_MODULE_UPDATE = ecore_event_type_new();
|
||||
E_EVENT_MODULE_INIT_END = ecore_event_type_new();
|
||||
_e_module_path_hash = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del);
|
||||
_e_modules_hash = eina_hash_string_superfast_new(NULL);
|
||||
|
||||
if (!mod_src_path)
|
||||
mod_src_path = eina_stringshare_add(getenv("E_MODULE_SRC_PATH"));
|
||||
|
||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_CREATED, _module_monitor_dir_create, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_DELETED, _module_monitor_dir_del, NULL);
|
||||
E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, _module_monitor_error, NULL);
|
||||
|
||||
if (mod_src_path)
|
||||
{
|
||||
if (ecore_file_is_dir(mod_src_path))
|
||||
{
|
||||
mon = eio_monitor_stringshared_add(mod_src_path);
|
||||
ls = eio_file_direct_ls(mod_src_path, _module_filter_cb, _module_main_cb, _module_done_cb, _module_error_cb, NULL);
|
||||
_e_module_path_monitors = eina_list_append(_e_module_path_monitors, mon);
|
||||
_e_module_path_lists = eina_list_append(_e_module_path_lists, ls);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
module_paths = e_path_dir_list_get(path_modules);
|
||||
EINA_LIST_FOREACH(module_paths, next_path, epd)
|
||||
{
|
||||
if (ecore_file_is_dir(epd->dir))
|
||||
{
|
||||
void *data = NULL;
|
||||
|
||||
mon = eio_monitor_stringshared_add(epd->dir);
|
||||
data = (intptr_t*)(long)!!strstr(epd->dir, e_user_dir_get());
|
||||
ls = eio_file_direct_ls(epd->dir, _module_filter_cb, _module_main_cb, _module_done_cb, _module_error_cb, data);
|
||||
_e_module_path_monitors = eina_list_append(_e_module_path_monitors, mon);
|
||||
_e_module_path_lists = eina_list_append(_e_module_path_lists, ls);
|
||||
}
|
||||
}
|
||||
e_path_dir_list_free(module_paths);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -251,9 +108,6 @@ e_module_shutdown(void)
|
|||
|
||||
E_FREE_FUNC(_e_module_path_hash, eina_hash_free);
|
||||
E_FREE_FUNC(_e_modules_hash, eina_hash_free);
|
||||
E_FREE_LIST(handlers, ecore_event_handler_del);
|
||||
E_FREE_LIST(_e_module_path_monitors, eio_monitor_del);
|
||||
E_FREE_LIST(_e_module_path_lists, eio_file_cancel);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -266,7 +120,6 @@ e_module_all_load(void)
|
|||
char buf[128];
|
||||
|
||||
_e_modules_initting = EINA_TRUE;
|
||||
if (_e_module_path_lists) return;
|
||||
|
||||
// remove duplicate modules in load
|
||||
e_config->modules =
|
||||
|
@ -340,27 +193,8 @@ e_module_new(const char *name)
|
|||
m = E_OBJECT_ALLOC(E_Module, E_MODULE_TYPE, _e_module_free);
|
||||
if (name[0] != '/')
|
||||
{
|
||||
Eina_Stringshare *path = NULL;
|
||||
|
||||
if (!mod_src_path)
|
||||
mod_src_path = eina_stringshare_add(getenv("E_MODULE_SRC_PATH"));
|
||||
if (mod_src_path)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s/.libs/module.so", mod_src_path, name);
|
||||
modpath = eina_stringshare_add(buf);
|
||||
}
|
||||
if (!modpath)
|
||||
path = eina_hash_find(_e_module_path_hash, name);
|
||||
if (path)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s/module.so", path, MODULE_ARCH);
|
||||
modpath = eina_stringshare_add(buf);
|
||||
}
|
||||
else if (!modpath)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
|
||||
modpath = e_path_find(path_modules, buf);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
|
||||
modpath = e_path_find(path_modules, buf);
|
||||
}
|
||||
else if (eina_str_has_extension(name, ".so"))
|
||||
modpath = eina_stringshare_add(name);
|
||||
|
@ -652,13 +486,46 @@ e_module_dialog_show(E_Module *m, const char *title, const char *body)
|
|||
e_win_client_icon_set(dia->win, icon);
|
||||
}
|
||||
|
||||
static Eina_List *
|
||||
_e_module_desktop_list(Eina_List *modules, const char *dir)
|
||||
{
|
||||
Eina_List *l, *files;
|
||||
Efreet_Desktop *desktop;
|
||||
char buf[PATH_MAX], *f;
|
||||
E_Module_Desktop *md;
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
EINA_LIST_FOREACH(files, l, f)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/%s/module.desktop", dir, f);
|
||||
desktop = efreet_desktop_new(buf);
|
||||
if (desktop)
|
||||
{
|
||||
md = E_NEW(E_Module_Desktop, 1);
|
||||
md->desktop = desktop;
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dir, f);
|
||||
md->dir = eina_stringshare_add(buf);
|
||||
modules = eina_list_append(modules, md);
|
||||
}
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
E_API Eina_List *
|
||||
e_module_desktop_list(void)
|
||||
{
|
||||
Eina_List *l = NULL;
|
||||
Eina_List *modules = NULL, *l;
|
||||
E_Path_Dir *epd;
|
||||
|
||||
eina_hash_foreach(_e_module_path_hash, _e_module_desktop_list_cb, &l);
|
||||
return l;
|
||||
EINA_LIST_FOREACH(path_modules->default_dir_list, l, epd)
|
||||
{
|
||||
modules = _e_module_desktop_list(modules, epd->dir);
|
||||
}
|
||||
EINA_LIST_FOREACH(*(path_modules->user_dir_list), l, epd)
|
||||
{
|
||||
modules = _e_module_desktop_list(modules, epd->dir);
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
E_API void
|
||||
|
@ -702,26 +569,6 @@ _e_module_free(E_Module *m)
|
|||
free(m);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_module_desktop_list_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
Eina_List **l = fdata;
|
||||
Efreet_Desktop *desktop;
|
||||
E_Module_Desktop *md;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/module.desktop", (char*)data);
|
||||
desktop = efreet_desktop_new(buf);
|
||||
if (desktop)
|
||||
{
|
||||
md = E_NEW(E_Module_Desktop, 1);
|
||||
md->desktop = desktop;
|
||||
md->dir = eina_stringshare_ref(data);
|
||||
*l = eina_list_append(*l, md);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
typedef struct Disable_Dialog
|
||||
{
|
||||
char *title;
|
||||
|
|
|
@ -290,9 +290,9 @@ e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
||||
if (ecore_file_exists(icon))
|
||||
{
|
||||
e_icon_preload_set(obj, 1);
|
||||
e_icon_file_key_set(obj, icon, "/thumbnail/data");
|
||||
_e_thumb_key_load(eth, icon);
|
||||
e_icon_preload_set(obj, 1);
|
||||
}
|
||||
evas_object_smart_callback_call(obj, "e_thumb_gen", NULL);
|
||||
}
|
||||
|
|
|
@ -226,6 +226,8 @@ packagekit_popup_update(E_PackageKit_Instance *inst, Eina_Bool rebuild_list)
|
|||
char buf[1024];
|
||||
Eina_List *l;
|
||||
|
||||
if (!inst->popup_genlist) return;
|
||||
|
||||
if (inst->popup_help_mode)
|
||||
inst->popup_help_mode = EINA_FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue