forked from enlightenment/enlightenment
- make e_thumb fork internally
- add queue / dequeue calls to e_thumb - change e_icon_layout to e_icon_grid - add e_icon_canvas which will eventually allow for free icon placement and optimized scrolling using a tiles principle - add new calls to e_widget_image - add new bg selector (broken because of a segv on cancel press, needs fixing) NOTES: - bg selector needs fixing. - efm still needs work, will segv if you scroll while files are generated - other efm bugs exist so I would advise that you dont use it atm - if we dont need e_icon_grid (strict grid layout) we should remove it. SVN revision: 18593
This commit is contained in:
parent
57a8d8af40
commit
97cc78cdb0
|
@ -97,9 +97,10 @@ e_widget_entry.h \
|
||||||
e_widget_image.h \
|
e_widget_image.h \
|
||||||
e_config_dialog.h \
|
e_config_dialog.h \
|
||||||
e_int_config_focus.h \
|
e_int_config_focus.h \
|
||||||
|
e_icon_grid.h \
|
||||||
|
e_icon_canvas.h \
|
||||||
e_int_config_desks.h \
|
e_int_config_desks.h \
|
||||||
e_configure.h \
|
e_configure.h \
|
||||||
e_icon_layout.h \
|
|
||||||
e_int_border_locks.h \
|
e_int_border_locks.h \
|
||||||
e_thumb.h \
|
e_thumb.h \
|
||||||
e_int_border_remember.h \
|
e_int_border_remember.h \
|
||||||
|
@ -117,7 +118,8 @@ e_widget_ilist.h \
|
||||||
e_slider.h \
|
e_slider.h \
|
||||||
e_widget_slider.h \
|
e_widget_slider.h \
|
||||||
e_int_config_window_manipulation.h \
|
e_int_config_window_manipulation.h \
|
||||||
e_int_config_window_display.h
|
e_int_config_window_display.h \
|
||||||
|
e_int_config_background.h
|
||||||
|
|
||||||
enlightenment_src = \
|
enlightenment_src = \
|
||||||
e_user.c \
|
e_user.c \
|
||||||
|
@ -195,9 +197,10 @@ e_widget_entry.c \
|
||||||
e_widget_image.c \
|
e_widget_image.c \
|
||||||
e_config_dialog.c \
|
e_config_dialog.c \
|
||||||
e_int_config_focus.c \
|
e_int_config_focus.c \
|
||||||
|
e_icon_grid.c \
|
||||||
|
e_icon_canvas.c \
|
||||||
e_int_config_desks.c \
|
e_int_config_desks.c \
|
||||||
e_configure.c \
|
e_configure.c \
|
||||||
e_icon_layout.c \
|
|
||||||
e_int_border_locks.c \
|
e_int_border_locks.c \
|
||||||
e_thumb.c \
|
e_thumb.c \
|
||||||
e_int_border_remember.c \
|
e_int_border_remember.c \
|
||||||
|
@ -216,6 +219,7 @@ e_slider.c \
|
||||||
e_widget_slider.c \
|
e_widget_slider.c \
|
||||||
e_int_config_window_manipulation.c \
|
e_int_config_window_manipulation.c \
|
||||||
e_int_config_window_display.c \
|
e_int_config_window_display.c \
|
||||||
|
e_int_config_background.c \
|
||||||
$(ENLIGHTENMENTHEADERS)
|
$(ENLIGHTENMENTHEADERS)
|
||||||
|
|
||||||
enlightenment_SOURCES = \
|
enlightenment_SOURCES = \
|
||||||
|
|
|
@ -62,6 +62,7 @@ e_configure_show(E_Container *con)
|
||||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Desktop Settings"), e_int_config_desks);
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Desktop Settings"), e_int_config_desks);
|
||||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation);
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation);
|
||||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display);
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display);
|
||||||
|
//e_configure_standard_item_add(eco, "enlightenment/desktops", _("Background Settings"), e_int_config_background);
|
||||||
|
|
||||||
/* FIXME: we should have a way for modules to hook in here and add their
|
/* FIXME: we should have a way for modules to hook in here and add their
|
||||||
* own entries
|
* own entries
|
||||||
|
|
|
@ -88,7 +88,6 @@ e_fileman_new_to_dir(E_Container *con, char *path)
|
||||||
evas_event_freeze(fileman->evas);
|
evas_event_freeze(fileman->evas);
|
||||||
fileman->smart = e_fm_add(fileman->evas);
|
fileman->smart = e_fm_add(fileman->evas);
|
||||||
e_fm_e_win_set(fileman->smart, fileman->win);
|
e_fm_e_win_set(fileman->smart, fileman->win);
|
||||||
e_fm_dir_set(fileman->smart, dir);
|
|
||||||
|
|
||||||
fileman->main = e_scrollframe_add(fileman->evas);
|
fileman->main = e_scrollframe_add(fileman->evas);
|
||||||
e_scrollframe_custom_theme_set(fileman->main, "base/themes/fileman",
|
e_scrollframe_custom_theme_set(fileman->main, "base/themes/fileman",
|
||||||
|
@ -102,6 +101,8 @@ e_fileman_new_to_dir(E_Container *con, char *path)
|
||||||
e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb);
|
e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb);
|
||||||
e_win_resize(fileman->win, 570, 355);
|
e_win_resize(fileman->win, 570, 355);
|
||||||
|
|
||||||
|
e_fm_dir_set(fileman->smart, dir);
|
||||||
|
|
||||||
ecore_x_dnd_aware_set(fileman->win->evas_win, 1);
|
ecore_x_dnd_aware_set(fileman->win->evas_win, 1);
|
||||||
|
|
||||||
evas_event_thaw(fileman->evas);
|
evas_event_thaw(fileman->evas);
|
||||||
|
|
|
@ -26,6 +26,8 @@ struct _E_Smart_Data
|
||||||
unsigned char visible : 1;
|
unsigned char visible : 1;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
E_Fm_Icon_Metadata *meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
@ -40,13 +42,9 @@ static void _e_fm_icon_smart_clip_unset (Evas_Object *obj);
|
||||||
|
|
||||||
/* Create icons */
|
/* Create icons */
|
||||||
static void _e_fm_icon_icon_mime_get(E_Smart_Data *sd);
|
static void _e_fm_icon_icon_mime_get(E_Smart_Data *sd);
|
||||||
|
static void _e_fm_icon_thumb_generate_cb(Evas_Object *obj, void *data);
|
||||||
static void _e_fm_icon_thumb_generate(void);
|
|
||||||
static int _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event);
|
|
||||||
|
|
||||||
static void _e_fm_icon_type_set(E_Smart_Data *sd);
|
static void _e_fm_icon_type_set(E_Smart_Data *sd);
|
||||||
|
static void _e_fm_icon_meta_fill(E_Fm_Icon_Metadata *m, E_Smart_Data *sd);
|
||||||
static void _e_fm_icon_meta_fill(E_Fm_Icon_Metadata *m, E_Smart_Data *sd);
|
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Evas_Smart *e_smart = NULL;
|
static Evas_Smart *e_smart = NULL;
|
||||||
|
@ -62,10 +60,6 @@ static Eet_Data_Descriptor *_e_fm_icon_meta_edd = NULL;
|
||||||
int
|
int
|
||||||
e_fm_icon_init(void)
|
e_fm_icon_init(void)
|
||||||
{
|
{
|
||||||
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +171,12 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thumb_files = evas_list_append(thumb_files, sd);
|
sd->thumb_object = e_thumb_generate_begin(sd->file->path, sd->iw,
|
||||||
if (pid == -1) _e_fm_icon_thumb_generate();
|
sd->ih, sd->evas,
|
||||||
|
&sd->thumb_object,
|
||||||
|
_e_fm_icon_thumb_generate_cb,
|
||||||
|
sd);
|
||||||
|
|
||||||
_e_fm_icon_icon_mime_get(sd);
|
_e_fm_icon_icon_mime_get(sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,6 +236,17 @@ e_fm_icon_disappear_cb(Evas_Object *obj, void *data)
|
||||||
E_FREE(sd->saved_title);
|
E_FREE(sd->saved_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
e_fm_icon_title_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Smart_Data *sd;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
|
return edje_object_part_text_get(sd->icon_object, "icon_title");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_fm_icon_title_set(Evas_Object *obj, const char *title)
|
e_fm_icon_title_set(Evas_Object *obj, const char *title)
|
||||||
{
|
{
|
||||||
|
@ -321,6 +330,8 @@ e_fm_icon_meta_generate(Evas_Object *obj)
|
||||||
if (!m) return NULL;
|
if (!m) return NULL;
|
||||||
_e_fm_icon_meta_fill(m, sd);
|
_e_fm_icon_meta_fill(m, sd);
|
||||||
|
|
||||||
|
sd->meta = m;
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +372,7 @@ _e_fm_icon_smart_add(Evas_Object *obj)
|
||||||
sd->iw = 48;
|
sd->iw = 48;
|
||||||
sd->ih = 48;
|
sd->ih = 48;
|
||||||
sd->file = NULL;
|
sd->file = NULL;
|
||||||
|
sd->meta = NULL;
|
||||||
|
|
||||||
sd->icon_object = edje_object_add(sd->evas);
|
sd->icon_object = edje_object_add(sd->evas);
|
||||||
evas_object_smart_member_add(sd->icon_object, obj);
|
evas_object_smart_member_add(sd->icon_object, obj);
|
||||||
|
@ -404,6 +416,12 @@ _e_fm_icon_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
evas_object_move(sd->event_object, x, y);
|
evas_object_move(sd->event_object, x, y);
|
||||||
if(sd->icon_object)
|
if(sd->icon_object)
|
||||||
evas_object_move(sd->icon_object, x, y);
|
evas_object_move(sd->icon_object, x, y);
|
||||||
|
if(sd->meta)
|
||||||
|
{
|
||||||
|
//printf("update meta for %s: x=%d y=%d\n", sd->file->name, x, y);
|
||||||
|
sd->meta->x = x;
|
||||||
|
sd->meta->y = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -419,7 +437,13 @@ _e_fm_icon_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||||
if(sd->event_object)
|
if(sd->event_object)
|
||||||
evas_object_resize(sd->event_object, sd->w, sd->h);
|
evas_object_resize(sd->event_object, sd->w, sd->h);
|
||||||
if(sd->icon_object)
|
if(sd->icon_object)
|
||||||
evas_object_resize(sd->icon_object, sd->w, sd->h);
|
evas_object_resize(sd->icon_object, sd->w, sd->h);
|
||||||
|
if(sd->meta)
|
||||||
|
{
|
||||||
|
printf("update meta: w=%d h=%d\n", w, h);
|
||||||
|
sd->meta->w = w;
|
||||||
|
sd->meta->h = h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -506,43 +530,13 @@ _e_fm_icon_icon_mime_get(E_Smart_Data *sd)
|
||||||
sd->image_object);
|
sd->image_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
_e_fm_icon_thumb_generate(void)
|
_e_fm_icon_thumb_generate_cb(Evas_Object *obj, void *data)
|
||||||
{
|
{
|
||||||
E_Smart_Data *sd;
|
|
||||||
|
|
||||||
if ((!thumb_files) || (pid != -1)) return;
|
|
||||||
|
|
||||||
pid = fork();
|
|
||||||
if (pid == 0)
|
|
||||||
{
|
|
||||||
/* reset signal handlers for the child */
|
|
||||||
signal(SIGSEGV, SIG_DFL);
|
|
||||||
signal(SIGILL, SIG_DFL);
|
|
||||||
signal(SIGFPE, SIG_DFL);
|
|
||||||
signal(SIGBUS, SIG_DFL);
|
|
||||||
|
|
||||||
sd = thumb_files->data;
|
|
||||||
if (!e_thumb_exists(sd->file->path))
|
|
||||||
e_thumb_create(sd->file->path, 48, 48); // thumbnail size
|
|
||||||
eet_cacheburst(0);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Exe_Exit *ev;
|
|
||||||
E_Smart_Data *sd;
|
E_Smart_Data *sd;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
ev = event;
|
sd = data;
|
||||||
if (ev->pid != pid) return 1;
|
|
||||||
if (!thumb_files) return 1;
|
|
||||||
|
|
||||||
sd = thumb_files->data;
|
|
||||||
thumb_files = evas_list_remove_list(thumb_files, thumb_files);
|
|
||||||
|
|
||||||
ext = strrchr(sd->file->name, '.');
|
ext = strrchr(sd->file->name, '.');
|
||||||
if ((ext) && (strcasecmp(ext, ".eap")))
|
if ((ext) && (strcasecmp(ext, ".eap")))
|
||||||
|
@ -559,9 +553,7 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
||||||
sd->iw,
|
sd->iw,
|
||||||
sd->ih,
|
sd->ih,
|
||||||
1);
|
1);
|
||||||
// evas_object_geometry_get(sd->thumb_object, NULL, NULL, &icon_w, &icon_h);
|
|
||||||
// sd->iw = icon_w;
|
|
||||||
// sd->ih = icon_h;
|
|
||||||
sd->image_object = edje_object_add(sd->evas);
|
sd->image_object = edje_object_add(sd->evas);
|
||||||
e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
|
e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
|
||||||
"fileman/icon_thumb");
|
"fileman/icon_thumb");
|
||||||
|
@ -579,10 +571,6 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
||||||
edje_object_part_swallow(sd->icon_object, "icon_swallow",
|
edje_object_part_swallow(sd->icon_object, "icon_swallow",
|
||||||
sd->image_object);
|
sd->image_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = -1;
|
|
||||||
_e_fm_icon_thumb_generate();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -11,6 +11,16 @@
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
|
*
|
||||||
|
* - if we resize efm while we're generating files, we crash
|
||||||
|
*
|
||||||
|
* - convert current layout scheme to canvas layout (AmigaOS style)
|
||||||
|
*
|
||||||
|
* - begin configuration dialogs
|
||||||
|
*
|
||||||
|
* - allow per dir bg
|
||||||
|
*
|
||||||
|
* - allow custom icon images
|
||||||
*
|
*
|
||||||
* - add ability to have icons on desktop (this works, but we need some fixes)
|
* - add ability to have icons on desktop (this works, but we need some fixes)
|
||||||
* files should go on ~/.e/e/desktop for example.
|
* files should go on ~/.e/e/desktop for example.
|
||||||
|
@ -24,17 +34,12 @@
|
||||||
*
|
*
|
||||||
* - allow for icon movement inside the canvas
|
* - allow for icon movement inside the canvas
|
||||||
*
|
*
|
||||||
* - add metadata system which allows us to save icon positions and will
|
|
||||||
* eventually allow us to have custom icon sizes, custom bgs per dir...
|
|
||||||
*
|
|
||||||
* - double check dir monitoring. note: when we are in a dir that is constantly
|
* - double check dir monitoring. note: when we are in a dir that is constantly
|
||||||
* changing, we cant keep calling redraw_new as it will kill us.
|
* changing, we cant keep calling redraw_new as it will kill us.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* BUGS:
|
/* BUGS:
|
||||||
*
|
|
||||||
* - we need to look at the deletion / free'ing routines.
|
|
||||||
*
|
*
|
||||||
* - Closing Efm window while its thumbnailing causes a segv
|
* - Closing Efm window while its thumbnailing causes a segv
|
||||||
*
|
*
|
||||||
|
@ -103,7 +108,7 @@ struct _E_Fm_Dir_Metadata
|
||||||
struct _E_Fm_Icon
|
struct _E_Fm_Icon
|
||||||
{
|
{
|
||||||
E_Fm_File *file;
|
E_Fm_File *file;
|
||||||
Evas_Object *icon_object;
|
Evas_Object *icon_obj;
|
||||||
E_Fm_Smart_Data *sd;
|
E_Fm_Smart_Data *sd;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -152,7 +157,7 @@ struct _E_Fm_Smart_Data
|
||||||
Evas_Object *clip_obj;
|
Evas_Object *clip_obj;
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *object;
|
Evas_Object *object;
|
||||||
Evas_Object *entry_object;
|
Evas_Object *entry_obj;
|
||||||
|
|
||||||
E_Fm_Dir_Metadata *meta;
|
E_Fm_Dir_Metadata *meta;
|
||||||
|
|
||||||
|
@ -184,7 +189,7 @@ struct _E_Fm_Smart_Data
|
||||||
Ecore_Evas *ecore_evas;
|
Ecore_Evas *ecore_evas;
|
||||||
Evas *evas;
|
Evas *evas;
|
||||||
Ecore_X_Window win;
|
Ecore_X_Window win;
|
||||||
E_Fm_Icon *icon_object;
|
E_Fm_Icon *icon_obj;
|
||||||
Evas_Object *image_object;
|
Evas_Object *image_object;
|
||||||
} drag;
|
} drag;
|
||||||
|
|
||||||
|
@ -436,10 +441,9 @@ e_fm_scroll_set(Evas_Object *object, Evas_Coord x, Evas_Coord y)
|
||||||
sd->child.x = x;
|
sd->child.x = x;
|
||||||
sd->child.y = y;
|
sd->child.y = y;
|
||||||
|
|
||||||
e_icon_layout_clip_freeze(sd->layout);
|
e_icon_canvas_xy_freeze(sd->layout);
|
||||||
evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
|
evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
|
||||||
e_icon_layout_clip_thaw(sd->layout);
|
e_icon_canvas_xy_thaw(sd->layout);
|
||||||
|
|
||||||
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +465,6 @@ e_fm_scroll_max_get(Evas_Object *object, Evas_Coord *x, Evas_Coord *y)
|
||||||
if (sd->h < sd->child.h) *y = sd->child.h - sd->h;
|
if (sd->h < sd->child.h) *y = sd->child.h - sd->h;
|
||||||
else *y = 0;
|
else *y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -476,7 +479,6 @@ e_fm_scroll_get(Evas_Object *object, Evas_Coord *x, Evas_Coord *y)
|
||||||
if (y) *y = sd->child.y;
|
if (y) *y = sd->child.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
e_fm_geometry_virtual_get(Evas_Object *object, Evas_Coord *w, Evas_Coord *h)
|
e_fm_geometry_virtual_get(Evas_Object *object, Evas_Coord *w, Evas_Coord *h)
|
||||||
{
|
{
|
||||||
|
@ -577,6 +579,35 @@ e_fm_background_set(Evas_Object *object, Evas_Object *bg)
|
||||||
edje_object_part_swallow(sd->edje_obj, "background", bg);
|
edje_object_part_swallow(sd->edje_obj, "background", bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
e_fm_icon_create(void *data)
|
||||||
|
{
|
||||||
|
E_Fm_Icon *icon;
|
||||||
|
|
||||||
|
if(!data) return NULL;
|
||||||
|
icon = data;
|
||||||
|
|
||||||
|
icon->icon_obj = e_fm_icon_add(icon->sd->evas);
|
||||||
|
e_fm_icon_file_set(icon->icon_obj, icon->file);
|
||||||
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
||||||
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
||||||
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
||||||
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
||||||
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, icon->sd);
|
||||||
|
evas_object_show(icon->icon_obj);
|
||||||
|
return icon->icon_obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_fm_icon_destroy(Evas_Object *obj, void *data)
|
||||||
|
{
|
||||||
|
E_Fm_Icon *icon;
|
||||||
|
|
||||||
|
icon = data;
|
||||||
|
e_thumb_generate_end(icon->file->path);
|
||||||
|
evas_object_del(icon->icon_obj);
|
||||||
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
static void
|
static void
|
||||||
_e_fm_smart_add(Evas_Object *object)
|
_e_fm_smart_add(Evas_Object *object)
|
||||||
|
@ -595,6 +626,9 @@ _e_fm_smart_add(Evas_Object *object)
|
||||||
sd->icon_info.x_space = 12;
|
sd->icon_info.x_space = 12;
|
||||||
sd->icon_info.y_space = 10;
|
sd->icon_info.y_space = 10;
|
||||||
|
|
||||||
|
sd->child.x = 0;
|
||||||
|
sd->child.y = 0;
|
||||||
|
|
||||||
sd->timer_int = 0.001;
|
sd->timer_int = 0.001;
|
||||||
sd->timer = NULL;
|
sd->timer = NULL;
|
||||||
|
|
||||||
|
@ -621,9 +655,9 @@ _e_fm_smart_add(Evas_Object *object)
|
||||||
evas_object_event_callback_add(sd->event_obj, EVAS_CALLBACK_MOUSE_MOVE,
|
evas_object_event_callback_add(sd->event_obj, EVAS_CALLBACK_MOUSE_MOVE,
|
||||||
_e_fm_mouse_move_cb, sd);
|
_e_fm_mouse_move_cb, sd);
|
||||||
|
|
||||||
sd->layout = e_icon_layout_add(sd->evas);
|
sd->layout = e_icon_canvas_add(sd->evas);
|
||||||
e_icon_layout_viewport_set(sd->layout, sd->edje_obj);
|
e_icon_canvas_viewport_set(sd->layout, sd->edje_obj);
|
||||||
e_icon_layout_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space);
|
e_icon_canvas_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space);
|
||||||
evas_object_show(sd->layout);
|
evas_object_show(sd->layout);
|
||||||
|
|
||||||
sd->clip_obj = evas_object_rectangle_add(sd->evas);
|
sd->clip_obj = evas_object_rectangle_add(sd->evas);
|
||||||
|
@ -692,9 +726,6 @@ _e_fm_smart_add(Evas_Object *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_object_smart_data_set(object, sd);
|
evas_object_smart_data_set(object, sd);
|
||||||
|
|
||||||
if (getcwd(dir, sizeof(dir)))
|
|
||||||
_e_fm_dir_set(sd, dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -735,7 +766,7 @@ _e_fm_smart_del(Evas_Object *object)
|
||||||
evas_object_del(sd->clip_obj);
|
evas_object_del(sd->clip_obj);
|
||||||
evas_object_del(sd->edje_obj);
|
evas_object_del(sd->edje_obj);
|
||||||
evas_object_del(sd->layout);
|
evas_object_del(sd->layout);
|
||||||
if (sd->entry_object) evas_object_del(sd->entry_object);
|
if (sd->entry_obj) evas_object_del(sd->entry_obj);
|
||||||
if (sd->menu) e_object_del(E_OBJECT(sd->menu));
|
if (sd->menu) e_object_del(E_OBJECT(sd->menu));
|
||||||
|
|
||||||
evas_event_thaw(evas_object_evas_get(object));
|
evas_event_thaw(evas_object_evas_get(object));
|
||||||
|
@ -757,7 +788,6 @@ _e_fm_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord y)
|
||||||
evas_object_move(sd->edje_obj, x, y);
|
evas_object_move(sd->edje_obj, x, y);
|
||||||
evas_object_move(sd->clip_obj, x, y);
|
evas_object_move(sd->clip_obj, x, y);
|
||||||
evas_object_move(sd->event_obj, x, y);
|
evas_object_move(sd->event_obj, x, y);
|
||||||
// evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -772,9 +802,8 @@ _e_fm_smart_resize(Evas_Object *object, Evas_Coord w, Evas_Coord h)
|
||||||
evas_object_resize(sd->edje_obj, w, h);
|
evas_object_resize(sd->edje_obj, w, h);
|
||||||
evas_object_resize(sd->clip_obj, w, h);
|
evas_object_resize(sd->clip_obj, w, h);
|
||||||
evas_object_resize(sd->event_obj, w, h);
|
evas_object_resize(sd->event_obj, w, h);
|
||||||
// evas_object_resize(sd->layout, w, h);
|
// e_icon_canvas_width_fix(sd->layout, w);
|
||||||
e_icon_layout_width_fix(sd->layout, w);
|
// e_icon_canvas_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
||||||
e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
|
||||||
sd->conf.main->width = w;
|
sd->conf.main->width = w;
|
||||||
sd->conf.main->height = h;
|
sd->conf.main->height = h;
|
||||||
|
|
||||||
|
@ -808,7 +837,6 @@ _e_fm_smart_show(Evas_Object *object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
evas_object_show(sd->edje_obj);
|
evas_object_show(sd->edje_obj);
|
||||||
// evas_object_show(sd->layout);
|
|
||||||
evas_object_show(sd->clip_obj);
|
evas_object_show(sd->clip_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +889,7 @@ _e_fm_redraw(E_Fm_Smart_Data *sd)
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
|
||||||
e_icon_layout_redraw_force(sd->layout);
|
e_icon_canvas_redraw_force(sd->layout);
|
||||||
|
|
||||||
if(sd->frozen)
|
if(sd->frozen)
|
||||||
return;
|
return;
|
||||||
|
@ -887,7 +915,7 @@ _e_fm_file_rename(E_Fm_Icon *icon, const char* name)
|
||||||
|
|
||||||
if (e_fm_file_rename(icon->file, name))
|
if (e_fm_file_rename(icon->file, name))
|
||||||
{
|
{
|
||||||
e_fm_icon_title_set(icon->icon_object, name);
|
e_fm_icon_title_set(icon->icon_obj, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,9 +938,9 @@ _e_fm_file_delete(E_Fm_Icon *icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
icon->sd->files = evas_list_remove(icon->sd->files, icon);
|
icon->sd->files = evas_list_remove(icon->sd->files, icon);
|
||||||
e_icon_layout_freeze(icon->sd->layout);
|
e_icon_canvas_freeze(icon->sd->layout);
|
||||||
e_icon_layout_unpack(icon->icon_object);
|
e_icon_canvas_unpack(icon->icon_obj);
|
||||||
e_icon_layout_thaw(icon->sd->layout);
|
e_icon_canvas_thaw(icon->sd->layout);
|
||||||
_e_fm_redraw(icon->sd);
|
_e_fm_redraw(icon->sd);
|
||||||
_e_fm_file_free(icon);
|
_e_fm_file_free(icon);
|
||||||
}
|
}
|
||||||
|
@ -969,19 +997,19 @@ _e_fm_file_menu_rename(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
|
|
||||||
icon = data;
|
icon = data;
|
||||||
|
|
||||||
icon->sd->entry_object = e_entry_add(icon->sd->evas);
|
icon->sd->entry_obj = e_entry_add(icon->sd->evas);
|
||||||
evas_object_focus_set(icon->sd->entry_object, 1);
|
evas_object_focus_set(icon->sd->entry_obj, 1);
|
||||||
evas_object_show(icon->sd->entry_object);
|
evas_object_show(icon->sd->entry_obj);
|
||||||
e_entry_cursor_show(icon->sd->entry_object);
|
e_entry_cursor_show(icon->sd->entry_obj);
|
||||||
|
|
||||||
e_fm_icon_edit_entry_set(icon->icon_object, icon->sd->entry_object);
|
e_fm_icon_edit_entry_set(icon->icon_obj, icon->sd->entry_obj);
|
||||||
e_fm_icon_title_set(icon->icon_object, "");
|
e_fm_icon_title_set(icon->icon_obj, "");
|
||||||
|
|
||||||
e_fm_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
|
e_fm_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
|
||||||
_e_fm_win_mouse_up_cb, icon);
|
_e_fm_win_mouse_up_cb, icon);
|
||||||
e_grabinput_get(icon->sd->win->evas_win, 1, icon->sd->win->evas_win);
|
e_grabinput_get(icon->sd->win->evas_win, 1, icon->sd->win->evas_win);
|
||||||
e_entry_cursor_move_at_start(icon->sd->entry_object);
|
e_entry_cursor_move_at_start(icon->sd->entry_obj);
|
||||||
e_entry_text_set(icon->sd->entry_object, icon->file->name);
|
e_entry_text_set(icon->sd->entry_obj, icon->file->name);
|
||||||
|
|
||||||
e_fm_grab_time = ecore_time_get();
|
e_fm_grab_time = ecore_time_get();
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1472,7 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
list = ecore_list_new();
|
list = ecore_list_new();
|
||||||
ecore_list_set_free_cb(list, free);
|
ecore_list_set_free_cb(list, free);
|
||||||
/* TODO: use sorting function here */
|
/* TODO: use sorting function here */
|
||||||
heap = ecore_sheap_new(ECORE_COMPARE_CB(strcmp), ecore_list_nodes(list));
|
heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), ecore_list_nodes(list));
|
||||||
while(dp = readdir(dir2))
|
while(dp = readdir(dir2))
|
||||||
{
|
{
|
||||||
if ((!strcmp(dp->d_name, ".") || (!strcmp (dp->d_name, "..")))) continue;
|
if ((!strcmp(dp->d_name, ".") || (!strcmp (dp->d_name, "..")))) continue;
|
||||||
|
@ -1477,14 +1505,15 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
if(sd->meta)
|
if(sd->meta)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
printf("Loaded meta! (%s) %p\n", sd->meta->name, sd->meta->files);
|
|
||||||
for(l = sd->meta->files; l; l = l->next)
|
for(l = sd->meta->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
E_Fm_Icon_Metadata *im;
|
E_Fm_Icon_Metadata *im;
|
||||||
im = l->data;
|
im = l->data;
|
||||||
printf("META: file = %s\n", im->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
e_icon_canvas_width_fix(sd->layout, sd->w);
|
||||||
|
|
||||||
/* Reset position */
|
/* Reset position */
|
||||||
sd->position = 0.0;
|
sd->position = 0.0;
|
||||||
|
@ -1498,7 +1527,7 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
_e_fm_file_free(sd->files->data);
|
_e_fm_file_free(sd->files->data);
|
||||||
sd->files = evas_list_remove_list(sd->files, sd->files);
|
sd->files = evas_list_remove_list(sd->files, sd->files);
|
||||||
}
|
}
|
||||||
e_icon_layout_reset(sd->layout);
|
e_icon_canvas_reset(sd->layout);
|
||||||
|
|
||||||
/* Get new files */
|
/* Get new files */
|
||||||
if (sd->monitor) ecore_file_monitor_del(sd->monitor);
|
if (sd->monitor) ecore_file_monitor_del(sd->monitor);
|
||||||
|
@ -1517,16 +1546,15 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
||||||
icon->file = e_fm_file_new(path);
|
icon->file = e_fm_file_new(path);
|
||||||
icon->file->mode = 0040000;
|
icon->file->mode = 0040000;
|
||||||
icon->file->type = E_FM_FILE_TYPE_DIRECTORY;
|
icon->file->type = E_FM_FILE_TYPE_DIRECTORY;
|
||||||
icon->icon_object = e_fm_icon_add(sd->evas);
|
icon->icon_obj = e_fm_icon_add(sd->evas);
|
||||||
icon->sd = sd;
|
icon->sd = sd;
|
||||||
e_fm_icon_file_set(icon->icon_object, icon->file);
|
e_fm_icon_file_set(icon->icon_obj, icon->file);
|
||||||
sd->files = evas_list_prepend(sd->files, icon);
|
sd->files = evas_list_prepend(sd->files, icon);
|
||||||
e_icon_layout_pack(sd->layout, icon->icon_object);
|
e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon);
|
||||||
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,7 +1578,7 @@ _e_fm_dir_files_get(void *data)
|
||||||
i = 0;
|
i = 0;
|
||||||
sd = data;
|
sd = data;
|
||||||
|
|
||||||
e_icon_layout_freeze(sd->layout);
|
e_icon_canvas_freeze(sd->layout);
|
||||||
|
|
||||||
while (i < 2)
|
while (i < 2)
|
||||||
{
|
{
|
||||||
|
@ -1569,36 +1597,67 @@ _e_fm_dir_files_get(void *data)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon->icon_object = e_fm_icon_add(sd->evas);
|
icon->icon_obj = e_fm_icon_add(sd->evas);
|
||||||
icon->sd = sd;
|
icon->sd = sd;
|
||||||
e_fm_icon_file_set(icon->icon_object, icon->file);
|
e_fm_icon_file_set(icon->icon_obj, icon->file);
|
||||||
sd->files = evas_list_append(sd->files, icon);
|
sd->files = evas_list_append(sd->files, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, sd);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, sd);
|
||||||
evas_object_show(icon->icon_object);
|
evas_object_show(icon->icon_obj);
|
||||||
e_icon_layout_pack(sd->layout, icon->icon_object);
|
if(sd->meta)
|
||||||
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
{
|
||||||
|
E_Fm_Icon_Metadata *im;
|
||||||
|
if((im = evas_hash_find(sd->meta->files_hash, icon->file->name)) != NULL)
|
||||||
|
{
|
||||||
|
//printf("packing old icon at %d %d\n", im->x, im->y);
|
||||||
|
e_icon_canvas_pack_at_location(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon, im->x, im->y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
E_Fm_Icon_Metadata *im;
|
||||||
|
|
||||||
|
//printf("packing new icon!\n");
|
||||||
|
im = e_fm_icon_meta_generate(icon->icon_obj);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
sd->meta->files = evas_list_append(sd->meta->files, im);
|
||||||
|
sd->meta->files_hash = evas_hash_add(sd->meta->files_hash, icon->file->name, im);
|
||||||
|
}
|
||||||
|
e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
E_Fm_Icon_Metadata *im;
|
||||||
|
|
||||||
|
//printf("packing new icon!\n");
|
||||||
|
sd->meta = calloc(1, sizeof(E_Fm_Dir_Metadata));
|
||||||
|
sd->meta->files = NULL;
|
||||||
|
im = e_fm_icon_meta_generate(icon->icon_obj);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
sd->meta->files = evas_list_append(sd->meta->files, im);
|
||||||
|
sd->meta->files_hash = evas_hash_add(sd->meta->files_hash, icon->file->name, im);
|
||||||
|
}
|
||||||
|
e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
sd->files_raw = evas_list_remove_list(sd->files_raw, sd->files_raw);
|
sd->files_raw = evas_list_remove_list(sd->files_raw, sd->files_raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_icon_layout_thaw(sd->layout);
|
e_icon_canvas_thaw(sd->layout);
|
||||||
|
|
||||||
e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
e_icon_canvas_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
|
||||||
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
evas_object_smart_callback_call(sd->object, "changed", NULL);
|
||||||
|
|
||||||
if(!sd->files_raw) {
|
if(!sd->files_raw) {
|
||||||
sd->timer = NULL;
|
sd->timer = NULL;
|
||||||
if(!sd->meta)
|
if(sd->meta)
|
||||||
{
|
_e_fm_dir_meta_save(sd);
|
||||||
printf("Generating Meta!\n");
|
|
||||||
_e_fm_dir_meta_generate(sd);
|
|
||||||
_e_fm_dir_meta_save(sd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1613,9 +1672,7 @@ static char *
|
||||||
_e_fm_dir_pop(const char *path)
|
_e_fm_dir_pop(const char *path)
|
||||||
{
|
{
|
||||||
char *start, *end, *dir;
|
char *start, *end, *dir;
|
||||||
int i;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
start = strchr(path, '/');
|
start = strchr(path, '/');
|
||||||
end = strrchr(path ,'/');
|
end = strrchr(path ,'/');
|
||||||
|
|
||||||
|
@ -1671,19 +1728,17 @@ _e_fm_dir_monitor_cb(void *data, Ecore_File_Monitor *ecore_file_monitor,
|
||||||
free(icon);
|
free(icon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
icon->icon_object = e_fm_icon_add(sd->evas);
|
icon->icon_obj = e_fm_icon_add(sd->evas);
|
||||||
icon->sd = sd;
|
icon->sd = sd;
|
||||||
e_icon_layout_freeze(sd->layout);
|
e_icon_canvas_freeze(sd->layout);
|
||||||
e_fm_icon_file_set(icon->icon_object, icon->file);
|
e_fm_icon_file_set(icon->icon_obj, icon->file);
|
||||||
//evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
evas_object_show(icon->icon_obj);
|
||||||
evas_object_show(icon->icon_object);
|
e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon);
|
||||||
e_icon_layout_pack(sd->layout, icon->icon_object);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
||||||
e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
|
evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
|
e_icon_canvas_thaw(sd->layout);
|
||||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
|
|
||||||
e_icon_layout_thaw(sd->layout);
|
|
||||||
sd->files = evas_list_prepend(sd->files, icon);
|
sd->files = evas_list_prepend(sd->files, icon);
|
||||||
_e_fm_redraw(sd);
|
_e_fm_redraw(sd);
|
||||||
break;
|
break;
|
||||||
|
@ -1696,9 +1751,9 @@ _e_fm_dir_monitor_cb(void *data, Ecore_File_Monitor *ecore_file_monitor,
|
||||||
if (!strcmp(icon->file->path, path))
|
if (!strcmp(icon->file->path, path))
|
||||||
{
|
{
|
||||||
sd->files = evas_list_remove_list(sd->files, l);
|
sd->files = evas_list_remove_list(sd->files, l);
|
||||||
e_icon_layout_freeze(sd->layout);
|
e_icon_canvas_freeze(sd->layout);
|
||||||
e_icon_layout_unpack(icon->icon_object);
|
e_icon_canvas_unpack(icon->icon_obj);
|
||||||
e_icon_layout_thaw(sd->layout);
|
e_icon_canvas_thaw(sd->layout);
|
||||||
_e_fm_file_free(icon);
|
_e_fm_file_free(icon);
|
||||||
_e_fm_redraw(sd);
|
_e_fm_redraw(sd);
|
||||||
break;
|
break;
|
||||||
|
@ -1711,8 +1766,8 @@ _e_fm_dir_monitor_cb(void *data, Ecore_File_Monitor *ecore_file_monitor,
|
||||||
static void
|
static void
|
||||||
_e_fm_file_free(E_Fm_Icon *icon)
|
_e_fm_file_free(E_Fm_Icon *icon)
|
||||||
{
|
{
|
||||||
e_icon_layout_unpack(icon->icon_object);
|
e_icon_canvas_unpack(icon->icon_obj);
|
||||||
evas_object_del(icon->icon_object);
|
evas_object_del(icon->icon_obj);
|
||||||
e_object_del(E_OBJECT(icon->file));
|
e_object_del(E_OBJECT(icon->file));
|
||||||
/*
|
/*
|
||||||
if (file->menu)
|
if (file->menu)
|
||||||
|
@ -1732,7 +1787,7 @@ _e_fm_selections_clear(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon *icon;
|
E_Fm_Icon *icon;
|
||||||
|
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "unclicked", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "unclicked", "");
|
||||||
icon->state.selected = 0;
|
icon->state.selected = 0;
|
||||||
}
|
}
|
||||||
sd->selection.files = evas_list_free(sd->selection.files);
|
sd->selection.files = evas_list_free(sd->selection.files);
|
||||||
|
@ -1747,7 +1802,7 @@ _e_fm_selections_add(E_Fm_Icon *icon, Evas_List *icon_ptr)
|
||||||
icon->sd->selection.current.file = icon;
|
icon->sd->selection.current.file = icon;
|
||||||
icon->sd->selection.current.ptr = icon_ptr;
|
icon->sd->selection.current.ptr = icon_ptr;
|
||||||
if (icon->state.selected) return;
|
if (icon->state.selected) return;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "clicked", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "clicked", "");
|
||||||
icon->sd->selection.files = evas_list_append(icon->sd->selection.files, icon);
|
icon->sd->selection.files = evas_list_append(icon->sd->selection.files, icon);
|
||||||
icon->state.selected = 1;
|
icon->state.selected = 1;
|
||||||
}
|
}
|
||||||
|
@ -1758,7 +1813,7 @@ _e_fm_selections_current_set(E_Fm_Icon *icon, Evas_List *icon_ptr)
|
||||||
icon->sd->selection.current.file = icon;
|
icon->sd->selection.current.file = icon;
|
||||||
icon->sd->selection.current.ptr = icon_ptr;
|
icon->sd->selection.current.ptr = icon_ptr;
|
||||||
if (icon->state.selected) return;
|
if (icon->state.selected) return;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "hilight", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "hilight", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1773,7 +1828,7 @@ _e_fm_selections_rect_add(E_Fm_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Evas_
|
||||||
|
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
|
|
||||||
evas_object_geometry_get(icon->icon_object, &xx, &yy, &ww, &hh);
|
evas_object_geometry_get(icon->icon_obj, &xx, &yy, &ww, &hh);
|
||||||
if (E_INTERSECTS(x, y, w, h, xx, yy, ww, hh))
|
if (E_INTERSECTS(x, y, w, h, xx, yy, ww, hh))
|
||||||
{
|
{
|
||||||
if (!evas_list_find(icon->sd->selection.band.files, icon))
|
if (!evas_list_find(icon->sd->selection.band.files, icon))
|
||||||
|
@ -1803,7 +1858,7 @@ static void
|
||||||
_e_fm_selections_del(E_Fm_Icon *icon)
|
_e_fm_selections_del(E_Fm_Icon *icon)
|
||||||
{
|
{
|
||||||
if (!icon->state.selected) return;
|
if (!icon->state.selected) return;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "unclicked", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "unclicked", "");
|
||||||
icon->sd->selection.files = evas_list_remove(icon->sd->selection.files, icon);
|
icon->sd->selection.files = evas_list_remove(icon->sd->selection.files, icon);
|
||||||
if (icon->sd->selection.current.file == icon)
|
if (icon->sd->selection.current.file == icon)
|
||||||
{
|
{
|
||||||
|
@ -1870,7 +1925,7 @@ _e_fm_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(sd->edje_obj, "default", "");
|
edje_object_signal_emit(sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -2086,8 +2141,6 @@ _e_fm_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - send signals to edje for animations etc...
|
|
||||||
static void
|
static void
|
||||||
_e_fm_icon_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_e_fm_icon_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
|
@ -2148,7 +2201,7 @@ _e_fm_icon_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
|
||||||
icon->sd->drag.start = 1;
|
icon->sd->drag.start = 1;
|
||||||
icon->sd->drag.x = icon->sd->win->x + ev->canvas.x;
|
icon->sd->drag.x = icon->sd->win->x + ev->canvas.x;
|
||||||
icon->sd->drag.y = icon->sd->win->y + ev->canvas.y;
|
icon->sd->drag.y = icon->sd->win->y + ev->canvas.y;
|
||||||
icon->sd->drag.icon_object = icon;
|
icon->sd->drag.icon_obj = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!icon->state.selected)
|
if (!icon->state.selected)
|
||||||
|
@ -2272,7 +2325,7 @@ _e_fm_icon_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = icon->sd->files; l; l = l->next)
|
for (l = icon->sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
i = l->data;
|
i = l->data;
|
||||||
e_fm_icon_signal_emit(i->icon_object, "default", "");
|
e_fm_icon_signal_emit(i->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(icon->sd->edje_obj, "default", "");
|
edje_object_signal_emit(icon->sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -2290,7 +2343,7 @@ _e_fm_icon_mouse_in_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
icon = data;
|
icon = data;
|
||||||
|
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "mousein", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "mousein", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2302,7 +2355,7 @@ _e_fm_icon_mouse_out_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
icon = data;
|
icon = data;
|
||||||
|
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "mouseout", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "mouseout", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2316,7 +2369,7 @@ _e_fm_icon_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
|
||||||
sd = data;
|
sd = data;
|
||||||
|
|
||||||
if(sd->win)
|
if(sd->win)
|
||||||
icon = sd->drag.icon_object;
|
icon = sd->drag.icon_obj;
|
||||||
|
|
||||||
if (!icon) return;
|
if (!icon) return;
|
||||||
|
|
||||||
|
@ -2346,7 +2399,7 @@ _e_fm_icon_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
|
||||||
snprintf(data, sizeof(data), "file://%s", icon->file->path);
|
snprintf(data, sizeof(data), "file://%s", icon->file->path);
|
||||||
|
|
||||||
ecore_evas_geometry_get(sd->win->ecore_evas, &cx, &cy, NULL, NULL);
|
ecore_evas_geometry_get(sd->win->ecore_evas, &cx, &cy, NULL, NULL);
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
drag = e_drag_new(sd->win->container, cx + x, cy + y,
|
drag = e_drag_new(sd->win->container, cx + x, cy + y,
|
||||||
drop_types, 1, strdup(data), strlen(data),
|
drop_types, 1, strdup(data), strlen(data),
|
||||||
_e_fm_drop_done_cb);
|
_e_fm_drop_done_cb);
|
||||||
|
@ -2390,11 +2443,11 @@ _e_fm_win_mouse_up_cb(void *data, int type, void *event)
|
||||||
t = ecore_time_get() - e_fm_grab_time;
|
t = ecore_time_get() - e_fm_grab_time;
|
||||||
if (t < 1.0) return 1;
|
if (t < 1.0) return 1;
|
||||||
|
|
||||||
name = e_entry_text_get(icon->sd->entry_object);
|
name = e_entry_text_get(icon->sd->entry_obj);
|
||||||
e_fm_icon_edit_entry_set(icon->icon_object, NULL);
|
e_fm_icon_edit_entry_set(icon->icon_obj, NULL);
|
||||||
evas_object_focus_set(icon->sd->entry_object, 0);
|
evas_object_focus_set(icon->sd->entry_obj, 0);
|
||||||
evas_object_del(icon->sd->entry_object);
|
evas_object_del(icon->sd->entry_obj);
|
||||||
icon->sd->entry_object = NULL;
|
icon->sd->entry_obj = NULL;
|
||||||
|
|
||||||
_e_fm_file_rename(icon, name);
|
_e_fm_file_rename(icon, name);
|
||||||
|
|
||||||
|
@ -2470,7 +2523,7 @@ _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "disable", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "disable", "");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2486,10 +2539,10 @@ _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb)
|
||||||
if(!strcmp(icon->file->name, file))
|
if(!strcmp(icon->file->name, file))
|
||||||
{
|
{
|
||||||
_e_fm_selections_add(l->data, l);
|
_e_fm_selections_add(l->data, l);
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
if(!anchor)
|
if(!anchor)
|
||||||
{
|
{
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
|
|
||||||
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
|
@ -2562,7 +2615,7 @@ position:
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
@ -2593,13 +2646,13 @@ _e_fm_icon_select_up(E_Fm_Smart_Data *sd)
|
||||||
|
|
||||||
l = sd->selection.current.ptr;
|
l = sd->selection.current.ptr;
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, NULL, NULL);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, NULL, NULL);
|
||||||
x2 = x + 1;
|
x2 = x + 1;
|
||||||
l = l->prev;
|
l = l->prev;
|
||||||
while(l && x != x2)
|
while(l && x != x2)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x2, &y2, NULL, NULL);
|
evas_object_geometry_get(icon->icon_obj, &x2, &y2, NULL, NULL);
|
||||||
if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control"))
|
if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control"))
|
||||||
{
|
{
|
||||||
if(icon->state.selected)
|
if(icon->state.selected)
|
||||||
|
@ -2630,7 +2683,7 @@ _e_fm_icon_select_up(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon *icon;
|
E_Fm_Icon *icon;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
@ -2664,13 +2717,13 @@ _e_fm_icon_select_down(E_Fm_Smart_Data *sd)
|
||||||
|
|
||||||
l = sd->selection.current.ptr;
|
l = sd->selection.current.ptr;
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, NULL, NULL);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, NULL, NULL);
|
||||||
x2 = x + 1;
|
x2 = x + 1;
|
||||||
l = l->next;
|
l = l->next;
|
||||||
while(l && x != x2)
|
while(l && x != x2)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x2, &y2, NULL, NULL);
|
evas_object_geometry_get(icon->icon_obj, &x2, &y2, NULL, NULL);
|
||||||
if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control"))
|
if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control"))
|
||||||
{
|
{
|
||||||
if(icon->state.selected)
|
if(icon->state.selected)
|
||||||
|
@ -2702,7 +2755,7 @@ _e_fm_icon_select_down(E_Fm_Smart_Data *sd)
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
@ -2755,7 +2808,7 @@ _e_fm_icon_select_left(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon *icon;
|
E_Fm_Icon *icon;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
icon = prev->data;
|
icon = prev->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
@ -2810,7 +2863,7 @@ _e_fm_icon_select_right(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon *icon;
|
E_Fm_Icon *icon;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
icon = next->data;
|
icon = next->data;
|
||||||
evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h);
|
evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h);
|
||||||
if (!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
if (!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h))
|
||||||
{
|
{
|
||||||
E_Event_Fm_Reconfigure *ev;
|
E_Event_Fm_Reconfigure *ev;
|
||||||
|
@ -2904,7 +2957,7 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(sd->edje_obj, "default", "");
|
edje_object_signal_emit(sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -2920,7 +2973,7 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(sd->edje_obj, "default", "");
|
edje_object_signal_emit(sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -2950,7 +3003,7 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(sd->edje_obj, "default", "");
|
edje_object_signal_emit(sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -2964,7 +3017,7 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
for (l = sd->files; l; l = l->next)
|
for (l = sd->files; l; l = l->next)
|
||||||
{
|
{
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
e_fm_icon_signal_emit(icon->icon_object, "default", "");
|
e_fm_icon_signal_emit(icon->icon_obj, "default", "");
|
||||||
}
|
}
|
||||||
edje_object_signal_emit(sd->edje_obj, "default", "");
|
edje_object_signal_emit(sd->edje_obj, "default", "");
|
||||||
}
|
}
|
||||||
|
@ -3267,7 +3320,7 @@ _e_fm_dir_meta_generate(E_Fm_Smart_Data *sd)
|
||||||
E_Fm_Icon *icon;
|
E_Fm_Icon *icon;
|
||||||
|
|
||||||
icon = l->data;
|
icon = l->data;
|
||||||
im = e_fm_icon_meta_generate(icon->icon_object);
|
im = e_fm_icon_meta_generate(icon->icon_obj);
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
m->files = evas_list_append(m->files, im);
|
m->files = evas_list_append(m->files, im);
|
||||||
|
@ -3304,6 +3357,20 @@ _e_fm_dir_meta_save(E_Fm_Smart_Data *sd)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!sd->meta) return 0;
|
if (!sd->meta) return 0;
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
Evas_List *l;
|
||||||
|
|
||||||
|
for(l = sd->meta->files; l; l = l->next)
|
||||||
|
{
|
||||||
|
E_Fm_Icon_Metadata *m;
|
||||||
|
|
||||||
|
m = l->data;
|
||||||
|
//printf("Saving meta: %d %d\n", m->x, m->y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hash = _e_fm_dir_meta_dir_id(sd->dir);
|
hash = _e_fm_dir_meta_dir_id(sd->dir);
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", meta_path, hash);
|
snprintf(buf, sizeof(buf), "%s/%s", meta_path, hash);
|
||||||
ef = eet_open(buf, EET_FILE_MODE_WRITE);
|
ef = eet_open(buf, EET_FILE_MODE_WRITE);
|
||||||
|
|
|
@ -46,6 +46,9 @@ EAPI int e_fm_thaw(Evas_Object *freeze);
|
||||||
EAPI void e_fm_selector_enable(Evas_Object *object, void (*func)(Evas_Object *object, char *file, void *data), void *data);
|
EAPI void e_fm_selector_enable(Evas_Object *object, void (*func)(Evas_Object *object, char *file, void *data), void *data);
|
||||||
EAPI void e_fm_background_set(Evas_Object *object, Evas_Object *bg);
|
EAPI void e_fm_background_set(Evas_Object *object, Evas_Object *bg);
|
||||||
|
|
||||||
|
EAPI Evas_Object *e_fm_icon_create(void *data);
|
||||||
|
EAPI void e_fm_icon_destroy(Evas_Object *obj, void *data);
|
||||||
|
|
||||||
extern int E_EVENT_FM_RECONFIGURE;
|
extern int E_EVENT_FM_RECONFIGURE;
|
||||||
extern int E_EVENT_FM_DIRECTORY_CHANGE;
|
extern int E_EVENT_FM_DIRECTORY_CHANGE;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,6 +71,18 @@ e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
|
||||||
_e_icon_smart_reconfigure(sd);
|
_e_icon_smart_reconfigure(sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_icon_object_set(Evas_Object *obj, Evas_Object *o)
|
||||||
|
{
|
||||||
|
E_Smart_Data *sd;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
/* smart code here */
|
||||||
|
if (sd->obj) evas_object_del(sd->obj);
|
||||||
|
sd->obj = o;
|
||||||
|
_e_icon_smart_reconfigure(sd);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
e_icon_file_get(Evas_Object *obj)
|
e_icon_file_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ EAPI Evas_Object *e_icon_add (Evas *evas);
|
||||||
EAPI void e_icon_file_set (Evas_Object *obj, const char *file);
|
EAPI void e_icon_file_set (Evas_Object *obj, const char *file);
|
||||||
EAPI void e_icon_file_key_set (Evas_Object *obj, const char *file, const char *key);
|
EAPI void e_icon_file_key_set (Evas_Object *obj, const char *file, const char *key);
|
||||||
EAPI void e_icon_file_edje_set (Evas_Object *obj, const char *file, const char *part);
|
EAPI void e_icon_file_edje_set (Evas_Object *obj, const char *file, const char *part);
|
||||||
|
EAPI void e_icon_object_set(Evas_Object *obj, Evas_Object *o);
|
||||||
EAPI const char *e_icon_file_get (Evas_Object *obj);
|
EAPI const char *e_icon_file_get (Evas_Object *obj);
|
||||||
EAPI void e_icon_smooth_scale_set (Evas_Object *obj, int smooth);
|
EAPI void e_icon_smooth_scale_set (Evas_Object *obj, int smooth);
|
||||||
EAPI int e_icon_smooth_scale_get (Evas_Object *obj);
|
EAPI int e_icon_smooth_scale_get (Evas_Object *obj);
|
||||||
|
|
|
@ -79,8 +79,9 @@
|
||||||
#include "e_widget_iconsel.h"
|
#include "e_widget_iconsel.h"
|
||||||
#include "e_config_dialog.h"
|
#include "e_config_dialog.h"
|
||||||
#include "e_int_config_focus.h"
|
#include "e_int_config_focus.h"
|
||||||
|
#include "e_icon_grid.h"
|
||||||
|
#include "e_icon_canvas.h"
|
||||||
#include "e_int_config_desks.h"
|
#include "e_int_config_desks.h"
|
||||||
#include "e_icon_layout.h"
|
|
||||||
#include "e_int_border_locks.h"
|
#include "e_int_border_locks.h"
|
||||||
#include "e_thumb.h"
|
#include "e_thumb.h"
|
||||||
#include "e_int_border_remember.h"
|
#include "e_int_border_remember.h"
|
||||||
|
@ -98,3 +99,4 @@
|
||||||
#include "e_widget_slider.h"
|
#include "e_widget_slider.h"
|
||||||
#include "e_int_config_window_manipulation.h"
|
#include "e_int_config_window_manipulation.h"
|
||||||
#include "e_int_config_window_display.h"
|
#include "e_int_config_window_display.h"
|
||||||
|
#include "e_int_config_background.h"
|
||||||
|
|
|
@ -0,0 +1,243 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
/* PROTOTYPES - same all the time */
|
||||||
|
typedef struct _CFData CFData;
|
||||||
|
typedef struct _E_Cfg_Bg_Data E_Cfg_Bg_Data;
|
||||||
|
|
||||||
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
|
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
|
||||||
|
/* Actual config data we will be playing with whil the dialog is active */
|
||||||
|
struct _CFData
|
||||||
|
{
|
||||||
|
/*- BASIC -*/
|
||||||
|
char *file ;
|
||||||
|
/*- ADVANCED -*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _E_Cfg_Bg_Data
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
char *file;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* a nice easy setup function that does the dirty work */
|
||||||
|
E_Config_Dialog *
|
||||||
|
e_int_config_background(E_Container *con)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
E_Config_Dialog_View v;
|
||||||
|
|
||||||
|
/* methods */
|
||||||
|
v.create_cfdata = _create_data;
|
||||||
|
v.free_cfdata = _free_data;
|
||||||
|
v.basic.apply_cfdata = _basic_apply_data;
|
||||||
|
v.basic.create_widgets = _basic_create_widgets;
|
||||||
|
v.advanced.apply_cfdata = _advanced_apply_data;
|
||||||
|
v.advanced.create_widgets = _advanced_create_widgets;
|
||||||
|
/* create config diaolg for NULL object/data */
|
||||||
|
cfd = e_config_dialog_new(con, _("Background Settings"), NULL, 0, &v, NULL);
|
||||||
|
//e_dialog_resizable_set(cfd->dia, 1);
|
||||||
|
return cfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--CREATE--**/
|
||||||
|
static void
|
||||||
|
_fill_data(CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* TODO: get debfault bg */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_create_data(E_Config_Dialog *cfd)
|
||||||
|
{
|
||||||
|
/* Create cfdata - cfdata is a temporary block of config data that this
|
||||||
|
* dialog will be dealing with while configuring. it will be applied to
|
||||||
|
* the running systems/config in the apply methods
|
||||||
|
*/
|
||||||
|
CFData *cfdata;
|
||||||
|
|
||||||
|
cfdata = E_NEW(CFData, 1);
|
||||||
|
_fill_data(cfdata);
|
||||||
|
return cfdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* Free the cfdata */
|
||||||
|
free(cfdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--APPLY--**/
|
||||||
|
static int
|
||||||
|
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
E_Zone *z;
|
||||||
|
E_Desk *d;
|
||||||
|
|
||||||
|
z = e_zone_current_get(cfd->con);
|
||||||
|
d = e_desk_current_get(z);
|
||||||
|
/* Actually take our cfdata settings and apply them in real life */
|
||||||
|
printf("file: %s\n", cfdata->file);
|
||||||
|
//e_bg_add(cfd->con, z, 0, 0, cfdata->file);
|
||||||
|
E_FREE(e_config->desktop_default_background);
|
||||||
|
e_config->desktop_default_background = strdup(cfdata->file);
|
||||||
|
e_bg_update();
|
||||||
|
return 1; /* Apply was OK */
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* Actually take our cfdata settings and apply them in real life */
|
||||||
|
|
||||||
|
return 1; /* Apply was OK */
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_config_bg_cb_standard(void *data)
|
||||||
|
{
|
||||||
|
E_Cfg_Bg_Data *d;
|
||||||
|
char *thumb;
|
||||||
|
|
||||||
|
d = data;
|
||||||
|
e_widget_image_object_set(d->cfd->data, e_thumb_evas_object_get(d->file, d->cfd->dia->win->evas, 160, 120, 1));
|
||||||
|
free(thumb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**--GUI--**/
|
||||||
|
static Evas_Object *
|
||||||
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for a basic dialog */
|
||||||
|
Evas_Object *o, *ob, *fr, *im = NULL;
|
||||||
|
Evas_Object *il;
|
||||||
|
char buf[4096];
|
||||||
|
char *homedir;
|
||||||
|
Evas_Object *bg;
|
||||||
|
|
||||||
|
_fill_data(cfdata);
|
||||||
|
|
||||||
|
o = e_widget_table_add(evas, 0);
|
||||||
|
|
||||||
|
cfdata->file = NULL;
|
||||||
|
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->file));
|
||||||
|
//e_widget_ilist_selector_set(il, 1);
|
||||||
|
homedir = e_user_homedir_get();
|
||||||
|
if (homedir)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds", homedir);
|
||||||
|
free(homedir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ecore_file_exists(buf)) && (ecore_file_is_dir(buf)))
|
||||||
|
{
|
||||||
|
Ecore_List *bgs;
|
||||||
|
|
||||||
|
bgs = ecore_file_ls(buf);
|
||||||
|
if (bgs)
|
||||||
|
{
|
||||||
|
char *bg;
|
||||||
|
char fullbg[PATH_MAX];
|
||||||
|
Evas_Object *o;
|
||||||
|
Ecore_Evas *eebuf;
|
||||||
|
Evas *evasbuf;
|
||||||
|
Evas_List *l;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
eebuf = ecore_evas_buffer_new(1, 1);
|
||||||
|
evasbuf = ecore_evas_get(eebuf);
|
||||||
|
o = edje_object_add(evasbuf);
|
||||||
|
|
||||||
|
while ((bg = ecore_list_next(bgs)))
|
||||||
|
{
|
||||||
|
snprintf(fullbg, sizeof(fullbg), "%s/%s", buf, bg);
|
||||||
|
if (ecore_file_is_dir(fullbg))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* minimum theme requirements */
|
||||||
|
if(edje_object_file_set(o, fullbg, "desktop/background"))
|
||||||
|
{
|
||||||
|
Evas_Object *o = NULL;
|
||||||
|
char *noext, *ext;
|
||||||
|
E_Cfg_Bg_Data *cb_data;
|
||||||
|
|
||||||
|
o = e_thumb_generate_begin(fullbg, 48, 48, cfd->dia->win->evas, &o, NULL, NULL);
|
||||||
|
|
||||||
|
ext = strrchr(bg ,'.');
|
||||||
|
|
||||||
|
if (!ext)
|
||||||
|
{
|
||||||
|
noext = strdup(bg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
noext = malloc((ext - bg + 1));
|
||||||
|
if (bg)
|
||||||
|
{
|
||||||
|
memcpy(noext, bg, ext - bg);
|
||||||
|
noext[ext - bg] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb_data = E_NEW(E_Cfg_Bg_Data, 1);
|
||||||
|
cb_data->cfd = cfd;
|
||||||
|
cb_data->file = strdup(fullbg);
|
||||||
|
e_widget_ilist_append(il, o, noext, _e_config_bg_cb_standard, cb_data, fullbg);
|
||||||
|
if(!strcmp(e_config->desktop_default_background, fullbg))
|
||||||
|
{
|
||||||
|
e_widget_ilist_select_set(il, i);
|
||||||
|
bg = edje_object_add(evas);
|
||||||
|
edje_object_file_set(bg, e_config->desktop_default_background, "desktop/background");
|
||||||
|
im = e_widget_image_add_from_object(evas, bg, 160, 120);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_object_del(o);
|
||||||
|
ecore_evas_free(eebuf);
|
||||||
|
ecore_list_destroy(bgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cfd->data = im;
|
||||||
|
e_widget_ilist_go(il);
|
||||||
|
e_widget_min_size_set(il, 240, 320);
|
||||||
|
e_widget_table_object_append(o, il, 0, 0, 1, 2, 1, 1, 1, 1);
|
||||||
|
fr = e_widget_framelist_add(evas, "Preview", 0);
|
||||||
|
if(im == NULL)
|
||||||
|
{
|
||||||
|
bg = edje_object_add(evas);
|
||||||
|
e_theme_edje_object_set(bg, "base/theme/background", "desktop/background");
|
||||||
|
im = e_widget_image_add_from_object(evas, bg, 160, 120);
|
||||||
|
}
|
||||||
|
e_widget_min_size_set(fr, 180, 150);
|
||||||
|
e_widget_table_object_append(o, fr, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
e_widget_framelist_object_append(fr, im);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for an advanced dialog */
|
||||||
|
Evas_Object *o, *ob, *of;
|
||||||
|
|
||||||
|
_fill_data(cfdata);
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
#else
|
||||||
|
#ifndef E_INT_CONFIG_BACKGROUND_H
|
||||||
|
#define E_INT_CONFIG_BACKGROUND_H
|
||||||
|
|
||||||
|
EAPI E_Config_Dialog *e_int_config_background(E_Container *con);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -865,6 +865,10 @@ _e_int_menus_themes_pre_cb(void *data, E_Menu *m)
|
||||||
if (themes)
|
if (themes)
|
||||||
{
|
{
|
||||||
char *theme, *deftheme = NULL;
|
char *theme, *deftheme = NULL;
|
||||||
|
char fulltheme[PATH_MAX];
|
||||||
|
Evas_Object *o;
|
||||||
|
Ecore_Evas *eebuf;
|
||||||
|
Evas *evasbuf;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
|
||||||
for (l = e_config->themes; l; l = l->next)
|
for (l = e_config->themes; l; l = l->next)
|
||||||
|
@ -886,14 +890,20 @@ _e_int_menus_themes_pre_cb(void *data, E_Menu *m)
|
||||||
e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL);
|
e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL);
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
|
eebuf = ecore_evas_buffer_new(1, 1);
|
||||||
|
evasbuf = ecore_evas_get(eebuf);
|
||||||
|
o = edje_object_add(evasbuf);
|
||||||
|
|
||||||
while ((theme = ecore_list_next(themes)))
|
while ((theme = ecore_list_next(themes)))
|
||||||
{
|
{
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
ext = strrchr(theme, '.');
|
snprintf(fulltheme, sizeof(fulltheme), "%s/%s", buf, theme);
|
||||||
if (ecore_file_is_dir(theme) || (!ext))
|
if (ecore_file_is_dir(fulltheme))
|
||||||
continue;
|
continue;
|
||||||
if (!strcasecmp(ext, ".edj"))
|
|
||||||
|
/* minimum theme requirements */
|
||||||
|
if(edje_object_file_set(o, fulltheme, "widgets/border/default/border"))
|
||||||
{
|
{
|
||||||
mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
e_menu_item_radio_set(mi, 1);
|
e_menu_item_radio_set(mi, 1);
|
||||||
|
@ -903,12 +913,14 @@ _e_int_menus_themes_pre_cb(void *data, E_Menu *m)
|
||||||
if (!strcmp(theme, deftheme))
|
if (!strcmp(theme, deftheme))
|
||||||
e_menu_item_toggle_set(mi, 1);
|
e_menu_item_toggle_set(mi, 1);
|
||||||
}
|
}
|
||||||
*ext = 0;
|
|
||||||
e_menu_item_label_set(mi, theme);
|
e_menu_item_label_set(mi, theme);
|
||||||
e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL);
|
e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evas_object_del(o);
|
||||||
|
ecore_evas_free(eebuf);
|
||||||
ecore_list_destroy(themes);
|
ecore_list_destroy(themes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,26 @@
|
||||||
# define D(x) ((void) 0)
|
# define D(x) ((void) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _E_Thumb_Item E_Thumb_Item;
|
||||||
|
|
||||||
static char *_e_thumb_file_id(char *file);
|
static char *_e_thumb_file_id(char *file);
|
||||||
|
static void _e_thumb_generate(void);
|
||||||
|
static int _e_thumb_cb_exe_exit(void *data, int type, void *event);
|
||||||
|
|
||||||
static char *thumb_path = NULL;
|
static char *thumb_path = NULL;
|
||||||
|
static Evas_List *thumb_files = NULL;
|
||||||
|
static Evas_List *event_handlers = NULL;
|
||||||
|
static pid_t pid = -1;
|
||||||
|
|
||||||
|
struct _E_Thumb_Item
|
||||||
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
Evas_Object *obj;
|
||||||
|
Evas *evas;
|
||||||
|
Evas_Coord w, h;
|
||||||
|
void (*cb)(Evas_Object *obj, void *data);
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
e_thumb_init(void)
|
e_thumb_init(void)
|
||||||
|
@ -31,6 +48,11 @@ e_thumb_init(void)
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
||||||
|
event_handlers =
|
||||||
|
evas_list_append(event_handlers,
|
||||||
|
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
|
||||||
|
_e_thumb_cb_exe_exit,
|
||||||
|
NULL));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +60,13 @@ int
|
||||||
e_thumb_shutdown(void)
|
e_thumb_shutdown(void)
|
||||||
{
|
{
|
||||||
E_FREE(thumb_path);
|
E_FREE(thumb_path);
|
||||||
|
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);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +77,53 @@ e_thumb_dir_get(void)
|
||||||
return thumb_path;
|
return thumb_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* queue an image for thumbnailing or return the thumb if it exists */
|
||||||
|
Evas_Object *
|
||||||
|
e_thumb_generate_begin(char *path, Evas_Coord w, Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data)
|
||||||
|
{
|
||||||
|
E_Thumb_Item *t;
|
||||||
|
|
||||||
|
if(!ecore_file_exists(path)) return *tmp;
|
||||||
|
if (e_thumb_exists(path))
|
||||||
|
{
|
||||||
|
evas_object_del(*tmp);
|
||||||
|
*tmp = e_thumb_evas_object_get(path, evas, w, h, 1);
|
||||||
|
return *tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
t = E_NEW(E_Thumb_Item, 1);
|
||||||
|
t->w = w;
|
||||||
|
t->h = h;
|
||||||
|
t->evas = evas;
|
||||||
|
t->cb = cb;
|
||||||
|
t->data = data;
|
||||||
|
*tmp = e_icon_add(evas);
|
||||||
|
t->obj = *tmp;
|
||||||
|
snprintf(t->path, sizeof(t->path), "%s", path);
|
||||||
|
thumb_files = evas_list_append(thumb_files, t);
|
||||||
|
if (pid == -1) _e_thumb_generate();
|
||||||
|
|
||||||
|
return *tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* delete an image from the thumb queue */
|
||||||
|
void
|
||||||
|
e_thumb_generate_end(char *path)
|
||||||
|
{
|
||||||
|
Evas_List *l;
|
||||||
|
E_Thumb_Item *t;
|
||||||
|
|
||||||
|
for(l = thumb_files; l; l = l->next)
|
||||||
|
{
|
||||||
|
t = l->data;
|
||||||
|
if(!strcmp(path, t->path))
|
||||||
|
{
|
||||||
|
thumb_files = evas_list_remove_list(thumb_files, l);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* return hashed path of thumb */
|
/* return hashed path of thumb */
|
||||||
char *
|
char *
|
||||||
e_thumb_file_get(char *file)
|
e_thumb_file_get(char *file)
|
||||||
|
@ -411,3 +487,70 @@ _e_thumb_file_id(char *file)
|
||||||
*sp = 0;
|
*sp = 0;
|
||||||
return strdup(s);
|
return strdup(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* generate a thumb from the list of queued thumbs */
|
||||||
|
static void
|
||||||
|
_e_thumb_generate(void)
|
||||||
|
{
|
||||||
|
E_Thumb_Item *t;
|
||||||
|
|
||||||
|
if ((!thumb_files) || (pid != -1)) return;
|
||||||
|
pid = fork();
|
||||||
|
if (pid == 0)
|
||||||
|
{
|
||||||
|
/* reset signal handlers for the child */
|
||||||
|
signal(SIGSEGV, SIG_DFL);
|
||||||
|
signal(SIGILL, SIG_DFL);
|
||||||
|
signal(SIGFPE, SIG_DFL);
|
||||||
|
signal(SIGBUS, SIG_DFL);
|
||||||
|
|
||||||
|
t = thumb_files->data;
|
||||||
|
if (!e_thumb_exists(t->path))
|
||||||
|
e_thumb_create(t->path, t->w, t->h);
|
||||||
|
eet_cacheburst(0);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* called when a thumb is generated */
|
||||||
|
static int
|
||||||
|
_e_thumb_cb_exe_exit(void *data, int type, void *event)
|
||||||
|
{
|
||||||
|
Ecore_Event_Exe_Exit *ev;
|
||||||
|
E_Thumb_Item *t;
|
||||||
|
char *ext;
|
||||||
|
|
||||||
|
ev = event;
|
||||||
|
if (ev->pid != pid) return 1;
|
||||||
|
if (!thumb_files) return 1;
|
||||||
|
|
||||||
|
t = thumb_files->data;
|
||||||
|
thumb_files = evas_list_remove_list(thumb_files, thumb_files);
|
||||||
|
|
||||||
|
ext = strrchr(t->path, '.');
|
||||||
|
if ((ext) && (strcasecmp(ext, ".eap")))
|
||||||
|
ext = NULL;
|
||||||
|
|
||||||
|
if ((ext) || (ecore_file_exists(t->path)))
|
||||||
|
{
|
||||||
|
Evas_Coord w, h;
|
||||||
|
Evas_Object *tmp;
|
||||||
|
void *data;
|
||||||
|
|
||||||
|
tmp = e_thumb_evas_object_get(t->path,
|
||||||
|
t->evas,
|
||||||
|
t->w,
|
||||||
|
t->h,
|
||||||
|
1);
|
||||||
|
data = e_icon_data_get(tmp, &w, &h);
|
||||||
|
e_icon_data_set(t->obj, data, w, h);
|
||||||
|
evas_object_del(tmp);
|
||||||
|
if(t->cb)
|
||||||
|
t->cb(t->obj, t->data);
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
pid = -1;
|
||||||
|
_e_thumb_generate();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ 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);
|
||||||
EAPI Evas_Object *e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord height, int shrink);
|
EAPI Evas_Object *e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord height, int shrink);
|
||||||
|
EAPI Evas_Object *e_thumb_generate_begin(char *path, Evas_Coord w, Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data);
|
||||||
|
EAPI void e_thumb_generate_end(char *path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,21 +3,33 @@
|
||||||
*/
|
*/
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
|
typedef struct _E_Widget_Data E_Widget_Data;
|
||||||
|
struct _E_Widget_Data
|
||||||
|
{
|
||||||
|
Evas_Object *img;
|
||||||
|
};
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh)
|
e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh)
|
||||||
{
|
{
|
||||||
Evas_Object *obj;
|
Evas_Object *obj, *o;
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
obj = e_widget_add(evas);
|
obj = e_widget_add(evas);
|
||||||
|
wd = calloc(1, sizeof(E_Widget_Data));
|
||||||
|
|
||||||
evas_object_show(object);
|
evas_object_show(object);
|
||||||
|
o = e_icon_add(evas);
|
||||||
|
e_icon_object_set(o, object);
|
||||||
|
wd->img = o;
|
||||||
|
e_widget_data_set(obj, wd);
|
||||||
e_widget_can_focus_set(obj, 0);
|
e_widget_can_focus_set(obj, 0);
|
||||||
e_widget_min_size_set(obj, minw, minh);
|
e_widget_min_size_set(obj, minw, minh);
|
||||||
e_widget_sub_object_add(obj, object);
|
e_widget_sub_object_add(obj, o);
|
||||||
e_widget_resize_object_set(obj, object);
|
e_widget_resize_object_set(obj, o);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -25,13 +37,18 @@ e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int mi
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh)
|
e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh)
|
||||||
{
|
{
|
||||||
Evas_Object *obj, *o;
|
Evas_Object *obj, *o, *o2;
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
obj = e_widget_add(evas);
|
obj = e_widget_add(evas);
|
||||||
|
wd = calloc(1, sizeof(E_Widget_Data));
|
||||||
|
|
||||||
o = evas_object_image_add(evas);
|
o = e_icon_add(evas);
|
||||||
evas_object_image_file_set(o, file, NULL);
|
o2 = evas_object_image_add(evas);
|
||||||
|
evas_object_image_file_set(o2, file, NULL);
|
||||||
|
e_icon_object_set(o, o2);
|
||||||
|
|
||||||
|
wd->img = o;
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
e_widget_can_focus_set(obj, 0);
|
e_widget_can_focus_set(obj, 0);
|
||||||
e_widget_min_size_set(obj, minw, minh);
|
e_widget_min_size_set(obj, minw, minh);
|
||||||
|
@ -40,3 +57,43 @@ e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh)
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_image_edje_set(Evas_Object *obj, char *file, char *part)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_icon_file_edje_set(wd->img, file, part);
|
||||||
|
evas_object_show(wd->img);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_image_file_set(Evas_Object *obj, char *file)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_icon_file_set(wd->img, file);
|
||||||
|
evas_object_show(wd->img);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_image_file_key_set(Evas_Object *obj, char *file, char *key)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_icon_file_key_set(wd->img, file, key);
|
||||||
|
evas_object_show(wd->img);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_image_object_set(Evas_Object *obj, Evas_Object *o)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_icon_object_set(wd->img, o);
|
||||||
|
evas_object_show(wd->img);
|
||||||
|
}
|
||||||
|
|
|
@ -7,7 +7,11 @@
|
||||||
#define E_WIDGET_IMAGE_H
|
#define E_WIDGET_IMAGE_H
|
||||||
|
|
||||||
EAPI Evas_Object *e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh);
|
EAPI Evas_Object *e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh);
|
||||||
EAPI Evas_Object *e_widget_image_add_from_file(Evas *evas, char *file, int aspect, int minh);
|
EAPI Evas_Object *e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh);
|
||||||
|
EAPI void e_widget_image_edje_set(Evas_Object *obj, char *file, char *part);
|
||||||
|
EAPI void e_widget_image_file_set(Evas_Object *obj, char *file);
|
||||||
|
EAPI void e_widget_image_file_key_set(Evas_Object *obj, char *file, char *key);
|
||||||
|
EAPI void e_widget_image_object_set(Evas_Object *obj, Evas_Object *o);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue