forked from enlightenment/enlightenment
parent
12e9497d94
commit
38679d522c
|
@ -9,10 +9,40 @@
|
||||||
# define D(x) ((void) 0)
|
# define D(x) ((void) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _E_Fm_Assoc_App E_Fm_Assoc_App;
|
||||||
|
struct _E_Fm_Assoc_App
|
||||||
|
{
|
||||||
|
char *mime;
|
||||||
|
char *app;
|
||||||
|
};
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
static void _e_fm_file_free(E_Fm_File *file);
|
static void _e_fm_file_free(E_Fm_File *file);
|
||||||
|
|
||||||
|
/* TODO Make init and shutdown func that populates the assoc */
|
||||||
|
static E_Config_DD *assoc_app_edd;
|
||||||
|
static Evas_List *assoc_apps;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
E_Fm_Assoc_App *assoc;
|
||||||
|
|
||||||
|
assoc = E_NEW(E_Fm_Assoc_App, 1);
|
||||||
|
assoc->mime = (char*)E_NEW(char *, 5);
|
||||||
|
snprintf(assoc->mime, 5, "%s", ".jpg");
|
||||||
|
assoc->app = (char*)E_NEW(char *, 7);
|
||||||
|
snprintf(assoc->app, 7, "gqview");
|
||||||
|
sd->conf.main->apps = evas_list_append(sd->conf.main->apps, assoc);
|
||||||
|
|
||||||
|
assoc = E_NEW(E_Fm_Assoc_App, 1);
|
||||||
|
assoc->mime = (char*)E_NEW(char *, 5);
|
||||||
|
snprintf(assoc->mime, 5, "%s", ".png");
|
||||||
|
assoc->app = (char*)E_NEW(char *, 7);
|
||||||
|
snprintf(assoc->app, 7, "gqview");
|
||||||
|
sd->conf.main->apps = evas_list_append(sd->conf.main->apps, assoc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
E_Fm_File *
|
E_Fm_File *
|
||||||
e_fm_file_new(const char *filename)
|
e_fm_file_new(const char *filename)
|
||||||
|
@ -58,7 +88,7 @@ e_fm_file_new(const char *filename)
|
||||||
file->preview_funcs[1] = e_fm_file_is_etheme;
|
file->preview_funcs[1] = e_fm_file_is_etheme;
|
||||||
file->preview_funcs[2] = e_fm_file_is_ebg;
|
file->preview_funcs[2] = e_fm_file_is_ebg;
|
||||||
file->preview_funcs[3] = e_fm_file_is_eap;
|
file->preview_funcs[3] = e_fm_file_is_eap;
|
||||||
|
|
||||||
D(("e_fm_file_new: %s\n", filename));
|
D(("e_fm_file_new: %s\n", filename));
|
||||||
return file;
|
return file;
|
||||||
|
|
||||||
|
@ -119,7 +149,7 @@ int
|
||||||
e_fm_file_copy(E_Fm_File *file, const char *name)
|
e_fm_file_copy(E_Fm_File *file, const char *name)
|
||||||
{
|
{
|
||||||
if ((!name) || (!name[0])) return 0;
|
if ((!name) || (!name[0])) return 0;
|
||||||
|
|
||||||
if (ecore_file_cp(file->path, name))
|
if (ecore_file_cp(file->path, name))
|
||||||
{
|
{
|
||||||
free(file->path);
|
free(file->path);
|
||||||
|
@ -140,15 +170,15 @@ int
|
||||||
e_fm_file_can_preview(E_Fm_File *file)
|
e_fm_file_can_preview(E_Fm_File *file)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
D(("e_fm_file_can_preview: (%s) (%p)\n", file->name, file));
|
D(("e_fm_file_can_preview: (%s) (%p)\n", file->name, file));
|
||||||
for (i = 0; i < sizeof(file->preview_funcs); i++)
|
for (i = 0; i < sizeof(file->preview_funcs); i++)
|
||||||
{
|
{
|
||||||
E_Fm_File_Preview_Function func;
|
E_Fm_File_Preview_Function func;
|
||||||
func = file->preview_funcs[i];
|
func = file->preview_funcs[i];
|
||||||
if(func(file))
|
if (func(file))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,15 +190,15 @@ e_fm_file_is_image(E_Fm_File *file)
|
||||||
* canvas.
|
* canvas.
|
||||||
*/
|
*/
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if (!ext) return 0;
|
if (!ext) return 0;
|
||||||
|
|
||||||
D(("e_fm_file_is_image: (%p)\n", file));
|
D(("e_fm_file_is_image: (%p)\n", file));
|
||||||
return (!strcasecmp(ext, ".jpg")) || (!strcasecmp(ext, ".png"))
|
return (!strcasecmp(ext, ".jpg")) || (!strcasecmp(ext, ".png")) ||
|
||||||
|| (!strcasecmp(ext, ".jpeg"));
|
(!strcasecmp(ext, ".jpeg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -177,26 +207,28 @@ e_fm_file_is_etheme(E_Fm_File *file)
|
||||||
int val;
|
int val;
|
||||||
char *ext;
|
char *ext;
|
||||||
Evas_List *groups, *l;
|
Evas_List *groups, *l;
|
||||||
|
|
||||||
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if (!ext) return 0;
|
if (!ext) return 0;
|
||||||
|
|
||||||
if(strcasecmp(ext, ".edj"))
|
if (strcasecmp(ext, ".edj"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
val = 0;
|
val = 0;
|
||||||
groups = edje_file_collection_list(file->path);
|
groups = edje_file_collection_list(file->path);
|
||||||
if(!groups)
|
if (!groups)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (l = groups; l; l = l->next)
|
for (l = groups; l; l = l->next)
|
||||||
if(!strcmp(l->data, "widgets/border/default/border"))
|
{
|
||||||
{
|
if (!strcmp(l->data, "widgets/border/default/border"))
|
||||||
val = 1;
|
{
|
||||||
break;
|
val = 1;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
edje_file_collection_list_free(groups);
|
edje_file_collection_list_free(groups);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -207,28 +239,30 @@ e_fm_file_is_ebg(E_Fm_File *file)
|
||||||
int val;
|
int val;
|
||||||
char *ext;
|
char *ext;
|
||||||
Evas_List *groups, *l;
|
Evas_List *groups, *l;
|
||||||
|
|
||||||
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if (!ext) return 0;
|
if (!ext) return 0;
|
||||||
|
|
||||||
if(strcasecmp(ext, ".edj"))
|
if (strcasecmp(ext, ".edj"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
val = 0;
|
val = 0;
|
||||||
groups = edje_file_collection_list(file->path);
|
groups = edje_file_collection_list(file->path);
|
||||||
if(!groups)
|
if (!groups)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (l = groups; l; l = l->next)
|
for (l = groups; l; l = l->next)
|
||||||
if(!strcmp(l->data, "desktop/background"))
|
{
|
||||||
{
|
if (!strcmp(l->data, "desktop/background"))
|
||||||
val = 1;
|
{
|
||||||
break;
|
val = 1;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
edje_file_collection_list_free(groups);
|
edje_file_collection_list_free(groups);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -236,47 +270,46 @@ e_fm_file_is_eap(E_Fm_File *file)
|
||||||
{
|
{
|
||||||
char *ext;
|
char *ext;
|
||||||
E_App *app;
|
E_App *app;
|
||||||
|
|
||||||
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if (!ext) return 0;
|
if (!ext) return 0;
|
||||||
|
|
||||||
if(strcasecmp(ext, ".eap"))
|
if (strcasecmp(ext, ".eap"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
app = e_app_new(file->path, 0);
|
app = e_app_new(file->path, 0);
|
||||||
if(!app)
|
if (!app)
|
||||||
{
|
{
|
||||||
e_object_unref(E_OBJECT(app));
|
e_object_unref(E_OBJECT(app));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
e_object_unref(E_OBJECT(app));
|
e_object_unref(E_OBJECT(app));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
e_fm_file_can_exec(E_Fm_File *file)
|
e_fm_file_can_exec(E_Fm_File *file)
|
||||||
{
|
{
|
||||||
char *ext;
|
char *ext;
|
||||||
char *fullname;
|
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if(ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
if(!strcasecmp(ext, ".eap"))
|
if (!strcasecmp(ext, ".eap"))
|
||||||
{
|
{
|
||||||
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ecore_file_can_exec(file->path))
|
if (ecore_file_can_exec(file->path))
|
||||||
{
|
{
|
||||||
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
D(("e_fm_file_can_exec: false (%p) (%s)\n", file, file->name));
|
D(("e_fm_file_can_exec: false (%p) (%s)\n", file, file->name));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -286,28 +319,27 @@ e_fm_file_exec(E_Fm_File *file)
|
||||||
{
|
{
|
||||||
Ecore_Exe *exe;
|
Ecore_Exe *exe;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
|
|
||||||
ext = strrchr(file->name, '.');
|
ext = strrchr(file->name, '.');
|
||||||
if(ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
if(!strcasecmp(ext, ".eap"))
|
if (!strcasecmp(ext, ".eap"))
|
||||||
{
|
{
|
||||||
E_App *e_app;
|
E_App *e_app;
|
||||||
Ecore_Exe *exe;
|
Ecore_Exe *exe;
|
||||||
|
|
||||||
e_app = e_app_new(file->path, NULL);
|
e_app = e_app_new(file->path, 0);
|
||||||
|
|
||||||
if(!e_app) return;
|
if (!e_app) return 0;
|
||||||
|
|
||||||
exe = ecore_exe_run(e_app->exe, NULL);
|
exe = ecore_exe_run(e_app->exe, NULL);
|
||||||
if (exe) ecore_exe_free(exe);
|
if (exe) ecore_exe_free(exe);
|
||||||
e_object_unref(E_OBJECT(e_app));
|
e_object_unref(E_OBJECT(e_app));
|
||||||
D(("e_fm_file_exec: eap (%p) (%s)\n", file, file->name));
|
D(("e_fm_file_exec: eap (%p) (%s)\n", file, file->name));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exe = ecore_exe_run(file->path, NULL);
|
exe = ecore_exe_run(file->path, NULL);
|
||||||
if (!exe)
|
if (!exe)
|
||||||
{
|
{
|
||||||
|
@ -327,11 +359,60 @@ e_fm_file_exec(E_Fm_File *file)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_fm_file_assoc_set(E_Fm_File *file, const char *assoc)
|
||||||
|
{
|
||||||
|
/* TODO */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_fm_file_assoc_exec(E_Fm_File *file)
|
||||||
|
{
|
||||||
|
char app[PATH_MAX * 2];
|
||||||
|
Evas_List *l;
|
||||||
|
E_Fm_Assoc_App *assoc;
|
||||||
|
Ecore_Exe *exe;
|
||||||
|
|
||||||
|
for (l = assoc_apps; l; l = l->next)
|
||||||
|
{
|
||||||
|
char *ext;
|
||||||
|
|
||||||
|
assoc = l->data;
|
||||||
|
ext = strrchr(file->path, '.');
|
||||||
|
if ((ext) && (!strcasecmp(ext, assoc->mime)))
|
||||||
|
break;
|
||||||
|
assoc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!assoc) return 0;
|
||||||
|
|
||||||
|
snprintf(app, PATH_MAX * 2, "%s %s", assoc->app, file->path);
|
||||||
|
exe = ecore_exe_run(app, NULL);
|
||||||
|
|
||||||
|
if (!exe)
|
||||||
|
{
|
||||||
|
e_error_dialog_show(_("Run Error"),
|
||||||
|
_("Enlightenment was unable fork a child process:\n"
|
||||||
|
"\n"
|
||||||
|
"%s\n"
|
||||||
|
"\n"),
|
||||||
|
app);
|
||||||
|
D(("e_fm_assoc_exec: fail (%s)\n", app));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ecore_exe_tag_set(exe, "E/app");
|
||||||
|
*/
|
||||||
|
D(("e_fm_assoc_exec: ok (%s)\n", app));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
static void
|
static void
|
||||||
_e_fm_file_free(E_Fm_File *file)
|
_e_fm_file_free(E_Fm_File *file)
|
||||||
{
|
{
|
||||||
D(("_e_fm_file_free: (%p) (%s)\n", file, file->name));
|
D(("_e_fm_file_free: (%p) (%s)\n", file, file->name));
|
||||||
free(file->preview_funcs);
|
free(file->preview_funcs);
|
||||||
if (file->path) free(file->path);
|
if (file->path) free(file->path);
|
||||||
if (file->name) free(file->name);
|
if (file->name) free(file->name);
|
||||||
|
|
|
@ -62,6 +62,7 @@ EAPI int e_fm_file_is_image (E_Fm_File *file);
|
||||||
EAPI int e_fm_file_is_etheme (E_Fm_File *file);
|
EAPI int e_fm_file_is_etheme (E_Fm_File *file);
|
||||||
EAPI int e_fm_file_is_ebg (E_Fm_File *file);
|
EAPI int e_fm_file_is_ebg (E_Fm_File *file);
|
||||||
EAPI int e_fm_file_is_eap (E_Fm_File *file);
|
EAPI int e_fm_file_is_eap (E_Fm_File *file);
|
||||||
|
EAPI int e_fm_file_can_exec (E_Fm_File *file);
|
||||||
EAPI int e_fm_file_exec (E_Fm_File *file);
|
EAPI int e_fm_file_exec (E_Fm_File *file);
|
||||||
EAPI int e_fm_file_assoc_set (E_Fm_File *file, const char *assoc);
|
EAPI int e_fm_file_assoc_set (E_Fm_File *file, const char *assoc);
|
||||||
EAPI int e_fm_file_assoc_exec (E_Fm_File *file);
|
EAPI int e_fm_file_assoc_exec (E_Fm_File *file);
|
||||||
|
|
|
@ -57,9 +57,6 @@ static Evas_List *event_handlers = NULL;
|
||||||
int
|
int
|
||||||
e_fm_icon_init(void)
|
e_fm_icon_init(void)
|
||||||
{
|
{
|
||||||
char *homedir;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
|
|
||||||
event_handlers = evas_list_append(event_handlers,
|
event_handlers = evas_list_append(event_handlers,
|
||||||
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
||||||
_e_fm_icon_thumb_cb_exe_exit,
|
_e_fm_icon_thumb_cb_exe_exit,
|
||||||
|
@ -439,17 +436,17 @@ _e_fm_icon_icon_mime_get(E_Smart_Data *sd)
|
||||||
{
|
{
|
||||||
char part[PATH_MAX];
|
char part[PATH_MAX];
|
||||||
char *ext2;
|
char *ext2;
|
||||||
|
|
||||||
ext = strdup(ext);
|
ext = strdup(ext);
|
||||||
ext2 = ext;
|
ext2 = ext;
|
||||||
for(;*ext2;ext2++)
|
for (; *ext2; ext2++)
|
||||||
*ext2 = (unsigned char)tolower((unsigned char)*ext2);
|
*ext2 = tolower(*ext2);
|
||||||
|
|
||||||
snprintf(part, PATH_MAX, "fileman/icons/%s", (ext + 1));
|
snprintf(part, PATH_MAX, "fileman/icons/%s", (ext + 1));
|
||||||
|
|
||||||
if(!e_theme_edje_object_set(sd->image_object, "base/theme/fileman", part))
|
if (!e_theme_edje_object_set(sd->image_object, "base/theme/fileman", part))
|
||||||
e_theme_edje_object_set(sd->image_object, "base/theme/fileman", "fileman/icons/file");
|
e_theme_edje_object_set(sd->image_object, "base/theme/fileman", "fileman/icons/file");
|
||||||
|
|
||||||
free(ext);
|
free(ext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -494,12 +491,11 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
||||||
sd = thumb_files->data;
|
sd = thumb_files->data;
|
||||||
thumb_files = evas_list_remove_list(thumb_files, thumb_files);
|
thumb_files = evas_list_remove_list(thumb_files, thumb_files);
|
||||||
|
|
||||||
ext = strrchr(sd->file->name, ".");
|
ext = strrchr(sd->file->name, '.');
|
||||||
if(ext)
|
if ((ext) && (strcasecmp(ext, ".eap")))
|
||||||
if(strcasecmp(ext, ".eap"))
|
ext = NULL;
|
||||||
ext = NULL;
|
|
||||||
|
|
||||||
if (ecore_file_exists(sd->thumb_path) || ext)
|
if ((ext) || (ecore_file_exists(sd->thumb_path)))
|
||||||
{
|
{
|
||||||
if (sd->image_object) evas_object_del(sd->image_object);
|
if (sd->image_object) evas_object_del(sd->image_object);
|
||||||
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
typedef struct _E_Event_Fm_Reconfigure E_Event_Fm_Reconfigure;
|
typedef struct _E_Event_Fm_Reconfigure E_Event_Fm_Reconfigure;
|
||||||
typedef struct _E_Event_Fm_Directory_Change E_Event_Fm_Directory_Change;
|
typedef struct _E_Event_Fm_Directory_Change E_Event_Fm_Directory_Change;
|
||||||
typedef struct _E_Fm_Assoc_App E_Fm_Assoc_App;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifndef E_FM_SMART_H
|
#ifndef E_FM_SMART_H
|
||||||
|
@ -23,12 +22,6 @@ struct _E_Event_Fm_Directory_Change
|
||||||
Evas_Coord w, h;
|
Evas_Coord w, h;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _E_Fm_Assoc_App
|
|
||||||
{
|
|
||||||
char *mime;
|
|
||||||
char *app;
|
|
||||||
};
|
|
||||||
|
|
||||||
EAPI int e_fm_init(void);
|
EAPI int e_fm_init(void);
|
||||||
EAPI int e_fm_shutdown(void);
|
EAPI int e_fm_shutdown(void);
|
||||||
EAPI Evas_Object *e_fm_add(Evas *evas);
|
EAPI Evas_Object *e_fm_add(Evas *evas);
|
||||||
|
|
|
@ -22,13 +22,13 @@ e_thumb_init(void)
|
||||||
|
|
||||||
homedir = e_user_homedir_get();
|
homedir = e_user_homedir_get();
|
||||||
if (homedir)
|
if (homedir)
|
||||||
{
|
{
|
||||||
snprintf(path, sizeof(path), "%s/.e/e/fileman/thumbnails", homedir);
|
snprintf(path, sizeof(path), "%s/.e/e/fileman/thumbnails", homedir);
|
||||||
if (!ecore_file_exists(path))
|
if (!ecore_file_exists(path))
|
||||||
ecore_file_mkpath(path);
|
ecore_file_mkpath(path);
|
||||||
thumb_path = strdup(path);
|
thumb_path = strdup(path);
|
||||||
free(homedir);
|
free(homedir);
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -42,10 +42,10 @@ e_thumb_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return dir where thumbs are saved */
|
/* return dir where thumbs are saved */
|
||||||
char *
|
const char *
|
||||||
e_thumb_dir_get(void)
|
e_thumb_dir_get(void)
|
||||||
{
|
{
|
||||||
return strdup(thumb_path);
|
return thumb_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return hashed path of thumb */
|
/* return hashed path of thumb */
|
||||||
|
@ -56,7 +56,7 @@ e_thumb_file_get(char *file)
|
||||||
char thumb[PATH_MAX];
|
char thumb[PATH_MAX];
|
||||||
|
|
||||||
id = _e_thumb_file_id(file);
|
id = _e_thumb_file_id(file);
|
||||||
if(!id) { return NULL; }
|
if (!id) return NULL;
|
||||||
snprintf(thumb, sizeof(thumb), "%s/%s", thumb_path, id);
|
snprintf(thumb, sizeof(thumb), "%s/%s", thumb_path, id);
|
||||||
free(id);
|
free(id);
|
||||||
return strdup(thumb);
|
return strdup(thumb);
|
||||||
|
@ -68,19 +68,17 @@ e_thumb_exists(char *file)
|
||||||
{
|
{
|
||||||
char *thumb;
|
char *thumb;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
ext = strrchr(file, '.');
|
ext = strrchr(file, '.');
|
||||||
if(ext)
|
if ((ext) && (!strcasecmp(ext, ".eap")))
|
||||||
if(!strcasecmp(ext, ".eap"))
|
return 1;
|
||||||
return 1;
|
|
||||||
|
|
||||||
thumb = e_thumb_file_get(file);
|
thumb = e_thumb_file_get(file);
|
||||||
if(ecore_file_exists(thumb))
|
if (ecore_file_exists(thumb))
|
||||||
{
|
{
|
||||||
free(thumb);
|
free(thumb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,22 +96,22 @@ _e_thumb_image_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int *hh,
|
||||||
evas_object_image_size_get(*im, &iw, &ih);
|
evas_object_image_size_get(*im, &iw, &ih);
|
||||||
*alpha = evas_object_image_alpha_get(*im);
|
*alpha = evas_object_image_alpha_get(*im);
|
||||||
if ((iw > 0) && (ih > 0))
|
if ((iw > 0) && (ih > 0))
|
||||||
{
|
{
|
||||||
*ww = w;
|
*ww = w;
|
||||||
*hh = (w * ih) / iw;
|
*hh = (w * ih) / iw;
|
||||||
if (*hh > h)
|
if (*hh > h)
|
||||||
{
|
{
|
||||||
*hh = h;
|
*hh = h;
|
||||||
*ww = (h * iw) / ih;
|
*ww = (h * iw) / ih;
|
||||||
}
|
}
|
||||||
ecore_evas_resize(*buf, *ww, *hh);
|
ecore_evas_resize(*buf, *ww, *hh);
|
||||||
evas_object_image_fill_set(*im, 0, 0, *ww, *hh);
|
evas_object_image_fill_set(*im, 0, 0, *ww, *hh);
|
||||||
evas_object_resize(*im, *ww, *hh);
|
evas_object_resize(*im, *ww, *hh);
|
||||||
evas_object_move(*im, 0, 0);
|
evas_object_move(*im, 0, 0);
|
||||||
evas_object_show(*im);
|
evas_object_show(*im);
|
||||||
|
|
||||||
return ecore_evas_buffer_pixels_get(*buf);
|
return ecore_evas_buffer_pixels_get(*buf);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +135,6 @@ _e_thumb_ebg_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int *hh, in
|
||||||
|
|
||||||
wallpaper = edje_object_add(evasbuf);
|
wallpaper = edje_object_add(evasbuf);
|
||||||
|
|
||||||
|
|
||||||
edje_object_file_set(wallpaper, file, "desktop/background");
|
edje_object_file_set(wallpaper, file, "desktop/background");
|
||||||
|
|
||||||
/* wallpaper */
|
/* wallpaper */
|
||||||
|
@ -242,29 +239,23 @@ e_thumb_create(char *file, Evas_Coord w, Evas_Coord h)
|
||||||
int alpha;
|
int alpha;
|
||||||
|
|
||||||
ext = strrchr(file, '.');
|
ext = strrchr(file, '.');
|
||||||
if(ext)
|
if ((ext) && (!strcasecmp(ext, ".eap")))
|
||||||
{
|
return 1;
|
||||||
if(!strcasecmp(ext, ".eap"))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
thumbpath = e_thumb_file_get(file);
|
thumbpath = e_thumb_file_get(file);
|
||||||
if (!thumbpath)
|
if (!thumbpath)
|
||||||
{
|
return -1;
|
||||||
free(thumbpath);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
if(!strcasecmp(ext, ".edj"))
|
if(!strcasecmp(ext, ".edj"))
|
||||||
{
|
{
|
||||||
/* for now, this function does both the bg and theme previews */
|
/* for now, this function does both the bg and theme previews */
|
||||||
data = _e_thumb_etheme_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
data = _e_thumb_etheme_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
|
||||||
|
|
||||||
|
@ -279,7 +270,7 @@ e_thumb_create(char *file, Evas_Coord w, Evas_Coord h)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
free(thumbpath);
|
free(thumbpath);
|
||||||
|
|
||||||
eet_write(ef, "/thumbnail/orig_path", file, strlen(file), 1);
|
eet_write(ef, "/thumbnail/orig_path", file, strlen(file), 1);
|
||||||
if ((size = eet_data_image_write(ef, "/thumbnail/data",
|
if ((size = eet_data_image_write(ef, "/thumbnail/data",
|
||||||
(void *)data, ww, hh, alpha,
|
(void *)data, ww, hh, alpha,
|
||||||
|
@ -314,31 +305,31 @@ e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord hei
|
||||||
|
|
||||||
/* eap thumbnailer */
|
/* eap thumbnailer */
|
||||||
ext = strrchr(file, '.');
|
ext = strrchr(file, '.');
|
||||||
if(ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
if(!strcasecmp(ext, ".eap"))
|
if (!strcasecmp(ext, ".eap"))
|
||||||
{
|
{
|
||||||
E_App *app;
|
E_App *app;
|
||||||
|
|
||||||
D(("e_thumb_evas_object_get: eap found\n"));
|
D(("e_thumb_evas_object_get: eap found\n"));
|
||||||
app = e_app_new(file, 0);
|
app = e_app_new(file, 0);
|
||||||
D(("e_thumb_evas_object_get: eap loaded\n"));
|
D(("e_thumb_evas_object_get: eap loaded\n"));
|
||||||
if(!app)
|
if (!app)
|
||||||
{
|
{
|
||||||
D(("e_thumb_evas_object_get: invalid eap\n"));
|
D(("e_thumb_evas_object_get: invalid eap\n"));
|
||||||
DEF_THUMB_RETURN;
|
DEF_THUMB_RETURN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
D(("e_thumb_evas_object_get: creating eap thumb\n"));
|
D(("e_thumb_evas_object_get: creating eap thumb\n"));
|
||||||
im = edje_object_add(evas);
|
im = edje_object_add(evas);
|
||||||
edje_object_file_set(im, file, "icon");
|
edje_object_file_set(im, file, "icon");
|
||||||
e_object_unref(E_OBJECT(app));
|
e_object_unref(E_OBJECT(app));
|
||||||
D(("e_thumb_evas_object_get: returning eap thumb\n"));
|
D(("e_thumb_evas_object_get: returning eap thumb\n"));
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* saved thumb */
|
/* saved thumb */
|
||||||
/* TODO: add ability to fetch thumbs from freedesktop dirs */
|
/* TODO: add ability to fetch thumbs from freedesktop dirs */
|
||||||
|
@ -398,7 +389,7 @@ _e_thumb_file_id(char *file)
|
||||||
{
|
{
|
||||||
unsigned int t, tt;
|
unsigned int t, tt;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
t = id[i];
|
t = id[i];
|
||||||
j = 32;
|
j = 32;
|
||||||
while (j > 0)
|
while (j > 0)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
EAPI int e_thumb_init(void);
|
EAPI int e_thumb_init(void);
|
||||||
EAPI int e_thumb_shutdown(void);
|
EAPI int e_thumb_shutdown(void);
|
||||||
EAPI char *e_thumb_dir_get(void);
|
EAPI const char *e_thumb_dir_get(void);
|
||||||
EAPI char *e_thumb_file_get(char *file);
|
EAPI char *e_thumb_file_get(char *file);
|
||||||
EAPI int e_thumb_exists(char *file);
|
EAPI int e_thumb_exists(char *file);
|
||||||
EAPI int e_thumb_create(char *file, Evas_Coord w, Evas_Coord h);
|
EAPI int e_thumb_create(char *file, Evas_Coord w, Evas_Coord h);
|
||||||
|
|
Loading…
Reference in New Issue