summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-09-14 18:47:20 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-09-14 18:47:20 +0100
commitb8afba1e49ce6e3d1c4ae4e8161b5b7df2c9be5d (patch)
tree796d2aba3974cca68713f3907ccce8764726c4dc
parent0d00264ca6e8d254bc20362aa48e6d93859d8fb5 (diff)
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).
Diffstat (limited to '')
-rw-r--r--TODO6
-rw-r--r--src/bin/e_bg.c3
-rw-r--r--src/bin/e_gadcon.c44
-rw-r--r--src/bin/e_main.c213
-rw-r--r--src/bin/e_module.c229
-rw-r--r--src/bin/e_thumb.c2
-rw-r--r--src/modules/packagekit/e_mod_packagekit.c2
7 files changed, 193 insertions, 306 deletions
diff --git a/TODO b/TODO
index f0fa49f41..b9adc84e8 100644
--- a/TODO
+++ b/TODO
@@ -120,12 +120,6 @@ TODO:
120 * edje needs logic to handle max texture size and to downsize to work 120 * edje needs logic to handle max texture size and to downsize to work
121 * rpi max texture size is 2048... 121 * rpi max texture size is 2048...
122* dnd: remove e_dnd and use elm's dnd instead 122* dnd: remove e_dnd and use elm's dnd instead
123* defer signal emits for init splash and stuff like that until after
124 mainloop and pre-caching theme file, wallpaper file, own binary,
125 shared libs and module .so files etc. to minimize any stalls and
126 have a smooth init (maybe on linux just open /proc/sefl/fd after we
127 finally hit mainloop and go to sleep and just find every fd that is
128 a path to a file and load the whole file into ram? simple and effective)
129* new gadgets: 123* new gadgets:
130 * be able to move, resize etc. without alt move/resize mode like old) 124 * be able to move, resize etc. without alt move/resize mode like old)
131 * initial gadget bar setup dnd needs to be normal dnd 125 * initial gadget bar setup dnd needs to be normal dnd
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index 8ed05daef..e46bbd747 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -243,6 +243,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
243 evas_object_data_set(o, "e_zone", zone); 243 evas_object_data_set(o, "e_zone", zone);
244 snprintf(buf, sizeof(buf), "e/transitions/%s", trans); 244 snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
245 e_theme_edje_object_set(o, "base/theme/transitions", buf); 245 e_theme_edje_object_set(o, "base/theme/transitions", buf);
246 edje_object_preload(o, EINA_FALSE);
246 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone); 247 edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone);
247 evas_object_move(o, zone->x, zone->y); 248 evas_object_move(o, zone->x, zone->y);
248 evas_object_resize(o, zone->w, zone->h); 249 evas_object_resize(o, zone->w, zone->h);
@@ -254,6 +255,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
254 { 255 {
255 o = edje_object_add(e_comp->evas); 256 o = edje_object_add(e_comp->evas);
256 edje_object_file_set(o, bgfile, "e/desktop/background"); 257 edje_object_file_set(o, bgfile, "e/desktop/background");
258 edje_object_preload(o, EINA_FALSE);
257 if (edje_object_data_get(o, "noanimation")) 259 if (edje_object_data_get(o, "noanimation"))
258 edje_object_animation_set(o, EINA_FALSE); 260 edje_object_animation_set(o, EINA_FALSE);
259 } 261 }
@@ -264,6 +266,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition)
264 (eina_str_has_extension(bgfile, ".bmp"))) 266 (eina_str_has_extension(bgfile, ".bmp")))
265 { 267 {
266 o = e_icon_add(e_comp->evas); 268 o = e_icon_add(e_comp->evas);
269 e_icon_preload_set(o, EINA_TRUE);
267 e_icon_file_key_set(o, bgfile, NULL); 270 e_icon_file_key_set(o, bgfile, NULL);
268 e_icon_scale_size_set(o, 0); 271 e_icon_scale_size_set(o, 0);
269 e_icon_fill_inside_set(o, 0); 272 e_icon_fill_inside_set(o, 0);
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index 9396bb2ac..36b441dc4 100644
--- a/src/bin/e_gadcon.c
+++ b/src/bin/e_gadcon.c
@@ -567,14 +567,14 @@ e_gadcon_populate(E_Gadcon *gc)
567{ 567{
568 Eina_List *l; 568 Eina_List *l;
569 E_Config_Gadcon_Client *cf_gcc; 569 E_Config_Gadcon_Client *cf_gcc;
570 E_Gadcon_Client_Class *cc;
571 int x = 0;
570 572
571 E_OBJECT_CHECK_RETURN(gc, EINA_FALSE); 573 E_OBJECT_CHECK_RETURN(gc, EINA_FALSE);
572 E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, EINA_FALSE); 574 E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, EINA_FALSE);
573 e_gadcon_layout_freeze(gc->o_container); 575 e_gadcon_layout_freeze(gc->o_container);
574 EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc) 576 EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc)
575 { 577 {
576 E_Gadcon_Client_Class *cc;
577
578 if (!cf_gcc->name) continue; 578 if (!cf_gcc->name) continue;
579 cc = eina_hash_find(providers, cf_gcc->name); 579 cc = eina_hash_find(providers, cf_gcc->name);
580 if (cc) 580 if (cc)
@@ -590,9 +590,43 @@ e_gadcon_populate(E_Gadcon *gc)
590 else 590 else
591 e_gadcon_client_queue(gc, cf_gcc); 591 e_gadcon_client_queue(gc, cf_gcc);
592 } 592 }
593 e_gadcon_layout_thaw(gc->o_container); 593 if (!gc->toolbar)
594 if (gc->populated_classes && (!gc->populate_requests)) 594 {
595 _e_gadcon_event_populate(gc); 595 EINA_LIST_FREE(gc->populate_requests, cc)
596 {
597 char buf[256];
598
599 e_main_ts(cc->name);
600 if (gc->populate_class.func)
601 gc->populate_class.func(gc->populate_class.data, gc, cc);
602 else
603 e_gadcon_populate_class(gc, cc);
604 if (!eina_list_data_find(gc->populated_classes, cc))
605 {
606 gc->populated_classes = eina_list_append(gc->populated_classes, cc);
607 if (gc->cf)
608 {
609 Eina_List *ll;
610
611 if (!gc->awaiting_classes) continue;
612 ll = eina_hash_set(gc->awaiting_classes, cc->name, NULL);
613 EINA_LIST_FREE(ll, cf_gcc)
614 _e_gadcon_client_populate(gc, cc, cf_gcc);
615 }
616 }
617 snprintf(buf, sizeof(buf), "%s Done", cc->name);
618 e_main_ts(buf);
619 x++;
620 }
621 if (x && _modules_loaded) _e_gadcon_event_populate(gc);
622 e_gadcon_layout_thaw(gc->o_container);
623 }
624 else
625 {
626 e_gadcon_layout_thaw(gc->o_container);
627 if (gc->populated_classes && (!gc->populate_requests))
628 _e_gadcon_event_populate(gc);
629 }
596 return EINA_TRUE; 630 return EINA_TRUE;
597} 631}
598 632
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index f8ee9dbcc..f1b5989cb 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -79,7 +79,6 @@ static int _e_main_dirs_init(void);
79static int _e_main_dirs_shutdown(void); 79static int _e_main_dirs_shutdown(void);
80static int _e_main_path_init(void); 80static int _e_main_path_init(void);
81static int _e_main_path_shutdown(void); 81static int _e_main_path_shutdown(void);
82static void _e_main_test_formats(void);
83static int _e_main_screens_init(void); 82static int _e_main_screens_init(void);
84static int _e_main_screens_shutdown(void); 83static int _e_main_screens_shutdown(void);
85static void _e_main_desk_save(void); 84static void _e_main_desk_save(void);
@@ -206,10 +205,46 @@ _xdg_data_dirs_augment(void)
206} 205}
207 206
208static Eina_Bool 207static Eina_Bool
209_e_main_shelf_init_job(void *data EINA_UNUSED) 208_precache_file(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata)
210{ 209{
211 e_shelf_config_update(); 210 Eina_List **precache_files = fdata;
212 return ECORE_CALLBACK_CANCEL; 211 *precache_files = eina_list_append(*precache_files, strdup(key));
212 return EINA_TRUE;
213}
214
215static void *
216_precache_thread(void *data, Eina_Thread thr EINA_UNUSED)
217{
218 Eina_List *precache_files = data;
219 char *path;
220 double t = ecore_time_get();
221 unsigned int sum = 0;
222 unsigned int reads = 0;
223
224
225 EINA_LIST_FREE(precache_files, path)
226 {
227 double tt = ecore_time_get();
228 FILE *f = fopen(path, "r");
229 unsigned char buf[4096];
230
231 if (f)
232 {
233 size_t sz;
234
235 while ((sz = fread(buf, 1, sizeof(buf), f)) > 0)
236 {
237 reads ++;
238 sum = ((sum << 1) ^ buf[0]) + reads;
239 }
240 fclose(f);
241 }
242 printf("PRECACHE: [%1.5f] [%s] DONE\n", ecore_time_get() - tt, path);
243 free(path);
244 }
245 printf("PRECACHE: TOTAL [%1.5f]\n", ecore_time_get() - t);
246 printf("PRECACHE: SUM=%08x, READS=%i\n", sum, reads);
247 return NULL;
213} 248}
214 249
215/* externally accessible functions */ 250/* externally accessible functions */
@@ -368,7 +403,11 @@ main(int argc, char **argv)
368 } 403 }
369 TS("Ecore Init Done"); 404 TS("Ecore Init Done");
370 _e_main_shutdown_push(ecore_shutdown); 405 _e_main_shutdown_push(ecore_shutdown);
406
407 TS("E Comp Canvas Intercept Init");
371 e_comp_canvas_intercept(); 408 e_comp_canvas_intercept();
409 TS("E Comp Canvas Intercept Init Done");
410
372 e_first_frame = getenv("E_FIRST_FRAME"); 411 e_first_frame = getenv("E_FIRST_FRAME");
373 if (e_first_frame && e_first_frame[0]) 412 if (e_first_frame && e_first_frame[0])
374 e_first_frame_start_time = ecore_time_get(); 413 e_first_frame_start_time = ecore_time_get();
@@ -616,6 +655,52 @@ main(int argc, char **argv)
616 TS("E Paths Init Done"); 655 TS("E Paths Init Done");
617 _e_main_shutdown_push(_e_main_path_shutdown); 656 _e_main_shutdown_push(_e_main_path_shutdown);
618 657
658 TS("E_Precache");
659 if (!getenv("E_NO_PRECACHE"))
660 {
661 const Eina_List *l;
662 const Eina_List *theme_items = elm_theme_list_get(NULL);
663 Eina_List *precache_files = NULL;
664 Eina_Hash *files = eina_hash_string_superfast_new(NULL);
665 Eina_Thread thr;
666 int scr, dx, dy;
667 // find all theme edj files to precache
668 EINA_LIST_FOREACH(theme_items, l, s)
669 {
670 Eina_Bool search = EINA_FALSE;
671 char *path = elm_theme_list_item_path_get(s, &search);
672 if (path)
673 {
674 eina_hash_del(files, path, files);
675 eina_hash_add(files, path, files);
676 free(path);
677 }
678 }
679 // go over the first 4 screens and all desks and find possible
680 // background files and add them to our hash to precache
681 for (scr = 0; scr < 4; scr++)
682 {
683 for (dy = 0; dy < e_config->zone_desks_y_count; dy++)
684 {
685 for (dx = 0; dx < e_config->zone_desks_x_count; dx++)
686 {
687 const char *bgfile = e_bg_file_get(scr, dx, dy);
688 eina_hash_del(files, bgfile, files);
689 eina_hash_add(files, bgfile, files);
690 eina_stringshare_del(bgfile);
691 }
692 }
693 }
694 eina_hash_foreach(files, _precache_file, &precache_files);
695 eina_hash_free(files);
696 if (!eina_thread_create(&thr, EINA_THREAD_BACKGROUND, -1,
697 _precache_thread, precache_files))
698 {
699 ERR("Can't spawn file precache thread");
700 }
701 }
702 TS("E_Precache Done");
703
619 TS("E_Ipc Init"); 704 TS("E_Ipc Init");
620 if (!e_ipc_init()) _e_main_shutdown(-1); 705 if (!e_ipc_init()) _e_main_shutdown(-1);
621 TS("E_Ipc Init Done"); 706 TS("E_Ipc Init Done");
@@ -768,22 +853,22 @@ main(int argc, char **argv)
768 _e_main_shutdown_push(e_init_shutdown); 853 _e_main_shutdown_push(e_init_shutdown);
769 } 854 }
770 if (!((!e_config->show_splash) || (after_restart))) 855 if (!((!e_config->show_splash) || (after_restart)))
771 e_init_show();
772
773 if (!really_know)
774 { 856 {
775 TS("Test File Format Support"); 857 TS("E_Splash Show");
776 _e_main_test_formats(); 858 e_init_show();
777 TS("Test File Format Support Done"); 859 TS("E_Splash Show Done");
778 }
779 else
780 {
781 efreet_icon_extension_add(".svg");
782 efreet_icon_extension_add(".jpg");
783 efreet_icon_extension_add(".png");
784 efreet_icon_extension_add(".edj");
785 } 860 }
786 861
862 TS("Add Icon Extensions");
863 efreet_icon_extension_add(".svg");
864 efreet_icon_extension_add(".svgz");
865 efreet_icon_extension_add(".svg.gz");
866 efreet_icon_extension_add(".jpg");
867 efreet_icon_extension_add(".jpeg");
868 efreet_icon_extension_add(".png");
869 efreet_icon_extension_add(".edj");
870 TS("Add Icon Extensions Done");
871
787 if (e_config->show_splash) 872 if (e_config->show_splash)
788 e_init_status_set(_("Setup ACPI")); 873 e_init_status_set(_("Setup ACPI"));
789 TS("E_Acpi Init"); 874 TS("E_Acpi Init");
@@ -1033,9 +1118,6 @@ main(int argc, char **argv)
1033 1118
1034 if (e_config->show_splash) 1119 if (e_config->show_splash)
1035 e_init_status_set(_("Load Modules")); 1120 e_init_status_set(_("Load Modules"));
1036 TS("Load Modules");
1037 _e_main_modules_load(safe_mode);
1038 TS("Load Modules Done");
1039 1121
1040 TS("Run Startup Apps"); 1122 TS("Run Startup Apps");
1041 if (!nostartup) 1123 if (!nostartup)
@@ -1055,6 +1137,10 @@ main(int argc, char **argv)
1055 e_test(); 1137 e_test();
1056 TS("E_Test Done"); 1138 TS("E_Test Done");
1057 1139
1140 TS("Load Modules");
1141 _e_main_modules_load(safe_mode);
1142 TS("Load Modules Done");
1143
1058 if (E_EFL_VERSION_MINIMUM(1, 17, 99)) 1144 if (E_EFL_VERSION_MINIMUM(1, 17, 99))
1059 { 1145 {
1060 if (e_config->show_splash) 1146 if (e_config->show_splash)
@@ -1073,10 +1159,9 @@ main(int argc, char **argv)
1073 e_error_message_show(_("Enlightenment cannot set up its module system.\n")); 1159 e_error_message_show(_("Enlightenment cannot set up its module system.\n"));
1074 _e_main_shutdown(-1); 1160 _e_main_shutdown(-1);
1075 } 1161 }
1162 e_shelf_config_update();
1076 TS("E_Shelf Init Done"); 1163 TS("E_Shelf Init Done");
1077 1164
1078 ecore_idle_enterer_before_add(_e_main_shelf_init_job, NULL);
1079
1080 _idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL); 1165 _idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
1081 1166
1082 if (e_config->show_splash) 1167 if (e_config->show_splash)
@@ -1544,87 +1629,6 @@ _e_main_path_shutdown(void)
1544 return 1; 1629 return 1;
1545} 1630}
1546 1631
1547static void
1548_e_main_test_formats(void)
1549{
1550 Evas *evas;
1551 Ecore_Evas *ee;
1552 Evas_Object *im, *txt;
1553 Evas_Coord tw, th;
1554 char buff[PATH_MAX];
1555 char *types[] =
1556 {
1557 "svg",
1558 "jpg",
1559 "png",
1560 "edj"
1561 };
1562 unsigned int i, t_edj = 3;
1563
1564 if (e_config->show_splash)
1565 e_init_status_set(_("Testing Format Support"));
1566
1567 if (!(ee = ecore_evas_buffer_new(1, 1)))
1568 {
1569 e_error_message_show(_("Enlightenment found Evas can't create a buffer canvas. Please check\n"
1570 "Evas has Software Buffer engine support.\n"));
1571 _e_main_shutdown(-1);
1572 }
1573 evas = ecore_evas_get(ee);
1574 im = evas_object_image_add(evas);
1575
1576 for (i = 0; i < EINA_C_ARRAY_LENGTH(types); i++)
1577 {
1578 char b[128], *t = types[i];
1579 const char *key = NULL;
1580
1581 snprintf(b, sizeof(b), "data/images/test.%s", types[i]);
1582 e_prefix_data_concat_static(buff, b);
1583 if (i == t_edj)
1584 {
1585 t = "eet";
1586 key = "images/0";
1587 }
1588 evas_object_image_file_set(im, buff, key);
1589 switch (evas_object_image_load_error_get(im))
1590 {
1591 case EVAS_LOAD_ERROR_CORRUPT_FILE:
1592 case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
1593 case EVAS_LOAD_ERROR_PERMISSION_DENIED:
1594 e_error_message_show(_("Enlightenment cannot access test image for '%s' filetype. "
1595 "Check your install for setup issues.\n"), t);
1596 EINA_FALLTHROUGH;
1597 // fallthrough anyway as normally these files should work
1598
1599 case EVAS_LOAD_ERROR_NONE:
1600 snprintf(b, sizeof(b), ".%s", types[i]);
1601 efreet_icon_extension_add(b);
1602 break;
1603
1604 default:
1605 e_error_message_show(_("Enlightenment found Evas can't load '%s' files. "
1606 "Check Evas has '%s' loader support.\n"), t, t);
1607 if (i) _e_main_shutdown(-1);
1608 break;
1609 }
1610 }
1611
1612 evas_object_del(im);
1613
1614 txt = evas_object_text_add(evas);
1615 evas_object_text_font_set(txt, "Sans", 10);
1616 evas_object_text_text_set(txt, "Hello");
1617 evas_object_geometry_get(txt, NULL, NULL, &tw, &th);
1618 if ((tw <= 0) && (th <= 0))
1619 {
1620 e_error_message_show(_("Enlightenment found Evas can't load the 'Sans' font. Check Evas has fontconfig\n"
1621 "support and system fontconfig defines a 'Sans' font.\n"));
1622 _e_main_shutdown(-1);
1623 }
1624 evas_object_del(txt);
1625 ecore_evas_free(ee);
1626}
1627
1628static int 1632static int
1629_e_main_screens_init(void) 1633_e_main_screens_init(void)
1630{ 1634{
@@ -1642,8 +1646,11 @@ _e_main_screens_init(void)
1642 e_error_message_show(_("Enlightenment cannot create a compositor.\n")); 1646 e_error_message_show(_("Enlightenment cannot create a compositor.\n"));
1643 _e_main_shutdown(-1); 1647 _e_main_shutdown(-1);
1644 } 1648 }
1649 TS("Compositor Init Done");
1645 1650
1651 TS("Desk Restore");
1646 _e_main_desk_restore(); 1652 _e_main_desk_restore();
1653 TS("Desk Restore Done");
1647 1654
1648#ifndef HAVE_WAYLAND_ONLY 1655#ifndef HAVE_WAYLAND_ONLY
1649 if (e_config->show_splash) 1656 if (e_config->show_splash)
diff --git a/src/bin/e_module.c b/src/bin/e_module.c
index 6ccedc0ff..bcc824e7d 100644
--- a/src/bin/e_module.c
+++ b/src/bin/e_module.c
@@ -14,7 +14,6 @@ static void _e_module_cb_dialog_disable(void *data, E_Dialog *dia);
14static void _e_module_event_update_free(void *data, void *event); 14static void _e_module_event_update_free(void *data, void *event);
15static int _e_module_sort_name(const void *d1, const void *d2); 15static int _e_module_sort_name(const void *d1, const void *d2);
16static void _e_module_whitelist_check(void); 16static void _e_module_whitelist_check(void);
17static Eina_Bool _e_module_desktop_list_cb(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, void *fdata);
18 17
19/* local subsystem globals */ 18/* local subsystem globals */
20static Eina_List *_e_modules = NULL; 19static Eina_List *_e_modules = NULL;
@@ -22,112 +21,11 @@ static Eina_Hash *_e_modules_hash = NULL;
22static Eina_Bool _e_modules_initting = EINA_FALSE; 21static Eina_Bool _e_modules_initting = EINA_FALSE;
23static Eina_Bool _e_modules_init_end = EINA_FALSE; 22static Eina_Bool _e_modules_init_end = EINA_FALSE;
24 23
25static Eina_List *_e_module_path_monitors = NULL;
26static Eina_List *_e_module_path_lists = NULL;
27static Eina_List *handlers = NULL;
28static Eina_Hash *_e_module_path_hash = NULL; 24static Eina_Hash *_e_module_path_hash = NULL;
29 25
30E_API int E_EVENT_MODULE_UPDATE = 0; 26E_API int E_EVENT_MODULE_UPDATE = 0;
31E_API int E_EVENT_MODULE_INIT_END = 0; 27E_API int E_EVENT_MODULE_INIT_END = 0;
32 28
33static Eina_Stringshare *mod_src_path = NULL;
34
35static Eina_Bool
36_module_filter_cb(void *d EINA_UNUSED, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info)
37{
38 struct stat st;
39
40 if (lstat(info->path, &st)) return EINA_FALSE;
41 return (info->path[info->name_start] != '.');
42}
43
44static void
45_module_main_cb(void *d, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info)
46{
47 Eina_Stringshare *s;
48
49 s = eina_hash_set(_e_module_path_hash, info->path + info->name_start, eina_stringshare_add(info->path));
50 if (!s) return;
51 if (!d)
52 {
53 if (!strstr(s, e_user_dir_get()))
54 INF("REPLACING DUPLICATE MODULE PATH: %s -> %s", s, info->path);
55 else
56 {
57 INF("NOT REPLACING DUPLICATE MODULE PATH: %s -X> %s", s, info->path);
58 s = eina_hash_set(_e_module_path_hash, info->path + info->name_start, s);
59 }
60 }
61 eina_stringshare_del(s);
62}
63
64static void
65_module_done_cb(void *d EINA_UNUSED, Eio_File *ls)
66{
67 _e_module_path_lists = eina_list_remove(_e_module_path_lists, ls);
68 if (_e_module_path_lists) return;
69 if (_e_modules_initting) e_module_all_load();
70 else if (!_e_modules_init_end)
71 {
72 ecore_event_add(E_EVENT_MODULE_INIT_END, NULL, NULL, NULL);
73 _e_modules_init_end = EINA_TRUE;
74 }
75}
76
77static void
78_module_error_cb(void *d EINA_UNUSED, Eio_File *ls, int error EINA_UNUSED)
79{
80 _e_module_path_lists = eina_list_remove(_e_module_path_lists, ls);
81 if (_e_module_path_lists) return;
82 if (_e_modules_initting) e_module_all_load();
83}
84
85static Eina_Bool
86_module_monitor_dir_create(void *d, int type EINA_UNUSED, Eio_Monitor_Event *ev)
87{
88 Eina_Stringshare *s;
89 const char *path;
90
91 path = ecore_file_file_get(ev->filename);
92 s = eina_hash_set(_e_module_path_hash, path, eina_stringshare_ref(ev->filename));
93 if (!s) return ECORE_CALLBACK_RENEW;
94 if ((!d) && (s != ev->filename))
95 {
96 if (!strstr(s, e_user_dir_get()))
97 INF("REPLACING DUPLICATE MODULE PATH: %s -> %s", s, ev->filename);
98 else
99 {
100 INF("NOT REPLACING DUPLICATE MODULE PATH: %s -X> %s", s, ev->filename);
101 s = eina_hash_set(_e_module_path_hash, path, s);
102 }
103 }
104 eina_stringshare_del(s);
105
106 return ECORE_CALLBACK_RENEW;
107}
108
109static Eina_Bool
110_module_monitor_dir_del(void *d EINA_UNUSED, int type EINA_UNUSED, Eio_Monitor_Event *ev)
111{
112 Eina_Stringshare *s;
113 const char *path;
114
115 path = ecore_file_file_get(ev->filename);
116 s = eina_hash_find(_e_module_path_hash, path);
117 if (s == ev->filename)
118 eina_hash_del_by_key(_e_module_path_hash, path);
119
120 return ECORE_CALLBACK_RENEW;
121}
122
123static Eina_Bool
124_module_monitor_error(void *d EINA_UNUSED, int type EINA_UNUSED, Eio_Monitor_Error *ev)
125{
126 _e_module_path_monitors = eina_list_remove(_e_module_path_monitors, ev->monitor);
127 eio_monitor_del(ev->monitor);
128 return ECORE_CALLBACK_RENEW;
129}
130
131static Eina_Bool 29static Eina_Bool
132_module_is_nosave(const char *name) 30_module_is_nosave(const char *name)
133{ 31{
@@ -170,52 +68,11 @@ _module_is_important(const char *name)
170EINTERN int 68EINTERN int
171e_module_init(void) 69e_module_init(void)
172{ 70{
173 Eina_List *module_paths;
174 Eina_List *next_path;
175 E_Path_Dir *epd;
176 Eio_Monitor *mon;
177 Eio_File *ls;
178
179 if (_e_modules_hash) return 1; 71 if (_e_modules_hash) return 1;
180 E_EVENT_MODULE_UPDATE = ecore_event_type_new(); 72 E_EVENT_MODULE_UPDATE = ecore_event_type_new();
181 E_EVENT_MODULE_INIT_END = ecore_event_type_new(); 73 E_EVENT_MODULE_INIT_END = ecore_event_type_new();
182 _e_module_path_hash = eina_hash_string_superfast_new((Eina_Free_Cb)eina_stringshare_del);
183 _e_modules_hash = eina_hash_string_superfast_new(NULL); 74 _e_modules_hash = eina_hash_string_superfast_new(NULL);
184 75
185 if (!mod_src_path)
186 mod_src_path = eina_stringshare_add(getenv("E_MODULE_SRC_PATH"));
187
188 E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_CREATED, _module_monitor_dir_create, NULL);
189 E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_DIRECTORY_DELETED, _module_monitor_dir_del, NULL);
190 E_LIST_HANDLER_APPEND(handlers, EIO_MONITOR_ERROR, _module_monitor_error, NULL);
191
192 if (mod_src_path)
193 {
194 if (ecore_file_is_dir(mod_src_path))
195 {
196 mon = eio_monitor_stringshared_add(mod_src_path);
197 ls = eio_file_direct_ls(mod_src_path, _module_filter_cb, _module_main_cb, _module_done_cb, _module_error_cb, NULL);
198 _e_module_path_monitors = eina_list_append(_e_module_path_monitors, mon);
199 _e_module_path_lists = eina_list_append(_e_module_path_lists, ls);
200 return 1;
201 }
202 }
203 module_paths = e_path_dir_list_get(path_modules);
204 EINA_LIST_FOREACH(module_paths, next_path, epd)
205 {
206 if (ecore_file_is_dir(epd->dir))
207 {
208 void *data = NULL;
209
210 mon = eio_monitor_stringshared_add(epd->dir);
211 data = (intptr_t*)(long)!!strstr(epd->dir, e_user_dir_get());
212 ls = eio_file_direct_ls(epd->dir, _module_filter_cb, _module_main_cb, _module_done_cb, _module_error_cb, data);
213 _e_module_path_monitors = eina_list_append(_e_module_path_monitors, mon);
214 _e_module_path_lists = eina_list_append(_e_module_path_lists, ls);
215 }
216 }
217 e_path_dir_list_free(module_paths);
218
219 return 1; 76 return 1;
220} 77}
221 78
@@ -251,9 +108,6 @@ e_module_shutdown(void)
251 108
252 E_FREE_FUNC(_e_module_path_hash, eina_hash_free); 109 E_FREE_FUNC(_e_module_path_hash, eina_hash_free);
253 E_FREE_FUNC(_e_modules_hash, eina_hash_free); 110 E_FREE_FUNC(_e_modules_hash, eina_hash_free);
254 E_FREE_LIST(handlers, ecore_event_handler_del);
255 E_FREE_LIST(_e_module_path_monitors, eio_monitor_del);
256 E_FREE_LIST(_e_module_path_lists, eio_file_cancel);
257 111
258 return 1; 112 return 1;
259} 113}
@@ -266,7 +120,6 @@ e_module_all_load(void)
266 char buf[128]; 120 char buf[128];
267 121
268 _e_modules_initting = EINA_TRUE; 122 _e_modules_initting = EINA_TRUE;
269 if (_e_module_path_lists) return;
270 123
271 // remove duplicate modules in load 124 // remove duplicate modules in load
272 e_config->modules = 125 e_config->modules =
@@ -340,27 +193,8 @@ e_module_new(const char *name)
340 m = E_OBJECT_ALLOC(E_Module, E_MODULE_TYPE, _e_module_free); 193 m = E_OBJECT_ALLOC(E_Module, E_MODULE_TYPE, _e_module_free);
341 if (name[0] != '/') 194 if (name[0] != '/')
342 { 195 {
343 Eina_Stringshare *path = NULL; 196 snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
344 197 modpath = e_path_find(path_modules, buf);
345 if (!mod_src_path)
346 mod_src_path = eina_stringshare_add(getenv("E_MODULE_SRC_PATH"));
347 if (mod_src_path)
348 {
349 snprintf(buf, sizeof(buf), "%s/%s/.libs/module.so", mod_src_path, name);
350 modpath = eina_stringshare_add(buf);
351 }
352 if (!modpath)
353 path = eina_hash_find(_e_module_path_hash, name);
354 if (path)
355 {
356 snprintf(buf, sizeof(buf), "%s/%s/module.so", path, MODULE_ARCH);
357 modpath = eina_stringshare_add(buf);
358 }
359 else if (!modpath)
360 {
361 snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
362 modpath = e_path_find(path_modules, buf);
363 }
364 } 198 }
365 else if (eina_str_has_extension(name, ".so")) 199 else if (eina_str_has_extension(name, ".so"))
366 modpath = eina_stringshare_add(name); 200 modpath = eina_stringshare_add(name);
@@ -652,13 +486,46 @@ e_module_dialog_show(E_Module *m, const char *title, const char *body)
652 e_win_client_icon_set(dia->win, icon); 486 e_win_client_icon_set(dia->win, icon);
653} 487}
654 488
489static Eina_List *
490_e_module_desktop_list(Eina_List *modules, const char *dir)
491{
492 Eina_List *l, *files;
493 Efreet_Desktop *desktop;
494 char buf[PATH_MAX], *f;
495 E_Module_Desktop *md;
496
497 files = ecore_file_ls(dir);
498 EINA_LIST_FOREACH(files, l, f)
499 {
500 snprintf(buf, sizeof(buf), "%s/%s/module.desktop", dir, f);
501 desktop = efreet_desktop_new(buf);
502 if (desktop)
503 {
504 md = E_NEW(E_Module_Desktop, 1);
505 md->desktop = desktop;
506 snprintf(buf, sizeof(buf), "%s/%s", dir, f);
507 md->dir = eina_stringshare_add(buf);
508 modules = eina_list_append(modules, md);
509 }
510 }
511 return modules;
512}
513
655E_API Eina_List * 514E_API Eina_List *
656e_module_desktop_list(void) 515e_module_desktop_list(void)
657{ 516{
658 Eina_List *l = NULL; 517 Eina_List *modules = NULL, *l;
518 E_Path_Dir *epd;
659 519
660 eina_hash_foreach(_e_module_path_hash, _e_module_desktop_list_cb, &l); 520 EINA_LIST_FOREACH(path_modules->default_dir_list, l, epd)
661 return l; 521 {
522 modules = _e_module_desktop_list(modules, epd->dir);
523 }
524 EINA_LIST_FOREACH(*(path_modules->user_dir_list), l, epd)
525 {
526 modules = _e_module_desktop_list(modules, epd->dir);
527 }
528 return modules;
662} 529}
663 530
664E_API void 531E_API void
@@ -702,26 +569,6 @@ _e_module_free(E_Module *m)
702 free(m); 569 free(m);
703} 570}
704 571
705static Eina_Bool
706_e_module_desktop_list_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
707{
708 char buf[PATH_MAX];
709 Eina_List **l = fdata;
710 Efreet_Desktop *desktop;
711 E_Module_Desktop *md;
712
713 snprintf(buf, sizeof(buf), "%s/module.desktop", (char*)data);
714 desktop = efreet_desktop_new(buf);
715 if (desktop)
716 {
717 md = E_NEW(E_Module_Desktop, 1);
718 md->desktop = desktop;
719 md->dir = eina_stringshare_ref(data);
720 *l = eina_list_append(*l, md);
721 }
722 return EINA_TRUE;
723}
724
725typedef struct Disable_Dialog 572typedef struct Disable_Dialog
726{ 573{
727 char *title; 574 char *title;
diff --git a/src/bin/e_thumb.c b/src/bin/e_thumb.c
index dd65a7cc1..d5d2b86a2 100644
--- a/src/bin/e_thumb.c
+++ b/src/bin/e_thumb.c
@@ -290,9 +290,9 @@ e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
290 if (_pending == 0) _e_thumb_thumbnailers_kill(); 290 if (_pending == 0) _e_thumb_thumbnailers_kill();
291 if (ecore_file_exists(icon)) 291 if (ecore_file_exists(icon))
292 { 292 {
293 e_icon_preload_set(obj, 1);
293 e_icon_file_key_set(obj, icon, "/thumbnail/data"); 294 e_icon_file_key_set(obj, icon, "/thumbnail/data");
294 _e_thumb_key_load(eth, icon); 295 _e_thumb_key_load(eth, icon);
295 e_icon_preload_set(obj, 1);
296 } 296 }
297 evas_object_smart_callback_call(obj, "e_thumb_gen", NULL); 297 evas_object_smart_callback_call(obj, "e_thumb_gen", NULL);
298 } 298 }
diff --git a/src/modules/packagekit/e_mod_packagekit.c b/src/modules/packagekit/e_mod_packagekit.c
index d02a66b88..dddba02dd 100644
--- a/src/modules/packagekit/e_mod_packagekit.c
+++ b/src/modules/packagekit/e_mod_packagekit.c
@@ -226,6 +226,8 @@ packagekit_popup_update(E_PackageKit_Instance *inst, Eina_Bool rebuild_list)
226 char buf[1024]; 226 char buf[1024];
227 Eina_List *l; 227 Eina_List *l;
228 228
229 if (!inst->popup_genlist) return;
230
229 if (inst->popup_help_mode) 231 if (inst->popup_help_mode)
230 inst->popup_help_mode = EINA_FALSE; 232 inst->popup_help_mode = EINA_FALSE;
231 233