forked from enlightenment/enlightenment
paranoid checks and disabling of precache if it might not be able to be done.
SVN revision: 26751
This commit is contained in:
parent
32956a470f
commit
2cf51fe66d
|
@ -352,7 +352,7 @@ enlightenment_imc_LDFLAGS = @e_libs@ @dlopen_libs@
|
|||
enlightenment_start_SOURCES = \
|
||||
e_start_main.c
|
||||
|
||||
enlightenment_start_LDFLAGS =
|
||||
enlightenment_start_LDFLAGS = @dlopen_libs@
|
||||
|
||||
enlightenment_thumb_SOURCES = \
|
||||
e_thumb_main.c \
|
||||
|
|
|
@ -19,6 +19,7 @@ static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_I
|
|||
static void _e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
static void _e_fwin_file_open(E_Fwin *fwin, const char *file, const char *mime);
|
||||
static void _e_fwin_file_open_app(E_Fwin *fwin, E_App *a, const char *file);
|
||||
static void _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_List *fwins = NULL;
|
||||
|
@ -249,6 +250,11 @@ _e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi)
|
|||
e_fm2_parent_go(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fwin_cb_ilist_change(void *data, Evas_Object *obj)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fwin_file_open(E_Fwin *fwin, const char *file, const char *mime)
|
||||
{
|
||||
|
@ -288,10 +294,6 @@ _e_fwin_file_open(E_Fwin *fwin, const char *file, const char *mime)
|
|||
/* FIXME: register app a as handling mime type if app doesnt */
|
||||
/* say it can already in a separate info blob so in future */
|
||||
/* e will list it as an option */
|
||||
for (l = apps; l; l = l->next)
|
||||
{
|
||||
a = l->data;
|
||||
}
|
||||
}
|
||||
evas_list_free(apps);
|
||||
}
|
||||
|
@ -355,3 +357,64 @@ _e_fwin_file_open_app(E_Fwin *fwin, E_App *a, const char *file)
|
|||
}
|
||||
e_zone_exec(fwin->win->border->zone, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Object *o, *ocon, *of, *oi;
|
||||
Evas *evas;
|
||||
Evas_List *l, *ll;
|
||||
Evas_List *apps;
|
||||
E_App *a;
|
||||
|
||||
dia = e_dialog_new(fwin->win->border->zone->container,
|
||||
"E", "_fwin_open_apps");
|
||||
e_dialog_title_set(dia, _("Open with..."));
|
||||
e_dialog_border_icon_set(dia, "enlightenment/applications");
|
||||
e_dialog_button_add(dia, _("Open"), "enlightenment/open", NULL, NULL);
|
||||
e_dialog_button_add(dia, _("Close"), "enlightenment/close", NULL, NULL);
|
||||
|
||||
evas = e_win_evas_get(dia->win);
|
||||
|
||||
o = e_widget_list_add(evas, 1, 1);
|
||||
ocon = o;
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Specific Applications"), 0);
|
||||
/* FIXME: dialog needs data attched to store what u select */
|
||||
o = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
// apps = e_app_mime_list(e_fm_mime_filename_get(file));
|
||||
apps = NULL;
|
||||
if (apps)
|
||||
{
|
||||
for (l = apps; l; l = l->next)
|
||||
{
|
||||
a = l->data;
|
||||
oi = e_app_icon_add(evas, a);
|
||||
e_widget_ilist_append(o, oi, a->name,
|
||||
_e_fwin_cb_ilist_change, NULL,
|
||||
ecore_file_get_file(a->path));
|
||||
}
|
||||
evas_list_free(apps);
|
||||
}
|
||||
e_widget_ilist_go(o);
|
||||
e_widget_min_size_set(o, 160, 240);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
e_widget_list_object_append(ocon, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("All Applications"), 0);
|
||||
/* FIXME: fm2 view etc. etc. */
|
||||
o = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||
e_widget_ilist_go(o);
|
||||
e_widget_min_size_set(o, 160, 240);
|
||||
e_widget_framelist_object_append(of, o);
|
||||
e_widget_list_object_append(ocon, of, 1, 1, 0.5);
|
||||
|
||||
/* FIXME: add rest of widgets */
|
||||
|
||||
e_widget_min_size_get(ocon, &mw, &mh);
|
||||
e_dialog_content_set(dia, ocon, mw, mh);
|
||||
|
||||
e_dialog_show(dia);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/utsname.h>
|
||||
|
@ -321,7 +322,7 @@ precache(void)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int i, do_precache = 1;
|
||||
char buf[16384], **args, *p;
|
||||
|
||||
prefix_determine(argv[0]);
|
||||
|
@ -338,10 +339,36 @@ main(int argc, char **argv)
|
|||
else snprintf(buf, sizeof(buf), "%s/lib", _prefix_path);
|
||||
env_set("LD_LIBRARY_PATH", buf);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!strcmp(argv[i], "-no-precache")) do_precache = 0;
|
||||
}
|
||||
while (do_precache)
|
||||
{
|
||||
void *lib, *func;
|
||||
|
||||
/* sanity checks - if precache might fail - check here first */
|
||||
lib = dlopen("libevas.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) dlopen("libevas.so.1", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) break;
|
||||
func = dlsym(lib, "evas_init");
|
||||
if (!func) break;
|
||||
lib = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) dlopen("libecore_file.so.1", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) break;
|
||||
func = dlsym(lib, "ecore_file_init");
|
||||
if (!func) break;
|
||||
lib = dlopen("libeet.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) dlopen("libeet.so.0", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!lib) break;
|
||||
func = dlsym(lib, "eet_init");
|
||||
if (!func) break;
|
||||
/* precache SHOULD work */
|
||||
snprintf(buf, sizeof(buf), "%s/lib/enlightenment/preload/e_precache.so", _prefix_path);
|
||||
env_set("LD_PRELOAD", buf);
|
||||
|
||||
precache();
|
||||
break;
|
||||
}
|
||||
|
||||
args = alloca((argc + 1) * sizeof(char *));
|
||||
args[0] = "enlightenment";
|
||||
|
|
|
@ -15,7 +15,7 @@ static int do_log = 0;
|
|||
static void
|
||||
log_open(void)
|
||||
{
|
||||
char buf[4096], *home;
|
||||
char buf[4096] = "DUMMY", *home;
|
||||
|
||||
if (log_fd != -1) return;
|
||||
#ifdef HAVE_UNSETENV
|
||||
|
@ -36,7 +36,11 @@ log_open(void)
|
|||
static void
|
||||
log_close(void)
|
||||
{
|
||||
if (log_fd >= 0)
|
||||
{
|
||||
close(log_fd);
|
||||
log_fd = -1;
|
||||
}
|
||||
do_log = 0;
|
||||
}
|
||||
|
||||
|
@ -74,6 +78,23 @@ log_write(const char *type, const char *file)
|
|||
write(log_fd, "\n", 1);
|
||||
}
|
||||
|
||||
static void *
|
||||
lib_func(const char *lib1, const char *lib2, const char *fname, const char *libname, void **lib)
|
||||
{
|
||||
void *func;
|
||||
|
||||
if (!*lib) *lib = dlopen(lib1, RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!*lib) *lib = dlopen(lib2, RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(*lib, fname);
|
||||
if (!func)
|
||||
{
|
||||
printf("ABORT: Can't find %s() in %s or %s (%s = %p)\n",
|
||||
fname, lib1, lib2, libname, *lib);
|
||||
abort();
|
||||
}
|
||||
log_open();
|
||||
return func;
|
||||
}
|
||||
|
||||
/* intercepts */
|
||||
void
|
||||
|
@ -81,12 +102,8 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
{
|
||||
static void (*func) (Evas_Object *obj, const char *file, const char *key) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_evas)
|
||||
lib_evas = dlopen("libevas.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_evas, "evas_object_image_file_set");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libevas.so", "libevas.so.1",
|
||||
"evas_object_image_file_set", "lib_evas", &lib_evas);
|
||||
if (do_log) log_write("o", file);
|
||||
(*func) (obj, file, key);
|
||||
}
|
||||
|
@ -96,12 +113,8 @@ ecore_file_mod_time(const char *file)
|
|||
{
|
||||
static time_t (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_mod_time");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_mod_time", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -111,12 +124,8 @@ ecore_file_size(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_size");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_size", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -126,12 +135,8 @@ ecore_file_exists(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_exists");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_exists", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -141,12 +146,8 @@ ecore_file_is_dir(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_is_dir");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_is_dir", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -156,12 +157,8 @@ ecore_file_can_read(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_can_read");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_can_read", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -171,12 +168,8 @@ ecore_file_can_write(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_can_write");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_can_write", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -186,12 +179,8 @@ ecore_file_can_exec(const char *file)
|
|||
{
|
||||
static int (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_can_exec");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_can_exec", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("s", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -201,12 +190,8 @@ ecore_file_ls(const char *file)
|
|||
{
|
||||
static Ecore_List * (*func) (const char *file) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_ecore_file)
|
||||
lib_ecore_file = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_ecore_file, "ecore_file_ls");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libecore_file.so", "libecore_file.so.1",
|
||||
"ecore_file_ls", "lib_ecore_file", &lib_ecore_file);
|
||||
if (do_log) log_write("d", file);
|
||||
return (*func) (file);
|
||||
}
|
||||
|
@ -216,12 +201,8 @@ eet_open(const char *file, Eet_File_Mode mode)
|
|||
{
|
||||
static Eet_File * (*func) (const char *file, Eet_File_Mode mode) = NULL;
|
||||
if (!func)
|
||||
{
|
||||
if (!lib_eet)
|
||||
lib_eet = dlopen("libeet.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
func = dlsym(lib_eet, "eet_open");
|
||||
log_open();
|
||||
}
|
||||
func = lib_func("libeet.so", "libeet.so.0",
|
||||
"eet_open", "lib_eet", &lib_eet);
|
||||
if (do_log) log_write("o", file);
|
||||
return (*func) (file, mode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue