forked from enlightenment/enlightenment
- added e_fileman_icon
- added e_fileman_file - fixed scrolling - fixed several bugs / segvs - disabled some features: xdnd, menu operations SVN revision: 17706
This commit is contained in:
parent
8a0ea631a8
commit
61e8c0d0c4
|
@ -84,6 +84,8 @@ e_entry.h \
|
|||
e_fileman.h \
|
||||
e_scrollbar.h \
|
||||
e_fileman_smart.h \
|
||||
e_fileman_file.h \
|
||||
e_fileman_icon.h \
|
||||
e_widget.h \
|
||||
e_widget_check.h \
|
||||
e_widget_radio.h \
|
||||
|
@ -163,6 +165,8 @@ e_entry.c \
|
|||
e_fileman.c \
|
||||
e_scrollbar.c \
|
||||
e_fileman_smart.c \
|
||||
e_fileman_file.c \
|
||||
e_fileman_icon.c \
|
||||
e_widget.c \
|
||||
e_widget_check.c \
|
||||
e_widget_radio.c \
|
||||
|
|
|
@ -5,18 +5,24 @@
|
|||
|
||||
/****
|
||||
* TODO:
|
||||
* - reset scrollbar positions on dir changes
|
||||
* - dont allow for menus on ".."
|
||||
* - add scrollers.
|
||||
* - xdnd
|
||||
* - thumb fork / cache
|
||||
* - proper mime system
|
||||
* - create x, y, w, h in canvas struct and make them auto update
|
||||
****/
|
||||
|
||||
#ifdef EFM_DEBUG
|
||||
# define D(x) do {printf(__FILE__ ":%d: ", __LINE__); printf x; fflush(stdout);} while (0)
|
||||
#else
|
||||
# define D(x) ((void) 0)
|
||||
#endif
|
||||
|
||||
static void _e_fileman_vscrollbar_drag_cb(Evas_Object *object, double value, void *data);
|
||||
static void _e_fileman_reconf_cb(void *data, int type, void *event);
|
||||
static void _e_fileman_cb_resize(E_Win *win);
|
||||
static void _e_fileman_cb_delete(E_Win *win);
|
||||
static void _e_fileman_dir_change_cb(void *data, int type, void *event);
|
||||
static void _e_fileman_resize_cb(E_Win *win);
|
||||
static void _e_fileman_delete_cb(E_Win *win);
|
||||
static void _e_fileman_vscrollbar_show_cb(void *data, Evas_Object *obj, void *ev);
|
||||
static void _e_fileman_vscrollbar_hide_cb(void *data, Evas_Object *obj, void *ev);
|
||||
static void _e_fileman_free(E_Fileman *fileman);
|
||||
|
@ -55,7 +61,7 @@ e_fileman_new(E_Container *con)
|
|||
fileman->xpos = 0;
|
||||
fileman->ypos = 0;
|
||||
|
||||
e_win_delete_callback_set(fileman->win, _e_fileman_cb_delete);
|
||||
e_win_delete_callback_set(fileman->win, _e_fileman_delete_cb);
|
||||
fileman->win->data = fileman;
|
||||
|
||||
fileman->evas = e_win_evas_get(fileman->win);
|
||||
|
@ -73,14 +79,13 @@ e_fileman_new(E_Container *con)
|
|||
evas_object_event_callback_add(fileman->vscrollbar, EVAS_CALLBACK_SHOW, _e_fileman_vscrollbar_show_cb,fileman);
|
||||
evas_object_event_callback_add(fileman->vscrollbar, EVAS_CALLBACK_HIDE, _e_fileman_vscrollbar_show_cb,fileman);
|
||||
|
||||
e_win_resize_callback_set(fileman->win, _e_fileman_cb_resize);
|
||||
e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb);
|
||||
e_win_resize(fileman->win, 640, 480);
|
||||
|
||||
evas_event_freeze(fileman->evas);
|
||||
|
||||
fileman->smart = e_fm_add(fileman->evas);
|
||||
e_fm_e_win_set(fileman->smart, fileman->win);
|
||||
//e_fm_dir_set(fileman->smart, dir);
|
||||
edje_object_part_swallow(fileman->main, "icon_area", fileman->smart);
|
||||
|
||||
ecore_x_dnd_aware_set(fileman->win->evas_win, 1);
|
||||
|
@ -89,8 +94,16 @@ e_fileman_new(E_Container *con)
|
|||
ecore_event_handler_add(E_EVENT_FM_RECONFIGURE,
|
||||
_e_fileman_reconf_cb,
|
||||
fileman));
|
||||
|
||||
fileman->event_handlers = evas_list_append(fileman->event_handlers,
|
||||
ecore_event_handler_add(E_EVENT_FM_DIRECTORY_CHANGE,
|
||||
_e_fileman_dir_change_cb,
|
||||
fileman));
|
||||
|
||||
evas_event_thaw(fileman->evas);
|
||||
|
||||
D(("e_fileman_new: ok\n"));
|
||||
|
||||
return fileman;
|
||||
}
|
||||
|
||||
|
@ -99,6 +112,7 @@ e_fileman_show(E_Fileman *fileman)
|
|||
{
|
||||
if (!fileman) return;
|
||||
|
||||
D(("e_fileman_show: (%p)\n", fileman));
|
||||
e_win_show(fileman->win);
|
||||
evas_object_show(fileman->main);
|
||||
}
|
||||
|
@ -108,6 +122,7 @@ e_fileman_hide(E_Fileman *fileman)
|
|||
{
|
||||
if (!fileman) return;
|
||||
|
||||
D(("e_fileman_hide: (%p)\n", fileman));
|
||||
e_win_hide(fileman->win);
|
||||
evas_object_hide(fileman->main);
|
||||
}
|
||||
|
@ -115,6 +130,7 @@ e_fileman_hide(E_Fileman *fileman)
|
|||
static void
|
||||
_e_fileman_free(E_Fileman *fileman)
|
||||
{
|
||||
D(("e_fileman_free: (%p)\n", fileman));
|
||||
evas_object_del(fileman->vscrollbar);
|
||||
evas_object_del(fileman->smart);
|
||||
evas_object_del(fileman->main);
|
||||
|
@ -124,34 +140,43 @@ _e_fileman_free(E_Fileman *fileman)
|
|||
}
|
||||
|
||||
static void
|
||||
_e_fileman_cb_resize(E_Win *win)
|
||||
_e_fileman_resize_cb(E_Win *win)
|
||||
{
|
||||
E_Fileman *fileman;
|
||||
Evas_Coord w, h;
|
||||
int frozen;
|
||||
|
||||
fileman = win->data;
|
||||
evas_object_resize(fileman->main, win->w, win->h);
|
||||
e_fm_geometry_virtual_get(fileman->smart, &w, &h);
|
||||
|
||||
e_fm_freeze(fileman->smart);
|
||||
D(("_e_fileman_resize_cb: e_fm_freeze\n"));
|
||||
frozen = e_fm_freeze(fileman->smart);
|
||||
if(frozen > 1)
|
||||
e_fm_thaw(fileman->smart);
|
||||
|
||||
|
||||
|
||||
if (h > win->h)
|
||||
{
|
||||
D(("e_fileman_resize_cb: show (%p)\n", fileman));
|
||||
edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
D(("e_fileman_resize_cb: hide (%p)\n", fileman));
|
||||
edje_object_part_unswallow(fileman->main, fileman->vscrollbar);
|
||||
evas_object_hide(fileman->vscrollbar);
|
||||
}
|
||||
|
||||
e_fm_thaw(fileman->smart);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fileman_cb_delete(E_Win *win)
|
||||
_e_fileman_delete_cb(E_Win *win)
|
||||
{
|
||||
E_Fileman *fileman;
|
||||
|
||||
fileman = win->data;
|
||||
D(("e_fileman_delete_cb: (%p)\n", fileman));
|
||||
e_object_del(E_OBJECT(fileman));
|
||||
e_object_del(E_OBJECT(win));
|
||||
}
|
||||
|
@ -162,6 +187,7 @@ _e_fileman_vscrollbar_drag_cb(Evas_Object *object, double value, void *data)
|
|||
E_Fileman *fileman;
|
||||
|
||||
fileman = data;
|
||||
D(("e_fileman_vscrollbar_drag_cb: %f (%p)\n", value, fileman));
|
||||
e_fm_scroll_vertical(fileman->smart, value);
|
||||
}
|
||||
|
||||
|
@ -170,6 +196,7 @@ _e_fileman_reconf_cb(void *data, int type, void *event)
|
|||
{
|
||||
E_Event_Fm_Reconfigure *ev;
|
||||
E_Fileman *fileman;
|
||||
int frozen;
|
||||
|
||||
if(!data || !event)
|
||||
return;
|
||||
|
@ -177,17 +204,40 @@ _e_fileman_reconf_cb(void *data, int type, void *event)
|
|||
fileman = data;
|
||||
ev = event;
|
||||
|
||||
e_fm_freeze(fileman->smart);
|
||||
D(("_e_fileman_reconf_cb: e_fm_freeze\n"));
|
||||
frozen = e_fm_freeze(fileman->smart);
|
||||
if(frozen > 1)
|
||||
e_fm_thaw(fileman->smart);
|
||||
|
||||
if (ev->h > fileman->win->h)
|
||||
{
|
||||
D(("e_fileman_reconf_cb: show (%p)\n", fileman));
|
||||
edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
D(("e_fileman_reconf_cb: hide (%p)\n", fileman));
|
||||
edje_object_part_unswallow(fileman->main, fileman->vscrollbar);
|
||||
evas_object_hide(fileman->vscrollbar);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fileman_dir_change_cb(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Fm_Directory_Change *ev;
|
||||
E_Fileman *fileman;
|
||||
|
||||
if(!data || !event)
|
||||
return;
|
||||
|
||||
fileman = data;
|
||||
ev = event;
|
||||
|
||||
D(("_e_fileman_dir_change_cb:\n"));
|
||||
e_scrollbar_value_set(fileman->vscrollbar, 0.0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fileman_vscrollbar_show_cb(void *data, Evas_Object *obj, void *ev)
|
||||
{
|
||||
|
@ -195,6 +245,7 @@ _e_fileman_vscrollbar_show_cb(void *data, Evas_Object *obj, void *ev)
|
|||
|
||||
fileman = data;
|
||||
|
||||
D(("_e_fileman_vscrollbar_show_cb: thaw (%p)\n", fileman));
|
||||
e_fm_thaw(fileman->smart);
|
||||
}
|
||||
|
||||
|
@ -205,5 +256,6 @@ _e_fileman_vscrollbar_hide_cb(void *data, Evas_Object *obj, void *ev)
|
|||
|
||||
fileman = data;
|
||||
|
||||
D(("_e_fileman_vscrollbar_hide_cb: thaw (%p)\n", fileman));
|
||||
e_fm_thaw(fileman->smart);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
#ifdef EFM_DEBUG
|
||||
# define D(x) do {printf(__FILE__ ":%d: ", __LINE__); printf x; fflush(stdout);} while (0)
|
||||
#else
|
||||
# define D(x) ((void) 0)
|
||||
#endif
|
||||
|
||||
|
||||
/* local subsystem functions */
|
||||
static void _e_fm_file_free(E_Fm_File *file);
|
||||
|
||||
/* externally accessible functions */
|
||||
E_Fm_File *
|
||||
e_fm_file_new(const char *filename)
|
||||
{
|
||||
E_Fm_File *file;
|
||||
struct stat st;
|
||||
|
||||
if (stat(filename, &st) == -1) return NULL;
|
||||
|
||||
file = E_OBJECT_ALLOC(E_Fm_File, E_FM_FILE_TYPE, _e_fm_file_free);
|
||||
if (!file) return NULL;
|
||||
file->path = strdup(filename);
|
||||
if (!file->path) goto error;
|
||||
file->name = strdup(ecore_file_get_file(filename));
|
||||
if (!file->name) goto error;
|
||||
/* Get attributes */
|
||||
file->device = st.st_dev;
|
||||
file->inode = st.st_ino;
|
||||
file->mode = st.st_mode;
|
||||
file->nlink = st.st_nlink;
|
||||
file->owner = st.st_uid;
|
||||
file->group = st.st_gid;
|
||||
file->rdev = st.st_rdev;
|
||||
file->size = st.st_size;
|
||||
file->atime = st.st_atime;
|
||||
file->mtime = st.st_mtime;
|
||||
file->ctime = st.st_ctime;
|
||||
|
||||
if (S_ISDIR(file->mode))
|
||||
file->type |= E_FM_FILE_TYPE_DIRECTORY;
|
||||
else if (S_ISREG(file->mode))
|
||||
file->type = E_FM_FILE_TYPE_FILE;
|
||||
else if (S_ISLNK(file->mode))
|
||||
file->type = E_FM_FILE_TYPE_SYMLINK;
|
||||
else
|
||||
file->type = E_FM_FILE_TYPE_UNKNOWN;
|
||||
|
||||
if (file->name[0] == '.')
|
||||
file->type |= E_FM_FILE_TYPE_HIDDEN;
|
||||
|
||||
D(("e_fm_file_new: %s\n", filename));
|
||||
return file;
|
||||
|
||||
error:
|
||||
if (file->path) free(file->path);
|
||||
if (file->name) free(file->name);
|
||||
free(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_rename(E_Fm_File *file, const char *name)
|
||||
{
|
||||
char path[PATH_MAX], *dir;
|
||||
|
||||
if ((!name) || (!name[0])) return 0;
|
||||
|
||||
dir = ecore_file_get_dir(file->path);
|
||||
if (!dir) return 0;
|
||||
snprintf(path, sizeof(path), "%s/%s", dir, name);
|
||||
|
||||
if (ecore_file_mv(file->path, path))
|
||||
{
|
||||
free(file->path);
|
||||
file->path = strdup(path);
|
||||
free(file->name);
|
||||
file->name = strdup(name);
|
||||
D(("e_fm_file_rename: ok (%p) (%s)\n", file, name));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
D(("e_fm_file_rename: fail (%p) (%s)\n", file, name));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_delete(E_Fm_File *file)
|
||||
{
|
||||
if (ecore_file_unlink(file->path))
|
||||
{
|
||||
free(file->path);
|
||||
file->path = NULL;
|
||||
free(file->name);
|
||||
file->name = NULL;
|
||||
D(("e_fm_file_delete: ok (%p) (%s)\n", file, file->name));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
D(("e_fm_file_delete: fail (%p) (%s)\n", file, file->name));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_copy(E_Fm_File *file, const char *name)
|
||||
{
|
||||
if ((!name) || (!name[0])) return 0;
|
||||
|
||||
if (ecore_file_cp(file->path, name))
|
||||
{
|
||||
free(file->path);
|
||||
file->path = strdup(name);
|
||||
free(file->name);
|
||||
file->name = strdup(ecore_file_get_file(name));
|
||||
D(("e_fm_file_copy: ok (%p) (%s)\n", file, name));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
D(("e_fm_file_copy: fail (%p) (%s)\n", file, name));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_is_image(E_Fm_File *file)
|
||||
{
|
||||
/* We need to check if it is a filetype supported by evas.
|
||||
* If it isn't supported by evas, we can't show it in the
|
||||
* canvas.
|
||||
*/
|
||||
char *ext;
|
||||
|
||||
if ((file->type != E_FM_FILE_TYPE_FILE) && (file->type != E_FM_FILE_TYPE_SYMLINK)) return 0;
|
||||
|
||||
ext = strrchr(file->name, '.');
|
||||
if (!ext) return 0;
|
||||
|
||||
D(("e_fm_file_is_image: (%p)\n", file));
|
||||
return (!strcasecmp(ext, ".jpg")) || (!strcasecmp(ext, ".png"));
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_can_exec(E_Fm_File *file)
|
||||
{
|
||||
char *ext;
|
||||
char *fullname;
|
||||
|
||||
ext = strrchr(file->name, '.');
|
||||
if(ext)
|
||||
{
|
||||
if(!strcasecmp(ext, ".eap"))
|
||||
{
|
||||
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(ecore_file_can_exec(file->path))
|
||||
{
|
||||
D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
D(("e_fm_file_can_exec: false (%p) (%s)\n", file, file->name));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_file_exec(E_Fm_File *file)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
char *ext;
|
||||
|
||||
|
||||
ext = strrchr(file->name, '.');
|
||||
if(ext)
|
||||
{
|
||||
if(!strcasecmp(ext, ".eap"))
|
||||
{
|
||||
E_App *e_app;
|
||||
Ecore_Exe *exe;
|
||||
|
||||
e_app = e_app_new(file->path, NULL);
|
||||
|
||||
if(!e_app) return;
|
||||
|
||||
exe = ecore_exe_run(e_app->exe, NULL);
|
||||
if (exe) ecore_exe_free(exe);
|
||||
e_object_unref(E_OBJECT(e_app));
|
||||
D(("e_fm_file_exec: eap (%p) (%s)\n", file, file->name));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
exe = ecore_exe_run(file->path, NULL);
|
||||
if (!exe)
|
||||
{
|
||||
e_error_dialog_show(_("Run Error"),
|
||||
_("Enlightenment was unable fork a child process:\n"
|
||||
"\n"
|
||||
"%s\n"
|
||||
"\n"),
|
||||
file->path);
|
||||
D(("e_fm_file_exec: fail (%p) (%s)\n", file, file->name));
|
||||
return 0;
|
||||
}
|
||||
/* E/app is the correct tag if the data is en E_App!
|
||||
ecore_exe_tag_set(exe, "E/app");
|
||||
*/
|
||||
D(("e_fm_file_exec: ok (%p) (%s)\n", file, file->name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_fm_file_free(E_Fm_File *file)
|
||||
{
|
||||
D(("_e_fm_file_free: (%p) (%s)\n", file, file->name));
|
||||
if (file->path) free(file->path);
|
||||
if (file->name) free(file->name);
|
||||
free(file);
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifdef E_TYPEDEFS
|
||||
|
||||
typedef struct _E_Fm_File E_Fm_File;
|
||||
typedef struct _E_Fm_File_Attributes E_Fm_File_Attributes;
|
||||
|
||||
#define E_FM_FILE_TYPE_FILE (1 << 8)
|
||||
#define E_FM_FILE_TYPE_DIRECTORY (1 << 9)
|
||||
#define E_FM_FILE_TYPE_SYMLINK (1 << 10)
|
||||
#define E_FM_FILE_TYPE_UNKNOWN (1 << 11)
|
||||
#define E_FM_FILE_TYPE_HIDDEN (1 << 12)
|
||||
|
||||
#define E_FM_FILE_TYPE_NORMAL E_FM_FILE_TYPE_FILE|E_FM_FILE_TYPE_DIRECTORY|E_FM_FILE_TYPE_SYMLINK
|
||||
#define E_FM_FILE_TYPE_ALL E_FM_FILE_TYPE_NORMAL|E_FM_FILE_TYPE_HIDDEN
|
||||
|
||||
#else
|
||||
#ifndef E_FILEMAN_FILE_H
|
||||
#define E_FILEMAN_FILE_H
|
||||
|
||||
#define E_FM_FILE_TYPE 0xE0b01018
|
||||
|
||||
struct _E_Fm_File
|
||||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
int type;
|
||||
|
||||
Evas *evas;
|
||||
Evas_Object *icon_object;
|
||||
/* Do we need those?
|
||||
* Evas_Object *image_object;
|
||||
* Evas_Object *event_object;
|
||||
*/
|
||||
|
||||
char *path; /* full name with path */
|
||||
char *name; /* file name without parent directories */
|
||||
|
||||
dev_t device; /* ID of device containing file */
|
||||
ino_t inode; /* inode number */
|
||||
mode_t mode; /* protection */
|
||||
nlink_t nlink; /* number of hard links */
|
||||
uid_t owner; /* user ID of owner */
|
||||
gid_t group; /* group ID of owner */
|
||||
dev_t rdev; /* device ID (if special file) */
|
||||
off_t size; /* total size, in bytes */
|
||||
time_t atime; /* time of last access */
|
||||
time_t mtime; /* time of last modification */
|
||||
time_t ctime; /* time of last status change */
|
||||
};
|
||||
|
||||
EAPI E_Fm_File *e_fm_file_new (const char *filename);
|
||||
EAPI int e_fm_file_rename (E_Fm_File *file, const char *name);
|
||||
EAPI int e_fm_file_delete (E_Fm_File *file);
|
||||
EAPI int e_fm_file_copy (E_Fm_File *file, const char *name);
|
||||
EAPI int e_fm_file_is_image (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_exec (E_Fm_File *file);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,526 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
typedef struct _E_Smart_Data E_Smart_Data;
|
||||
|
||||
struct _E_Smart_Data
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
Evas *evas;
|
||||
Evas_Object *obj;
|
||||
|
||||
char *thumb_path;
|
||||
|
||||
Evas_Object *event_object;
|
||||
Evas_Object *icon_object;
|
||||
Evas_Object *image_object;
|
||||
Evas_Object *entry_object;
|
||||
|
||||
E_Fm_File *file;
|
||||
|
||||
unsigned char visible : 1;
|
||||
};
|
||||
|
||||
/* local subsystem functions */
|
||||
static void _e_fm_icon_smart_add (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_del (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_layer_set (Evas_Object *obj, int l);
|
||||
static void _e_fm_icon_smart_raise (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_lower (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_stack_above (Evas_Object *obj, Evas_Object *above);
|
||||
static void _e_fm_icon_smart_stack_below (Evas_Object *obj, Evas_Object *below);
|
||||
static void _e_fm_icon_smart_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _e_fm_icon_smart_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_fm_icon_smart_show (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_hide (Evas_Object *obj);
|
||||
static void _e_fm_icon_smart_clip_set (Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_fm_icon_smart_clip_unset (Evas_Object *obj);
|
||||
|
||||
/* Create icons */
|
||||
static void _e_fm_icon_icon_mime_get(E_Smart_Data *sd);
|
||||
|
||||
static void _e_fm_icon_thumb_job_generate(void *data);
|
||||
static int _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_Smart *e_smart = NULL;
|
||||
|
||||
static pid_t pid = -1;
|
||||
static Evas_List *thumb_files = NULL;
|
||||
static Ecore_Job *thumb_job = NULL;
|
||||
|
||||
static Evas_List *event_handlers = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
e_fm_icon_init(void)
|
||||
{
|
||||
char *homedir;
|
||||
char path[PATH_MAX];
|
||||
|
||||
event_handlers = evas_list_append(event_handlers,
|
||||
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
||||
_e_fm_icon_thumb_cb_exe_exit,
|
||||
NULL));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_icon_shutdown(void)
|
||||
{
|
||||
while (event_handlers)
|
||||
{
|
||||
ecore_event_handler_del(event_handlers->data);
|
||||
event_handlers = evas_list_remove_list(event_handlers, event_handlers);
|
||||
}
|
||||
evas_list_free(thumb_files);
|
||||
evas_smart_free(e_smart);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
e_fm_icon_add(Evas *evas)
|
||||
{
|
||||
Evas_Object *e_fm_icon_smart;
|
||||
|
||||
if (!e_smart)
|
||||
{
|
||||
e_smart = evas_smart_new("e_fm_icon_smart",
|
||||
_e_fm_icon_smart_add,
|
||||
_e_fm_icon_smart_del,
|
||||
_e_fm_icon_smart_layer_set,
|
||||
_e_fm_icon_smart_raise,
|
||||
_e_fm_icon_smart_lower,
|
||||
_e_fm_icon_smart_stack_above,
|
||||
_e_fm_icon_smart_stack_below,
|
||||
_e_fm_icon_smart_move,
|
||||
_e_fm_icon_smart_resize,
|
||||
_e_fm_icon_smart_show,
|
||||
_e_fm_icon_smart_hide,
|
||||
NULL,
|
||||
_e_fm_icon_smart_clip_set,
|
||||
_e_fm_icon_smart_clip_unset,
|
||||
NULL);
|
||||
}
|
||||
|
||||
e_fm_icon_smart = evas_object_smart_add(evas, e_smart);
|
||||
|
||||
return e_fm_icon_smart;
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
e_object_ref(E_OBJECT(file));
|
||||
sd->file = file;
|
||||
file->icon_object = obj;
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_title_set(Evas_Object *obj, const char *title)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (sd->icon_object) edje_object_part_text_set(sd->icon_object, "icon_title", title);
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_edit_entry_set(Evas_Object *obj, Evas_Object *entry)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (entry)
|
||||
{
|
||||
sd->entry_object = entry;
|
||||
edje_object_part_swallow(sd->icon_object, "icon_title_edit_swallow", sd->entry_object);
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_part_unswallow(sd->icon_object, sd->entry_object);
|
||||
sd->entry_object = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_signal_emit(Evas_Object *obj, const char *source, const char *emission)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (sd->icon_object) edje_object_signal_emit(sd->icon_object, source, emission);
|
||||
if (sd->image_object) edje_object_signal_emit(sd->image_object, source, emission);
|
||||
}
|
||||
|
||||
int
|
||||
e_fm_icon_assoc_set(Evas_Object *obj, const char *assoc)
|
||||
{
|
||||
/* TODO
|
||||
* Store the associated exe in a cfg
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_fm_icon_smart_add(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = E_NEW(E_Smart_Data, 1);
|
||||
if (!sd) return;
|
||||
|
||||
sd->evas = evas_object_evas_get(obj);
|
||||
sd->obj = obj;
|
||||
|
||||
sd->event_object = evas_object_rectangle_add(sd->evas);
|
||||
evas_object_color_set(sd->event_object, 0, 0, 0, 0);
|
||||
evas_object_smart_member_add(sd->event_object, obj);
|
||||
|
||||
evas_object_smart_data_set(obj, sd);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_del(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (sd->entry_object) edje_object_part_unswallow(sd->icon_object, sd->entry_object);
|
||||
if (sd->event_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->event_object);
|
||||
evas_object_del(sd->event_object);
|
||||
}
|
||||
if (sd->icon_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->icon_object);
|
||||
evas_object_del(sd->icon_object);
|
||||
}
|
||||
if (sd->image_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->image_object);
|
||||
evas_object_del(sd->image_object);
|
||||
}
|
||||
if (sd->file) e_object_unref(E_OBJECT(sd->file));
|
||||
free(sd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_layer_set(Evas_Object *obj, int l)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_layer_set(sd->event_object, l);
|
||||
if (sd->icon_object) evas_object_layer_set(sd->icon_object, l);
|
||||
if (sd->image_object) evas_object_layer_set(sd->image_object, l);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_raise(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_raise(sd->event_object);
|
||||
if (sd->icon_object) evas_object_stack_below(sd->icon_object, sd->event_object);
|
||||
if (sd->image_object) evas_object_stack_below(sd->image_object, sd->event_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_lower(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_lower(sd->event_object);
|
||||
if (sd->icon_object) evas_object_stack_below(sd->icon_object, sd->event_object);
|
||||
if (sd->image_object) evas_object_stack_below(sd->image_object, sd->event_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_stack_above(Evas_Object *obj, Evas_Object *above)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_stack_above(sd->event_object, above);
|
||||
if (sd->icon_object) evas_object_stack_below(sd->icon_object, sd->event_object);
|
||||
if (sd->image_object) evas_object_stack_below(sd->image_object, sd->event_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_stack_below(Evas_Object *obj, Evas_Object *below)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_stack_below(sd->event_object, below);
|
||||
if (sd->icon_object) evas_object_stack_below(sd->icon_object, sd->event_object);
|
||||
if (sd->image_object) evas_object_stack_below(sd->image_object, sd->event_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
if(sd->x == x && sd->y == y) return;
|
||||
|
||||
evas_object_move(sd->event_object, x, y);
|
||||
if (sd->icon_object) evas_object_move(sd->icon_object, x, y);
|
||||
//if (sd->image_object) evas_object_move(sd->image_object, x, y);
|
||||
sd->x = x;
|
||||
sd->y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
if(sd->w == w && sd->h == h) return;
|
||||
|
||||
evas_object_resize(sd->event_object, w, h);
|
||||
if (sd->icon_object) evas_object_resize(sd->icon_object, w, h);
|
||||
sd->w = w;
|
||||
sd->h = h;
|
||||
//if (sd->image_object) evas_object_resize(sd->image_object, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_show(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if ((!sd) && (!sd->file)) return;
|
||||
if (sd->visible) return;
|
||||
|
||||
evas_object_show(sd->event_object);
|
||||
sd->visible = 1;
|
||||
sd->icon_object = edje_object_add(sd->evas);
|
||||
e_theme_edje_object_set(sd->icon_object, "base/theme/fileman",
|
||||
"fileman/icon");
|
||||
evas_object_smart_member_add(sd->icon_object, obj);
|
||||
|
||||
if (e_fm_file_is_image(sd->file))
|
||||
{
|
||||
sd->thumb_path = e_thumb_file_get(sd->file->path);
|
||||
if (ecore_file_exists(sd->thumb_path))
|
||||
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
||||
sd->evas,
|
||||
sd->w,
|
||||
sd->h);
|
||||
else
|
||||
{
|
||||
thumb_files = evas_list_append(thumb_files, sd);
|
||||
if (thumb_job) ecore_job_del(thumb_job);
|
||||
thumb_job = ecore_job_add(_e_fm_icon_thumb_job_generate, NULL);
|
||||
_e_fm_icon_icon_mime_get(sd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_e_fm_icon_icon_mime_get(sd);
|
||||
}
|
||||
|
||||
if (sd->image_object)
|
||||
{
|
||||
edje_object_part_swallow(sd->icon_object, "icon_swallow", sd->image_object);
|
||||
evas_object_smart_member_add(sd->image_object, obj);
|
||||
}
|
||||
edje_object_part_text_set(sd->icon_object, "icon_title", sd->file->name);
|
||||
|
||||
evas_object_show(sd->icon_object);
|
||||
|
||||
{
|
||||
Evas_Coord icon_w, icon_h;
|
||||
edje_object_size_min_calc(sd->icon_object, &icon_w, &icon_h);
|
||||
evas_object_resize(sd->icon_object, icon_w, icon_h);
|
||||
evas_object_resize(sd->event_object, icon_w, icon_h);
|
||||
evas_object_resize(sd->obj, icon_w, icon_h);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_hide(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (!sd->visible) return;
|
||||
|
||||
evas_object_hide(sd->event_object);
|
||||
sd->visible = 0;
|
||||
if (sd->icon_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->icon_object);
|
||||
evas_object_del(sd->icon_object);
|
||||
}
|
||||
sd->icon_object = NULL;
|
||||
if (sd->image_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->image_object);
|
||||
evas_object_del(sd->image_object);
|
||||
}
|
||||
sd->image_object = NULL;
|
||||
if (sd->thumb_path) free(sd->thumb_path);
|
||||
sd->thumb_path = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_clip_set(sd->event_object, clip);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_smart_clip_unset(Evas_Object *obj)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
|
||||
evas_object_clip_unset(sd->event_object);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_icon_mime_get(E_Smart_Data *sd)
|
||||
{
|
||||
sd->image_object = edje_object_add(sd->evas);
|
||||
|
||||
if (sd->file->type == E_FM_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
|
||||
"fileman/icons/folder");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ext;
|
||||
|
||||
ext = strrchr(sd->file->name, '.');
|
||||
if (ext)
|
||||
{
|
||||
char part[PATH_MAX];
|
||||
char *ext2;
|
||||
|
||||
ext = strdup(ext);
|
||||
ext2 = ext;
|
||||
for(;*ext2;ext2++)
|
||||
*ext2 = (unsigned char)tolower((unsigned char)*ext2);
|
||||
|
||||
snprintf(part, PATH_MAX, "fileman/icons/%s", (ext + 1));
|
||||
|
||||
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");
|
||||
|
||||
free(ext);
|
||||
}
|
||||
else
|
||||
e_theme_edje_object_set(sd->image_object, "base/theme/fileman", "fileman/icons/file");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_fm_icon_thumb_job_generate(void *data)
|
||||
{
|
||||
if ((!thumb_files) || (pid != -1))return;
|
||||
|
||||
pid = fork();
|
||||
thumb_job = NULL;
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
/* child */
|
||||
Evas_List *l;
|
||||
for (l = thumb_files; l; l = l->next)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
sd = l->data;
|
||||
if(!e_thumb_exists(sd->file->path))
|
||||
e_thumb_create(sd->file->path, sd->w, sd->h);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Event_Exe_Exit *ev;
|
||||
Evas_List *l;
|
||||
|
||||
ev = event;
|
||||
if (ev->pid != pid) return 1;
|
||||
for (l = thumb_files; l;)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = l->data;
|
||||
if (ecore_file_exists(sd->thumb_path))
|
||||
{
|
||||
Evas_List *tmp;
|
||||
if (sd->image_object) evas_object_del(sd->image_object);
|
||||
sd->image_object = NULL;
|
||||
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
||||
sd->evas,
|
||||
sd->w, sd->h);
|
||||
edje_object_part_swallow(sd->icon_object, "icon_swallow",
|
||||
sd->image_object);
|
||||
tmp = l;
|
||||
l = l->next;
|
||||
thumb_files = evas_list_remove_list(thumb_files, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
l = l->next;
|
||||
}
|
||||
}
|
||||
|
||||
pid = -1;
|
||||
if (thumb_files)
|
||||
{
|
||||
if (thumb_job) ecore_job_del(thumb_job);
|
||||
thumb_job = ecore_job_add(_e_fm_icon_thumb_job_generate, NULL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifdef E_TYPEDEFS
|
||||
|
||||
#else
|
||||
#ifndef E_FILEMAN_FILE_SMART_H
|
||||
#define E_FILEMAN_FILE_SMART_H
|
||||
|
||||
EAPI int e_fm_icon_init(void);
|
||||
EAPI int e_fm_icon_shutdown(void);
|
||||
EAPI Evas_Object *e_fm_icon_add(Evas *evas);
|
||||
EAPI void e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file);
|
||||
EAPI void e_fm_icon_title_set(Evas_Object *obj, const char *title);
|
||||
EAPI void e_fm_icon_edit_entry_set(Evas_Object *obj, Evas_Object *entry);
|
||||
EAPI void e_fm_icon_signal_emit(Evas_Object *obj, const char *source, const char *emission);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,8 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
|
||||
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_Fm_Assoc_App E_Fm_Assoc_App;
|
||||
|
||||
#else
|
||||
#ifndef E_FM_SMART_H
|
||||
|
@ -15,6 +17,19 @@ struct _E_Event_Fm_Reconfigure
|
|||
Evas_Coord w, h;
|
||||
};
|
||||
|
||||
struct _E_Event_Fm_Directory_Change
|
||||
{
|
||||
Evas_Object *object;
|
||||
Evas_Coord w, h;
|
||||
};
|
||||
|
||||
struct _E_Fm_Assoc_App
|
||||
{
|
||||
char *mime;
|
||||
char *app;
|
||||
};
|
||||
|
||||
|
||||
EAPI Evas_Object *e_fm_add(Evas *evas);
|
||||
EAPI void e_fm_dir_set(Evas_Object *object, const char *dir);
|
||||
EAPI char *e_fm_dir_get(Evas_Object *object);
|
||||
|
@ -30,5 +45,6 @@ EAPI int e_fm_freeze(Evas_Object *freeze);
|
|||
EAPI int e_fm_thaw(Evas_Object *freeze);
|
||||
|
||||
extern int E_EVENT_FM_RECONFIGURE;
|
||||
extern int E_EVENT_FM_DIRECTORY_CHANGE;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
#include "e_scrollbar.h"
|
||||
#include "e_fileman.h"
|
||||
#include "e_fileman_smart.h"
|
||||
#include "e_fileman_file.h"
|
||||
#include "e_fileman_icon.h"
|
||||
#include "e_widget.h"
|
||||
#include "e_widget_check.h"
|
||||
#include "e_widget_radio.h"
|
||||
|
|
|
@ -732,6 +732,7 @@ _e_main_screens_init(void)
|
|||
if (!e_gadman_init()) return 0;
|
||||
if (!e_menu_init()) return 0;
|
||||
if (!e_thumb_init()) return 0;
|
||||
if (!e_fm_icon_init()) return 0;
|
||||
if (!e_fm_init()) return 0;
|
||||
|
||||
num = 0;
|
||||
|
@ -788,6 +789,7 @@ static int
|
|||
_e_main_screens_shutdown(void)
|
||||
{
|
||||
e_fm_shutdown();
|
||||
e_fm_icon_shutdown();
|
||||
e_thumb_shutdown();
|
||||
e_win_shutdown();
|
||||
e_border_shutdown();
|
||||
|
|
|
@ -35,12 +35,14 @@ e_thumb_shutdown(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* return dir where thumbs are saved */
|
||||
char *
|
||||
e_thumb_dir_get(void)
|
||||
{
|
||||
return strdup(thumb_path);
|
||||
}
|
||||
|
||||
/* return hashed path of thumb */
|
||||
char *
|
||||
e_thumb_file_get(char *file)
|
||||
{
|
||||
|
@ -48,12 +50,13 @@ e_thumb_file_get(char *file)
|
|||
char thumb[PATH_MAX];
|
||||
|
||||
id = _e_thumb_file_id(file);
|
||||
if(!thumb) { free(id); return NULL; }
|
||||
if(!id) { return NULL; }
|
||||
snprintf(thumb, sizeof(thumb), "%s/%s", thumb_path, id);
|
||||
free(id);
|
||||
return strdup(thumb);
|
||||
}
|
||||
|
||||
/* check wether a file has a saved thumb */
|
||||
int
|
||||
e_thumb_exists(char *file)
|
||||
{
|
||||
|
@ -67,6 +70,7 @@ e_thumb_exists(char *file)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* create and save a thumb to disk */
|
||||
int
|
||||
e_thumb_create(char *file, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
|
@ -112,6 +116,7 @@ e_thumb_create(char *file, Evas_Coord w, Evas_Coord h)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* get evas object containing image of the thumb */
|
||||
Evas_Object *
|
||||
e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord height)
|
||||
{
|
||||
|
@ -180,7 +185,7 @@ e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord hei
|
|||
if (data)
|
||||
{
|
||||
im = evas_object_image_add(evas);
|
||||
evas_object_image_alpha_set(im, 0);
|
||||
evas_object_image_alpha_set(im, 1);
|
||||
evas_object_image_size_set(im, w, h);
|
||||
evas_object_image_smooth_scale_set(im, 0);
|
||||
evas_object_image_data_copy_set(im, data);
|
||||
|
@ -198,6 +203,7 @@ e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord hei
|
|||
return im;
|
||||
}
|
||||
|
||||
/* return hash for a file */
|
||||
static char *
|
||||
_e_thumb_file_id(char *file)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue