and some major refinements of efm - the selector code - well its in e_test.c
is pretty much almost perfectly working. i have fixed up some e_thumb stuff and allowed e_thumb to be more responsive and skip items that are known to be "generated" and bring them ahead in the list of things to thumb - so kind of a priority skiplist - process what it KNOWS will be already done first quickly and leave the slower stuff until later. efm is fairly well refined now - as above. the test selector works nicely. also added an almost-sha1 generator - use sha1 sums of the path for thumbs - less likelihood of collisions. the prolbme is given the small size of the input data... it's hard to do well - but anyway :) SVN revision: 24128
This commit is contained in:
parent
03cca925e3
commit
01efbd7683
|
@ -164,7 +164,8 @@ e_confirm_dialog.h \
|
||||||
e_int_border_prop.h \
|
e_int_border_prop.h \
|
||||||
e_entry_dialog.h \
|
e_entry_dialog.h \
|
||||||
e_fm.h \
|
e_fm.h \
|
||||||
e_widget_scrollframe.h
|
e_widget_scrollframe.h \
|
||||||
|
e_sha1.h
|
||||||
|
|
||||||
enlightenment_src = \
|
enlightenment_src = \
|
||||||
e_user.c \
|
e_user.c \
|
||||||
|
@ -305,6 +306,7 @@ e_int_border_prop.c \
|
||||||
e_entry_dialog.c \
|
e_entry_dialog.c \
|
||||||
e_fm.c \
|
e_fm.c \
|
||||||
e_widget_scrollframe.c \
|
e_widget_scrollframe.c \
|
||||||
|
e_sha1.c \
|
||||||
$(ENLIGHTENMENTHEADERS)
|
$(ENLIGHTENMENTHEADERS)
|
||||||
|
|
||||||
enlightenment_SOURCES = \
|
enlightenment_SOURCES = \
|
||||||
|
@ -345,7 +347,9 @@ e_start_main.c
|
||||||
enlightenment_start_LDFLAGS =
|
enlightenment_start_LDFLAGS =
|
||||||
|
|
||||||
enlightenment_thumb_SOURCES = \
|
enlightenment_thumb_SOURCES = \
|
||||||
e_thumb_main.c
|
e_thumb_main.c \
|
||||||
|
e_sha1.c \
|
||||||
|
e_sha1.h
|
||||||
|
|
||||||
enlightenment_thumb_LDFLAGS = @e_libs@ @dlopen_libs@
|
enlightenment_thumb_LDFLAGS = @e_libs@ @dlopen_libs@
|
||||||
|
|
||||||
|
|
350
src/bin/e_fm.c
350
src/bin/e_fm.c
|
@ -3,7 +3,11 @@
|
||||||
*/
|
*/
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
/* IGNORE this code for now! */
|
/* FIXME: this is NOT complete. dnd doesnt work. only list view works.
|
||||||
|
* in icon view it needs to be much better about placement of icons and
|
||||||
|
* being able to save/load icon placement. it doesn't support backgrounds or
|
||||||
|
* custom frames or icons yet
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct _E_Fm2_Smart_Data E_Fm2_Smart_Data;
|
typedef struct _E_Fm2_Smart_Data E_Fm2_Smart_Data;
|
||||||
typedef struct _E_Fm2_Region E_Fm2_Region;
|
typedef struct _E_Fm2_Region E_Fm2_Region;
|
||||||
|
@ -57,20 +61,14 @@ struct _E_Fm2_Icon
|
||||||
Evas_Object *obj, *obj_icon;
|
Evas_Object *obj, *obj_icon;
|
||||||
int saved_x, saved_y;
|
int saved_x, saved_y;
|
||||||
int saved_rel;
|
int saved_rel;
|
||||||
const char *file;
|
|
||||||
const char *mime;
|
E_Fm2_Icon_Info info;
|
||||||
const char *label;
|
|
||||||
const char *comment;
|
|
||||||
const char *generic;
|
|
||||||
const char *icon;
|
|
||||||
const char *link;
|
|
||||||
struct stat st;
|
|
||||||
unsigned char realized : 1;
|
unsigned char realized : 1;
|
||||||
unsigned char selected : 1;
|
unsigned char selected : 1;
|
||||||
unsigned char last_selected : 1;
|
unsigned char last_selected : 1;
|
||||||
unsigned char saved_pos : 1;
|
unsigned char saved_pos : 1;
|
||||||
unsigned char odd : 1;
|
unsigned char odd : 1;
|
||||||
unsigned char mount : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *_e_fm2_dev_path_map(const char *dev, const char *path);
|
static const char *_e_fm2_dev_path_map(const char *dev, const char *path);
|
||||||
|
@ -189,7 +187,8 @@ e_fm2_path_set(Evas_Object *obj, char *dev, char *path)
|
||||||
/* internal config for now - don't see a pont making this configurable */
|
/* internal config for now - don't see a pont making this configurable */
|
||||||
sd->regions.member_max = 32;
|
sd->regions.member_max = 32;
|
||||||
|
|
||||||
if (sd->config) _e_fm2_config_free(sd->config);
|
if (!sd->config)
|
||||||
|
{
|
||||||
sd->config = E_NEW(E_Fm2_Config, 1);
|
sd->config = E_NEW(E_Fm2_Config, 1);
|
||||||
if (!sd->config) return;
|
if (!sd->config) return;
|
||||||
// sd->config->view.mode = E_FM2_VIEW_MODE_ICONS;
|
// sd->config->view.mode = E_FM2_VIEW_MODE_ICONS;
|
||||||
|
@ -207,13 +206,14 @@ e_fm2_path_set(Evas_Object *obj, char *dev, char *path)
|
||||||
sd->config->icon.extension.show = 0;
|
sd->config->icon.extension.show = 0;
|
||||||
sd->config->list.sort.no_case = 1;
|
sd->config->list.sort.no_case = 1;
|
||||||
sd->config->list.sort.dirs.first = 1;
|
sd->config->list.sort.dirs.first = 1;
|
||||||
sd->config->list.sort.dirs.last = 1;
|
sd->config->list.sort.dirs.last = 0;
|
||||||
sd->config->selection.single = 0;
|
sd->config->selection.single = 0;
|
||||||
sd->config->selection.windows_modifiers = 0;
|
sd->config->selection.windows_modifiers = 0;
|
||||||
sd->config->theme.background = NULL;
|
sd->config->theme.background = NULL;
|
||||||
sd->config->theme.frame = NULL;
|
sd->config->theme.frame = NULL;
|
||||||
sd->config->theme.icons = NULL;
|
sd->config->theme.icons = NULL;
|
||||||
sd->config->theme.fixed = 0;
|
sd->config->theme.fixed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_e_fm2_scan_stop(obj);
|
_e_fm2_scan_stop(obj);
|
||||||
_e_fm2_queue_free(obj);
|
_e_fm2_queue_free(obj);
|
||||||
|
@ -226,7 +226,6 @@ e_fm2_path_set(Evas_Object *obj, char *dev, char *path)
|
||||||
if (dev) sd->dev = evas_stringshare_add(dev);
|
if (dev) sd->dev = evas_stringshare_add(dev);
|
||||||
sd->path = evas_stringshare_add(path);
|
sd->path = evas_stringshare_add(path);
|
||||||
sd->realpath = _e_fm2_dev_path_map(sd->dev, sd->path);
|
sd->realpath = _e_fm2_dev_path_map(sd->dev, sd->path);
|
||||||
printf("FM: %s\n", sd->realpath);
|
|
||||||
_e_fm2_scan_start(obj);
|
_e_fm2_scan_start(obj);
|
||||||
evas_object_smart_callback_call(obj, "changed", NULL);
|
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||||
}
|
}
|
||||||
|
@ -260,6 +259,18 @@ e_fm2_has_parent_get(Evas_Object *obj)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI const char *
|
||||||
|
e_fm2_real_path_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Fm2_Smart_Data *sd;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL; // safety
|
||||||
|
if (!evas_object_type_get(obj)) return NULL; // safety
|
||||||
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety
|
||||||
|
return sd->realpath;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
e_fm2_parent_go(Evas_Object *obj)
|
e_fm2_parent_go(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -280,7 +291,6 @@ e_fm2_parent_go(Evas_Object *obj)
|
||||||
E_FREE(path);
|
E_FREE(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
EAPI void
|
EAPI void
|
||||||
e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg)
|
e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg)
|
||||||
{
|
{
|
||||||
|
@ -290,6 +300,15 @@ e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg)
|
||||||
if (!sd) return; // safety
|
if (!sd) return; // safety
|
||||||
if (!evas_object_type_get(obj)) return; // safety
|
if (!evas_object_type_get(obj)) return; // safety
|
||||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
||||||
|
if (sd->config) _e_fm2_config_free(sd->config);
|
||||||
|
sd->config = NULL;
|
||||||
|
if (!cfg) return;
|
||||||
|
sd->config = E_NEW(E_Fm2_Config, 1);
|
||||||
|
if (!sd->config) return;
|
||||||
|
memcpy(sd->config, cfg, sizeof(E_Fm2_Config));
|
||||||
|
if (cfg->theme.background) sd->config->theme.background = evas_stringshare_add(cfg->theme.background);
|
||||||
|
if (cfg->theme.frame) sd->config->theme.frame = evas_stringshare_add(cfg->theme.frame);
|
||||||
|
if (cfg->theme.icons) sd->config->theme.icons = evas_stringshare_add(cfg->theme.icons);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI E_Fm2_Config *
|
EAPI E_Fm2_Config *
|
||||||
|
@ -297,12 +316,79 @@ e_fm2_config_get(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Fm2_Smart_Data *sd;
|
E_Fm2_Smart_Data *sd;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL; // safety
|
||||||
|
if (!evas_object_type_get(obj)) return NULL; // safety
|
||||||
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety
|
||||||
|
return sd->config;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_List *
|
||||||
|
e_fm2_selected_list_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Fm2_Smart_Data *sd;
|
||||||
|
Evas_List *list = NULL, *l;
|
||||||
|
E_Fm2_Icon *ic;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL; // safety
|
||||||
|
if (!evas_object_type_get(obj)) return NULL; // safety
|
||||||
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety
|
||||||
|
for (l = sd->icons; l; l = l->next)
|
||||||
|
{
|
||||||
|
ic = l->data;
|
||||||
|
if (ic->selected)
|
||||||
|
list = evas_list_append(list, &(ic->info));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_List *
|
||||||
|
e_fm2_all_list_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Fm2_Smart_Data *sd;
|
||||||
|
Evas_List *list = NULL, *l;
|
||||||
|
E_Fm2_Icon *ic;
|
||||||
|
|
||||||
|
sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL; // safety
|
||||||
|
if (!evas_object_type_get(obj)) return NULL; // safety
|
||||||
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety
|
||||||
|
for (l = sd->icons; l; l = l->next)
|
||||||
|
{
|
||||||
|
ic = l->data;
|
||||||
|
list = evas_list_append(list, &(ic->info));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_fm2_select_set(Evas_Object *obj, char *file, int select)
|
||||||
|
{
|
||||||
|
E_Fm2_Smart_Data *sd;
|
||||||
|
Evas_List *l;
|
||||||
|
E_Fm2_Icon *ic;
|
||||||
|
|
||||||
sd = evas_object_smart_data_get(obj);
|
sd = evas_object_smart_data_get(obj);
|
||||||
if (!sd) return; // safety
|
if (!sd) return; // safety
|
||||||
if (!evas_object_type_get(obj)) return; // safety
|
if (!evas_object_type_get(obj)) return; // safety
|
||||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
||||||
|
for (l = sd->icons; l; l = l->next)
|
||||||
|
{
|
||||||
|
ic = l->data;
|
||||||
|
if (!strcmp(ic->info.file, file))
|
||||||
|
{
|
||||||
|
if (select) _e_fm2_icon_select(ic);
|
||||||
|
else _e_fm2_icon_deselect(ic);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ic->sd->config->view.single_click)
|
||||||
|
_e_fm2_icon_deselect(ic);
|
||||||
|
ic->last_selected = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
|
@ -320,7 +406,6 @@ e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
if ((sd->pos.x == x) && (sd->pos.y == y)) return;
|
if ((sd->pos.x == x) && (sd->pos.y == y)) return;
|
||||||
sd->pos.x = x;
|
sd->pos.x = x;
|
||||||
sd->pos.y = y;
|
sd->pos.y = y;
|
||||||
printf("POS %i %i\n", x, y);
|
|
||||||
if (sd->scroll_job) ecore_job_del(sd->scroll_job);
|
if (sd->scroll_job) ecore_job_del(sd->scroll_job);
|
||||||
sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj);
|
sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj);
|
||||||
}
|
}
|
||||||
|
@ -398,6 +483,19 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
|
||||||
PRT("%s%s", s, path);
|
PRT("%s%s", s, path);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
else if (dev[0] == '/') {
|
||||||
|
/* dev is a full path - consider it a mountpoint device on its own */
|
||||||
|
PRT("%s%s", dev, path);
|
||||||
|
}
|
||||||
|
else if (CMP("favorites")) {
|
||||||
|
/* this is a virtual device - it's where your favorites list is
|
||||||
|
* stored - a dir with .desktop files or symlinks (in fact anything
|
||||||
|
* you like
|
||||||
|
*/
|
||||||
|
s = e_user_homedir_get();
|
||||||
|
PRT("%s/.e/e/fileman/favorites", s);
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
else if (CMP("dvd") || CMP("dvd-*")) {
|
else if (CMP("dvd") || CMP("dvd-*")) {
|
||||||
/* FIXME: find dvd mountpoint optionally for dvd no. X */
|
/* FIXME: find dvd mountpoint optionally for dvd no. X */
|
||||||
/* maybe make part of the device mappings config? */
|
/* maybe make part of the device mappings config? */
|
||||||
|
@ -524,6 +622,7 @@ _e_fm2_queue_process(Evas_Object *obj)
|
||||||
sd->icons = evas_list_sort(sd->icons, evas_list_count(sd->icons), _e_fm2_cb_icon_sort);
|
sd->icons = evas_list_sort(sd->icons, evas_list_count(sd->icons), _e_fm2_cb_icon_sort);
|
||||||
if (sd->resize_job) ecore_job_del(sd->resize_job);
|
if (sd->resize_job) ecore_job_del(sd->resize_job);
|
||||||
sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj);
|
sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj);
|
||||||
|
evas_object_smart_callback_call(sd->obj, "files_changed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -866,21 +965,25 @@ _e_fm2_icon_new(E_Fm2_Smart_Data *sd, char *file)
|
||||||
E_Fm2_Icon *ic;
|
E_Fm2_Icon *ic;
|
||||||
Evas_Coord mw = 0, mh = 0;
|
Evas_Coord mw = 0, mh = 0;
|
||||||
Evas_Object *obj, *obj2;
|
Evas_Object *obj, *obj2;
|
||||||
char buf[4096], buf2[4096];
|
char buf[4096], *lnk;
|
||||||
|
|
||||||
/* create icon */
|
/* create icon */
|
||||||
ic = E_NEW(E_Fm2_Icon, 1);
|
ic = E_NEW(E_Fm2_Icon, 1);
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, file);
|
snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, file);
|
||||||
if (stat(buf, &(ic->st)) == -1)
|
if (stat(buf, &(ic->info.statinfo)) == -1)
|
||||||
{
|
{
|
||||||
free(ic);
|
free(ic);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ic->sd = sd;
|
ic->sd = sd;
|
||||||
ic->file = evas_stringshare_add(file);
|
ic->info.file = evas_stringshare_add(file);
|
||||||
if (readlink(buf, buf2, sizeof(buf2) - 1) == 0)
|
lnk = ecore_file_readlink(buf);
|
||||||
ic->link = evas_stringshare_add(buf2);
|
if (lnk)
|
||||||
if (e_util_glob_case_match(ic->file, "*.desktop"))
|
{
|
||||||
|
ic->info.link = evas_stringshare_add(lnk);
|
||||||
|
free(lnk);
|
||||||
|
}
|
||||||
|
if (e_util_glob_case_match(ic->info.file, "*.desktop"))
|
||||||
_e_fm2_icon_desktop_load(ic);
|
_e_fm2_icon_desktop_load(ic);
|
||||||
switch (sd->config->view.mode)
|
switch (sd->config->view.mode)
|
||||||
{
|
{
|
||||||
|
@ -956,13 +1059,13 @@ _e_fm2_icon_free(E_Fm2_Icon *ic)
|
||||||
{
|
{
|
||||||
/* free icon, object data etc. etc. */
|
/* free icon, object data etc. etc. */
|
||||||
_e_fm2_icon_unrealize(ic);
|
_e_fm2_icon_unrealize(ic);
|
||||||
if (ic->file) evas_stringshare_del(ic->file);
|
if (ic->info.file) evas_stringshare_del(ic->info.file);
|
||||||
if (ic->mime) evas_stringshare_del(ic->mime);
|
if (ic->info.mime) evas_stringshare_del(ic->info.mime);
|
||||||
if (ic->label) evas_stringshare_del(ic->label);
|
if (ic->info.label) evas_stringshare_del(ic->info.label);
|
||||||
if (ic->comment) evas_stringshare_del(ic->comment);
|
if (ic->info.comment) evas_stringshare_del(ic->info.comment);
|
||||||
if (ic->generic) evas_stringshare_del(ic->generic);
|
if (ic->info.generic) evas_stringshare_del(ic->info.generic);
|
||||||
if (ic->icon) evas_stringshare_del(ic->icon);
|
if (ic->info.icon) evas_stringshare_del(ic->info.icon);
|
||||||
if (ic->link) evas_stringshare_del(ic->link);
|
if (ic->info.link) evas_stringshare_del(ic->info.link);
|
||||||
free(ic);
|
free(ic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,20 +1168,20 @@ _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj)
|
||||||
char buf[4096], *p;
|
char buf[4096], *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (ic->label)
|
if (ic->info.label)
|
||||||
{
|
{
|
||||||
edje_object_part_text_set(obj, "label", ic->label);
|
edje_object_part_text_set(obj, "label", ic->info.label);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ic->sd->config->icon.extension.show)
|
if (ic->sd->config->icon.extension.show)
|
||||||
edje_object_part_text_set(obj, "label", ic->file);
|
edje_object_part_text_set(obj, "label", ic->info.file);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* remove extension. handle double extensions like .tar.gz too
|
/* remove extension. handle double extensions like .tar.gz too
|
||||||
* also be fuzzy - up to 4 chars of extn is ok - eg .html but 5 or
|
* also be fuzzy - up to 4 chars of extn is ok - eg .html but 5 or
|
||||||
* more is considered part of the name
|
* more is considered part of the name
|
||||||
*/
|
*/
|
||||||
strncpy(buf, ic->file, sizeof(buf) - 2);
|
strncpy(buf, ic->info.file, sizeof(buf) - 2);
|
||||||
buf[sizeof(buf) - 1] = 0;
|
buf[sizeof(buf) - 1] = 0;
|
||||||
|
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
|
@ -1101,30 +1204,30 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (!ic->realized) return;
|
if (!ic->realized) return;
|
||||||
if (ic->icon)
|
if (ic->info.icon)
|
||||||
{
|
{
|
||||||
/* custom icon */
|
/* custom icon */
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* if ic->icon == blah then use theme icon
|
* if ic->info.icon == blah then use theme icon
|
||||||
* if ic->icon == blah/blah2 then use theme icon
|
* if ic->info.icon == blah/blah2 then use theme icon
|
||||||
* if ic->icon == /blah/blah2.xxx then use full path
|
* if ic->info.icon == /blah/blah2.xxx then use full path
|
||||||
* if ic->icon == blah.xxx then use relative path to icon dirs
|
* if ic->info.icon == blah.xxx then use relative path to icon dirs
|
||||||
* if ic->icon == blah/blah2.xxx then use relative path to icon dirs
|
* if ic->info.icon == blah/blah2.xxx then use relative path to icon dirs
|
||||||
*/
|
*/
|
||||||
/* theme icon */
|
/* theme icon */
|
||||||
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
|
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
|
||||||
e_util_edje_icon_set(ic->obj_icon, ic->icon);
|
e_util_edje_icon_set(ic->obj_icon, ic->info.icon);
|
||||||
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
||||||
evas_object_show(ic->obj_icon);
|
evas_object_show(ic->obj_icon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ic->mime)
|
if (ic->info.mime)
|
||||||
{
|
{
|
||||||
/* use mime type to select icon */
|
/* use mime type to select icon */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* fallback */
|
/* fallback */
|
||||||
if (S_ISDIR(ic->st.st_mode))
|
if (S_ISDIR(ic->info.statinfo.st_mode))
|
||||||
{
|
{
|
||||||
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
|
ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj));
|
||||||
e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman",
|
e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman",
|
||||||
|
@ -1135,48 +1238,48 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(e_util_glob_case_match(ic->file, "*.jpg")) ||
|
(e_util_glob_case_match(ic->info.file, "*.jpg")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.jpeg")) ||
|
(e_util_glob_case_match(ic->info.file, "*.jpeg")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.jfif")) ||
|
(e_util_glob_case_match(ic->info.file, "*.jfif")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.jpe")) ||
|
(e_util_glob_case_match(ic->info.file, "*.jpe")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.png")) ||
|
(e_util_glob_case_match(ic->info.file, "*.png")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.gif")) ||
|
(e_util_glob_case_match(ic->info.file, "*.gif")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.tif")) ||
|
(e_util_glob_case_match(ic->info.file, "*.tif")) ||
|
||||||
(e_util_glob_case_match(ic->file, "*.tiff"))
|
(e_util_glob_case_match(ic->info.file, "*.tiff"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->file);
|
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||||
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
||||||
e_thumb_icon_file_set(ic->obj_icon, buf, NULL);
|
e_thumb_icon_file_set(ic->obj_icon, buf, NULL);
|
||||||
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
||||||
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
||||||
e_thumb_icon_begin(ic->obj_icon);
|
if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon);
|
||||||
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
||||||
evas_object_show(ic->obj_icon);
|
evas_object_show(ic->obj_icon);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(e_util_glob_case_match(ic->file, "*.edj"))
|
(e_util_glob_case_match(ic->info.file, "*.edj"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->file);
|
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||||
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
||||||
e_thumb_icon_file_set(ic->obj_icon, buf, "desktop/background");
|
e_thumb_icon_file_set(ic->obj_icon, buf, "desktop/background");
|
||||||
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
||||||
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
||||||
e_thumb_icon_begin(ic->obj_icon);
|
if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon);
|
||||||
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
||||||
evas_object_show(ic->obj_icon);
|
evas_object_show(ic->obj_icon);
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(e_util_glob_case_match(ic->file, "*.eap"))
|
(e_util_glob_case_match(ic->info.file, "*.eap"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->file);
|
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||||
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj));
|
||||||
e_thumb_icon_file_set(ic->obj_icon, buf, "icon");
|
e_thumb_icon_file_set(ic->obj_icon, buf, "icon");
|
||||||
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
e_thumb_icon_size_set(ic->obj_icon, 64, 64);
|
||||||
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic);
|
||||||
e_thumb_icon_begin(ic->obj_icon);
|
if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon);
|
||||||
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon);
|
||||||
evas_object_show(ic->obj_icon);
|
evas_object_show(ic->obj_icon);
|
||||||
}
|
}
|
||||||
|
@ -1221,50 +1324,16 @@ _e_fm2_icon_deselect(E_Fm2_Icon *ic)
|
||||||
static const char *
|
static const char *
|
||||||
_e_fm2_icon_desktop_url_eval(const char *val)
|
_e_fm2_icon_desktop_url_eval(const char *val)
|
||||||
{
|
{
|
||||||
char *path, *p, buf[4096], *pd, *e1, *e2;
|
char *path, *p, *s;
|
||||||
|
|
||||||
if (strlen(val) < 6) return NULL;
|
if (strlen(val) < 6) return NULL;
|
||||||
if (strncmp(val, "file:", 5)) return NULL;
|
if (strncmp(val, "file:", 5)) return NULL;
|
||||||
path = val + 5;
|
path = (char *)val + 5;
|
||||||
buf[0] = 0;
|
p = e_util_shell_env_path_eval(path);
|
||||||
p = path;
|
if (!p) return NULL;
|
||||||
pd = buf;
|
s = evas_stringshare_add(p);
|
||||||
e1 = e2 = NULL;
|
free(p);
|
||||||
/* FIXME: evaluate any shell vars - eg:
|
return s;
|
||||||
* $XX/blah/$HOME/blah2/$A$B
|
|
||||||
*/
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (*p == '$')
|
|
||||||
{
|
|
||||||
if (e1)
|
|
||||||
{
|
|
||||||
e2 = p;
|
|
||||||
|
|
||||||
e1 = NULL;
|
|
||||||
e2 = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
e1 = p + 1;
|
|
||||||
}
|
|
||||||
else if (e1)
|
|
||||||
{
|
|
||||||
if (!(isalnum(*p) || (*p == '_')))
|
|
||||||
{
|
|
||||||
e2 = p;
|
|
||||||
|
|
||||||
e1 = NULL;
|
|
||||||
e2 = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
*pd = *p;
|
|
||||||
p++;
|
|
||||||
pd++;
|
|
||||||
}
|
|
||||||
*pd = 0;
|
|
||||||
return evas_stringshare_add(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1273,21 +1342,24 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
|
||||||
char buf[4096], key[256], val[4096];
|
char buf[4096], key[256], val[4096];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->file);
|
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
if (!f) return 0;
|
if (!f) return 0;
|
||||||
if (!fgets(buf, sizeof(buf), f)) goto error;
|
if (!fgets(buf, sizeof(buf), f)) goto error;
|
||||||
if (strcmp(buf, "[Desktop Entry]\n")) goto error;
|
if (strcmp(buf, "[Desktop Entry]\n")) goto error;
|
||||||
while (fscanf(f, "%255[^=]=%4095[^\n]\n", key, val) == 2)
|
while (fscanf(f, "%255[^=]=%4095[^\n]\n", key, val) == 2)
|
||||||
{
|
{
|
||||||
printf("%s=%s\n", key, val);
|
if (!strcmp(key, "Name"))
|
||||||
if (!strcmp(key, "Name")) ic->label = evas_stringshare_add(val);
|
ic->info.label = evas_stringshare_add(val);
|
||||||
else if (!strcmp(key, "Comment")) ic->comment = evas_stringshare_add(val);
|
else if (!strcmp(key, "Comment"))
|
||||||
else if (!strcmp(key, "Generic")) ic->generic = evas_stringshare_add(val);
|
ic->info.comment = evas_stringshare_add(val);
|
||||||
else if (!strcmp(key, "Icon")) ic->icon = evas_stringshare_add(val);
|
else if (!strcmp(key, "Generic"))
|
||||||
|
ic->info.generic = evas_stringshare_add(val);
|
||||||
|
else if (!strcmp(key, "Icon"))
|
||||||
|
ic->info.icon = evas_stringshare_add(val);
|
||||||
else if (!strcmp(key, "Type"))
|
else if (!strcmp(key, "Type"))
|
||||||
{
|
{
|
||||||
if (!strcmp(val, "Mount")) ic->mount = 1;
|
if (!strcmp(val, "Mount")) ic->info.mount = 1;
|
||||||
else if (!strcmp(val, "Link"))
|
else if (!strcmp(val, "Link"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1295,25 +1367,25 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "File"))
|
else if (!strcmp(key, "File"))
|
||||||
ic->link = _e_fm2_icon_desktop_url_eval(val);
|
ic->info.link = _e_fm2_icon_desktop_url_eval(val);
|
||||||
else if (!strcmp(key, "URL"))
|
else if (!strcmp(key, "URL"))
|
||||||
ic->link = _e_fm2_icon_desktop_url_eval(val);
|
ic->info.link = _e_fm2_icon_desktop_url_eval(val);
|
||||||
else if (!strcmp(key, "Path"))
|
else if (!strcmp(key, "Path"))
|
||||||
ic->link = _e_fm2_icon_desktop_url_eval(val);
|
ic->info.link = _e_fm2_icon_desktop_url_eval(val);
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return 1;
|
return 1;
|
||||||
error:
|
error:
|
||||||
if (ic->label) evas_stringshare_del(ic->label);
|
if (ic->info.label) evas_stringshare_del(ic->info.label);
|
||||||
if (ic->comment) evas_stringshare_del(ic->comment);
|
if (ic->info.comment) evas_stringshare_del(ic->info.comment);
|
||||||
if (ic->generic) evas_stringshare_del(ic->generic);
|
if (ic->info.generic) evas_stringshare_del(ic->info.generic);
|
||||||
if (ic->icon) evas_stringshare_del(ic->icon);
|
if (ic->info.icon) evas_stringshare_del(ic->info.icon);
|
||||||
if (ic->link) evas_stringshare_del(ic->link);
|
if (ic->info.link) evas_stringshare_del(ic->info.link);
|
||||||
ic->label = NULL;
|
ic->info.label = NULL;
|
||||||
ic->comment = NULL;
|
ic->info.comment = NULL;
|
||||||
ic->generic = NULL;
|
ic->info.generic = NULL;
|
||||||
ic->icon = NULL;
|
ic->info.icon = NULL;
|
||||||
ic->link = NULL;
|
ic->info.link = NULL;
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1347,13 +1419,18 @@ static void
|
||||||
_e_fm2_region_realize(E_Fm2_Region *rg)
|
_e_fm2_region_realize(E_Fm2_Region *rg)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
|
E_Fm2_Icon *ic;
|
||||||
|
|
||||||
if (rg->realized) return;
|
if (rg->realized) return;
|
||||||
/* actually create evas objects etc. */
|
/* actually create evas objects etc. */
|
||||||
rg->realized = 1;
|
rg->realized = 1;
|
||||||
printf("REG %p REALIZE\n", rg);
|
|
||||||
edje_freeze();
|
edje_freeze();
|
||||||
for (l = rg->list; l; l = l->next) _e_fm2_icon_realize(l->data);
|
for (l = rg->list; l; l = l->next) _e_fm2_icon_realize(l->data);
|
||||||
|
for (l = rg->list; l; l = l->next)
|
||||||
|
{
|
||||||
|
ic = l->data;
|
||||||
|
if (ic->selected) evas_object_raise(ic->obj);
|
||||||
|
}
|
||||||
edje_thaw();
|
edje_thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1365,7 +1442,6 @@ _e_fm2_region_unrealize(E_Fm2_Region *rg)
|
||||||
if (!rg->realized) return;
|
if (!rg->realized) return;
|
||||||
/* delete evas objects */
|
/* delete evas objects */
|
||||||
rg->realized = 0;
|
rg->realized = 0;
|
||||||
printf("REG %p UNREALIZE\n", rg);
|
|
||||||
edje_freeze();
|
edje_freeze();
|
||||||
for (l = rg->list; l; l = l->next) _e_fm2_icon_unrealize(l->data);
|
for (l = rg->list; l; l = l->next) _e_fm2_icon_unrealize(l->data);
|
||||||
edje_thaw();
|
edje_thaw();
|
||||||
|
@ -1404,7 +1480,7 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
||||||
{
|
{
|
||||||
/* if its a directory && open dirs in-place is set then change the dir
|
/* if its a directory && open dirs in-place is set then change the dir
|
||||||
* to be the dir + file */
|
* to be the dir + file */
|
||||||
if ((S_ISDIR(ic->st.st_mode)) &&
|
if ((S_ISDIR(ic->info.statinfo.st_mode)) &&
|
||||||
(ic->sd->config->view.open_dirs_in_place) &&
|
(ic->sd->config->view.open_dirs_in_place) &&
|
||||||
(!ic->sd->config->view.no_subdir_jump) &&
|
(!ic->sd->config->view.no_subdir_jump) &&
|
||||||
(!ic->sd->config->view.single_click)
|
(!ic->sd->config->view.single_click)
|
||||||
|
@ -1413,7 +1489,7 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
||||||
char buf[4096], *dev = NULL;
|
char buf[4096], *dev = NULL;
|
||||||
|
|
||||||
if (ic->sd->dev) dev = strdup(ic->sd->dev);
|
if (ic->sd->dev) dev = strdup(ic->sd->dev);
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->file);
|
snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file);
|
||||||
e_fm2_path_set(ic->sd->obj, dev, buf);
|
e_fm2_path_set(ic->sd->obj, dev, buf);
|
||||||
E_FREE(dev);
|
E_FREE(dev);
|
||||||
}
|
}
|
||||||
|
@ -1507,7 +1583,8 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
||||||
_e_fm2_icon_deselect(ic);
|
_e_fm2_icon_deselect(ic);
|
||||||
else
|
else
|
||||||
_e_fm2_icon_select(ic);
|
_e_fm2_icon_select(ic);
|
||||||
if (!(S_ISDIR(ic->st.st_mode)) &&
|
if ((!(S_ISDIR(ic->info.statinfo.st_mode)) ||
|
||||||
|
(ic->sd->config->view.no_subdir_jump)) &&
|
||||||
(ic->sd->config->view.single_click)
|
(ic->sd->config->view.single_click)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1556,7 +1633,6 @@ _e_fm2_cb_scroll_job(void *data)
|
||||||
sd = evas_object_smart_data_get(data);
|
sd = evas_object_smart_data_get(data);
|
||||||
if (!sd) return;
|
if (!sd) return;
|
||||||
sd->scroll_job = NULL;
|
sd->scroll_job = NULL;
|
||||||
printf("DO scroll!\n");
|
|
||||||
evas_event_freeze(evas_object_evas_get(sd->obj));
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
||||||
edje_freeze();
|
edje_freeze();
|
||||||
_e_fm2_regions_eval(sd->obj);
|
_e_fm2_regions_eval(sd->obj);
|
||||||
|
@ -1625,19 +1701,21 @@ _e_fm2_cb_icon_sort(void *data1, void *data2)
|
||||||
|
|
||||||
ic1 = data1;
|
ic1 = data1;
|
||||||
ic2 = data2;
|
ic2 = data2;
|
||||||
if (ic1->sd->config->list.sort.dirs.last)
|
if (ic1->sd->config->list.sort.dirs.first)
|
||||||
{
|
{
|
||||||
if ((S_ISDIR(ic1->st.st_mode)) != (S_ISDIR(ic2->st.st_mode)))
|
if ((S_ISDIR(ic1->info.statinfo.st_mode)) !=
|
||||||
|
(S_ISDIR(ic2->info.statinfo.st_mode)))
|
||||||
{
|
{
|
||||||
if (S_ISDIR(ic1->st.st_mode)) return -1;
|
if (S_ISDIR(ic1->info.statinfo.st_mode)) return -1;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ic1->sd->config->list.sort.dirs.first)
|
else if (ic1->sd->config->list.sort.dirs.last)
|
||||||
{
|
{
|
||||||
if ((S_ISDIR(ic1->st.st_mode)) != (S_ISDIR(ic2->st.st_mode)))
|
if ((S_ISDIR(ic1->info.statinfo.st_mode)) !=
|
||||||
|
(S_ISDIR(ic2->info.statinfo.st_mode)))
|
||||||
{
|
{
|
||||||
if (S_ISDIR(ic1->st.st_mode)) return 1;
|
if (S_ISDIR(ic1->info.statinfo.st_mode)) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1645,8 +1723,8 @@ _e_fm2_cb_icon_sort(void *data1, void *data2)
|
||||||
{
|
{
|
||||||
char buf1[4096], buf2[4096], *p;
|
char buf1[4096], buf2[4096], *p;
|
||||||
|
|
||||||
strncpy(buf1, ic1->file, sizeof(buf1) - 2);
|
strncpy(buf1, ic1->info.file, sizeof(buf1) - 2);
|
||||||
strncpy(buf2, ic2->file, sizeof(buf2) - 2);
|
strncpy(buf2, ic2->info.file, sizeof(buf2) - 2);
|
||||||
buf1[sizeof(buf1) - 1] = 0;
|
buf1[sizeof(buf1) - 1] = 0;
|
||||||
buf2[sizeof(buf2) - 1] = 0;
|
buf2[sizeof(buf2) - 1] = 0;
|
||||||
p = buf1;
|
p = buf1;
|
||||||
|
@ -1663,7 +1741,7 @@ _e_fm2_cb_icon_sort(void *data1, void *data2)
|
||||||
}
|
}
|
||||||
return strcmp(buf1, buf2);
|
return strcmp(buf1, buf2);
|
||||||
}
|
}
|
||||||
return strcmp(ic1->file, ic2->file);
|
return strcmp(ic1->info.file, ic2->info.file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1741,6 +1819,10 @@ _e_fm2_obj_icons_place(E_Fm2_Smart_Data *sd)
|
||||||
sd->x + ic->x - sd->pos.x,
|
sd->x + ic->x - sd->pos.x,
|
||||||
sd->y + ic->y - sd->pos.y);
|
sd->y + ic->y - sd->pos.y);
|
||||||
evas_object_resize(ic->obj, ic->w, ic->h);
|
evas_object_resize(ic->obj, ic->w, ic->h);
|
||||||
|
if (_e_fm2_icon_visible(ic))
|
||||||
|
e_thumb_icon_begin(ic->obj_icon);
|
||||||
|
else
|
||||||
|
e_thumb_icon_end(ic->obj_icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ typedef enum _E_Fm2_View_Mode
|
||||||
} E_Fm2_View_Mode;
|
} E_Fm2_View_Mode;
|
||||||
|
|
||||||
typedef struct _E_Fm2_Config E_Fm2_Config;
|
typedef struct _E_Fm2_Config E_Fm2_Config;
|
||||||
|
typedef struct _E_Fm2_Icon_Info E_Fm2_Icon_Info;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifndef E_FM_H
|
#ifndef E_FM_H
|
||||||
|
@ -81,13 +82,31 @@ struct _E_Fm2_Config
|
||||||
} geometry;
|
} geometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _E_Fm2_Icon_Info
|
||||||
|
{
|
||||||
|
const char *file;
|
||||||
|
const char *mime;
|
||||||
|
const char *label;
|
||||||
|
const char *comment;
|
||||||
|
const char *generic;
|
||||||
|
const char *icon;
|
||||||
|
const char *link;
|
||||||
|
struct stat statinfo;
|
||||||
|
unsigned char mount : 1;
|
||||||
|
};
|
||||||
|
|
||||||
EAPI int e_fm2_init(void);
|
EAPI int e_fm2_init(void);
|
||||||
EAPI int e_fm2_shutdown(void);
|
EAPI int e_fm2_shutdown(void);
|
||||||
EAPI Evas_Object *e_fm2_add(Evas *evas);
|
EAPI Evas_Object *e_fm2_add(Evas *evas);
|
||||||
EAPI void e_fm2_path_set(Evas_Object *obj, char *dev, char *path);
|
EAPI void e_fm2_path_set(Evas_Object *obj, char *dev, char *path);
|
||||||
EAPI void e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path);
|
EAPI void e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path);
|
||||||
|
EAPI const char *e_fm2_real_path_get(Evas_Object *obj);
|
||||||
EAPI int e_fm2_has_parent_get(Evas_Object *obj);
|
EAPI int e_fm2_has_parent_get(Evas_Object *obj);
|
||||||
EAPI void e_fm2_parent_go(Evas_Object *obj);
|
EAPI void e_fm2_parent_go(Evas_Object *obj);
|
||||||
|
EAPI void e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg);
|
||||||
|
EAPI E_Fm2_Config *e_fm2_config_get(Evas_Object *obj);
|
||||||
|
EAPI Evas_List *e_fm2_selected_list_get(Evas_Object *obj);
|
||||||
|
EAPI Evas_List *e_fm2_all_list_get(Evas_Object *obj);
|
||||||
|
|
||||||
EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||||
EAPI void e_fm2_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
EAPI void e_fm2_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||||
|
|
|
@ -140,3 +140,4 @@
|
||||||
#include "e_entry_dialog.h"
|
#include "e_entry_dialog.h"
|
||||||
#include "e_fm.h"
|
#include "e_fm.h"
|
||||||
#include "e_widget_scrollframe.h"
|
#include "e_widget_scrollframe.h"
|
||||||
|
#include "e_sha1.h"
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e_sha1.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
/* externally accessible functions */
|
||||||
|
|
||||||
|
#define SHSH(n, v) ((((v) << (n)) & 0xffffffff) | ((v) >> (32 - (n))))
|
||||||
|
|
||||||
|
/* this is ALMOST canonical sha1 - i took some shortcuts to make it smaller
|
||||||
|
* when handling the last 64 bytes in a buffer to just keep it short. it
|
||||||
|
* still generates decent hashes either way...
|
||||||
|
*/
|
||||||
|
EAPI int
|
||||||
|
e_sha1_sum(unsigned char *data, int size, unsigned char *dst)
|
||||||
|
{
|
||||||
|
unsigned int digest[5], word[80], wa, wb, wc, wd, we, t;
|
||||||
|
unsigned char buf[64], *d;
|
||||||
|
int index, left, i;
|
||||||
|
const unsigned int magic[4] =
|
||||||
|
{
|
||||||
|
0x5a827999,
|
||||||
|
0x6ed9eba1,
|
||||||
|
0x8f1bbcdc,
|
||||||
|
0xca62c1d6
|
||||||
|
};
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
digest[0] = 0x67452301;
|
||||||
|
digest[1] = 0xefcdab89;
|
||||||
|
digest[2] = 0x98badcfe;
|
||||||
|
digest[3] = 0x10325476;
|
||||||
|
digest[4] = 0xc3d2e1f0;
|
||||||
|
|
||||||
|
for (left = size, d = data; left > 0; left--, d++)
|
||||||
|
{
|
||||||
|
if ((index == 0) && (left < 64))
|
||||||
|
{
|
||||||
|
memset(buf, 0, 60);
|
||||||
|
buf[60] = (size >> 24) & 0xff;
|
||||||
|
buf[61] = (size >> 16) & 0xff;
|
||||||
|
buf[62] = (size >> 8) & 0xff;
|
||||||
|
buf[63] = (size ) & 0xff;
|
||||||
|
}
|
||||||
|
buf[index] = *d;
|
||||||
|
index++;
|
||||||
|
if ((index == 64) || (left == 1))
|
||||||
|
{
|
||||||
|
if ((left == 1) && (index < 64)) buf[index] = 0x80;
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
word[i] = (unsigned int)buf[(i * 4) ] << 24;
|
||||||
|
word[i] |= (unsigned int)buf[(i * 4) + 1] << 16;
|
||||||
|
word[i] |= (unsigned int)buf[(i * 4) + 2] << 8;
|
||||||
|
word[i] |= (unsigned int)buf[(i * 4) + 3];
|
||||||
|
}
|
||||||
|
for (i = 16; i < 80; i++)
|
||||||
|
word[i] = SHSH(1,
|
||||||
|
word[i - 3 ] ^ word[i - 8 ] ^
|
||||||
|
word[i - 14] ^ word[i - 16]);
|
||||||
|
wa = digest[0];
|
||||||
|
wb = digest[1];
|
||||||
|
wc = digest[2];
|
||||||
|
wd = digest[3];
|
||||||
|
we = digest[4];
|
||||||
|
for (i = 0; i < 80; i++)
|
||||||
|
{
|
||||||
|
if (i < 20)
|
||||||
|
t = SHSH(5, wa) + ((wb & wc) | ((~wb) & wd)) +
|
||||||
|
we + word[i] + magic[0];
|
||||||
|
else if (i < 40)
|
||||||
|
t = SHSH(5, wa) + (wb ^ wc ^ wd) +
|
||||||
|
we + word[i] + magic[1];
|
||||||
|
else if (i < 60)
|
||||||
|
t = SHSH(5, wa) + ((wb & wc) | (wb & wd) | (wc & wd)) +
|
||||||
|
we + word[i] + magic[2];
|
||||||
|
else if (i < 80)
|
||||||
|
t = SHSH(5, wa) + (wb ^ wc ^ wd) +
|
||||||
|
we + word[i] + magic[3];
|
||||||
|
we = wd;
|
||||||
|
wd = wc;
|
||||||
|
wc = SHSH(30, wb);
|
||||||
|
wb = wa;
|
||||||
|
wa = t;
|
||||||
|
}
|
||||||
|
digest[0] += wa;
|
||||||
|
digest[1] += wb;
|
||||||
|
digest[2] += wc;
|
||||||
|
digest[3] += wd;
|
||||||
|
digest[4] += we;
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t = htonl(digest[0]); digest[0] = t;
|
||||||
|
t = htonl(digest[1]); digest[1] = t;
|
||||||
|
t = htonl(digest[2]); digest[2] = t;
|
||||||
|
t = htonl(digest[3]); digest[3] = t;
|
||||||
|
t = htonl(digest[4]); digest[4] = t;
|
||||||
|
|
||||||
|
memcpy(dst, digest, 5 * 4);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* local subsystem functions */
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifndef E_SHA1_H
|
||||||
|
#define E_SHA1_H
|
||||||
|
|
||||||
|
#ifndef EAPI
|
||||||
|
# ifdef WIN32
|
||||||
|
# ifdef BUILDING_DLL
|
||||||
|
# define EAPI __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define EAPI __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# if __GNUC__ >= 4
|
||||||
|
// BROKEN in gcc 4 on amd64
|
||||||
|
//# pragma GCC visibility push(hidden)
|
||||||
|
# define EAPI __attribute__ ((visibility("default")))
|
||||||
|
# else
|
||||||
|
# define EAPI
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define EAPI
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EAPI int e_sha1_sum(unsigned char *data, int size, unsigned char *dst);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -601,7 +601,54 @@ _e_test_cb_changed(void *data, Evas_Object *obj, void *event_info)
|
||||||
static void
|
static void
|
||||||
_e_test_cb_favorites_selected(void *data, Evas_Object *obj, void *event_info)
|
_e_test_cb_favorites_selected(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
printf("FAV CHANGED\n");
|
Evas_List *selected;
|
||||||
|
E_Fm2_Icon_Info *ici;
|
||||||
|
|
||||||
|
printf("FAV SELECTED\n");
|
||||||
|
selected = e_fm2_selected_list_get(obj);
|
||||||
|
if (!selected) return;
|
||||||
|
ici = selected->data;
|
||||||
|
if ((ici->link) && (ici->mount))
|
||||||
|
e_fm2_path_set(data, (char *)ici->link, "/");
|
||||||
|
else if (ici->link)
|
||||||
|
e_fm2_path_set(data, NULL, (char *)ici->link);
|
||||||
|
// FIXME: this should happen on the scrollframe not the fm obj
|
||||||
|
// e_widget_scrollframe_child_pos_set(data, 0, 0);
|
||||||
|
evas_list_free(selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_test_cb_favorites_files_changed(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_List *icons, *l;
|
||||||
|
E_Fm2_Icon_Info *ici;
|
||||||
|
const char *realpath;
|
||||||
|
char *p1, *p2;
|
||||||
|
|
||||||
|
printf("FAV LIST CHANGE!\n");
|
||||||
|
icons = e_fm2_all_list_get(obj);
|
||||||
|
if (!icons) return;
|
||||||
|
realpath = e_fm2_real_path_get(data);
|
||||||
|
p1 = ecore_file_realpath(realpath);
|
||||||
|
if (!p1) goto done;
|
||||||
|
for (l = icons; l; l = l->next)
|
||||||
|
{
|
||||||
|
ici = l->data;
|
||||||
|
if (ici->link)
|
||||||
|
{
|
||||||
|
p2 = ecore_file_realpath(ici->link);
|
||||||
|
if (!strcmp(p1, p2))
|
||||||
|
{
|
||||||
|
e_fm2_select_set(obj, ici->file);
|
||||||
|
E_FREE(p2);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
E_FREE(p2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
E_FREE(p1);
|
||||||
|
evas_list_free(icons);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -626,8 +673,26 @@ _e_test_internal(E_Container *con)
|
||||||
|
|
||||||
/* actual files */
|
/* actual files */
|
||||||
ofm = e_fm2_add(dia->win->evas);
|
ofm = e_fm2_add(dia->win->evas);
|
||||||
/* FIXME: set config */
|
|
||||||
e_fm2_path_set(ofm, "~/", "/pix/bg");
|
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||||
|
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||||
|
fmc.view.open_dirs_in_place = 1;
|
||||||
|
fmc.view.selector = 1;
|
||||||
|
fmc.view.single_click = 0;
|
||||||
|
fmc.view.no_subdir_jump = 0;
|
||||||
|
fmc.icon.list.w = 24;
|
||||||
|
fmc.icon.list.h = 24;
|
||||||
|
fmc.icon.fixed.w = 1;
|
||||||
|
fmc.icon.fixed.h = 1;
|
||||||
|
fmc.icon.extension.show = 0;
|
||||||
|
fmc.list.sort.no_case = 1;
|
||||||
|
fmc.list.sort.dirs.first = 1;
|
||||||
|
fmc.list.sort.dirs.last = 0;
|
||||||
|
fmc.selection.single = 1;
|
||||||
|
fmc.selection.windows_modifiers = 0;
|
||||||
|
e_fm2_config_set(ofm, &fmc);
|
||||||
|
|
||||||
|
e_fm2_path_set(ofm, "~/", "/");
|
||||||
ob = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
|
ob = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
|
||||||
_e_test_cb_button, ofm, NULL);
|
_e_test_cb_button, ofm, NULL);
|
||||||
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 0, 0, 1, 0);
|
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 0, 0, 1, 0);
|
||||||
|
@ -646,8 +711,27 @@ _e_test_internal(E_Container *con)
|
||||||
|
|
||||||
/* shortcut list */
|
/* shortcut list */
|
||||||
ofm = e_fm2_add(dia->win->evas);
|
ofm = e_fm2_add(dia->win->evas);
|
||||||
/* FIXME: set config */
|
|
||||||
e_fm2_path_set(ofm, "~/", "/.e/e/fileman/favorites");
|
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||||
|
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||||
|
fmc.view.open_dirs_in_place = 1;
|
||||||
|
fmc.view.selector = 1;
|
||||||
|
fmc.view.single_click = 1;
|
||||||
|
fmc.view.no_subdir_jump = 1;
|
||||||
|
fmc.icon.list.w = 24;
|
||||||
|
fmc.icon.list.h = 24;
|
||||||
|
fmc.icon.fixed.w = 1;
|
||||||
|
fmc.icon.fixed.h = 1;
|
||||||
|
fmc.icon.extension.show = 0;
|
||||||
|
fmc.list.sort.no_case = 1;
|
||||||
|
fmc.list.sort.dirs.first = 0;
|
||||||
|
fmc.list.sort.dirs.last = 0;
|
||||||
|
fmc.selection.single = 1;
|
||||||
|
fmc.selection.windows_modifiers = 0;
|
||||||
|
e_fm2_config_set(ofm, &fmc);
|
||||||
|
|
||||||
|
e_fm2_path_set(ofm, "favorites", "/");
|
||||||
|
evas_object_smart_callback_add(ofm, "files_changed", _e_test_cb_favorites_files_changed, ofm2);
|
||||||
evas_object_smart_callback_add(ofm, "selected", _e_test_cb_favorites_selected, ofm2);
|
evas_object_smart_callback_add(ofm, "selected", _e_test_cb_favorites_selected, ofm2);
|
||||||
of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
|
of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
|
||||||
e_fm2_pan_set, e_fm2_pan_get,
|
e_fm2_pan_set, e_fm2_pan_get,
|
||||||
|
|
|
@ -121,6 +121,7 @@ e_thumb_icon_begin(Evas_Object *obj)
|
||||||
|
|
||||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||||
if (!eth) return;
|
if (!eth) return;
|
||||||
|
if (eth->busy) return;
|
||||||
if (!eth->file) return;
|
if (!eth->file) return;
|
||||||
if (!_thumbnailers)
|
if (!_thumbnailers)
|
||||||
{
|
{
|
||||||
|
@ -161,11 +162,7 @@ e_thumb_icon_end(Evas_Object *obj)
|
||||||
if (!eth) return;
|
if (!eth) return;
|
||||||
if (eth->queued) _thumb_queue = evas_list_remove(_thumb_queue, eth);
|
if (eth->queued) _thumb_queue = evas_list_remove(_thumb_queue, eth);
|
||||||
eth->queued = 0;
|
eth->queued = 0;
|
||||||
if (eth->busy)
|
if (eth->busy) _e_thumb_gen_end(eth->objid);
|
||||||
{
|
|
||||||
printf("REQ DEL %s\n", eth->file);
|
|
||||||
_e_thumb_gen_end(eth->objid);
|
|
||||||
}
|
|
||||||
eth->busy = 0;
|
eth->busy = 0;
|
||||||
_pending--;
|
_pending--;
|
||||||
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
||||||
|
@ -223,6 +220,7 @@ e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e)
|
||||||
{
|
{
|
||||||
if (!evas_list_find(_thumbnailers, e->client)) return;
|
if (!evas_list_find(_thumbnailers, e->client)) return;
|
||||||
_thumbnailers = evas_list_remove(_thumbnailers, e->client);
|
_thumbnailers = evas_list_remove(_thumbnailers, e->client);
|
||||||
|
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
@ -300,7 +298,7 @@ _e_thumb_hash_del(int objid)
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%i", objid);
|
snprintf(buf, sizeof(buf), "%i", objid);
|
||||||
_thumbs = evas_hash_del(_thumbs, buf, NULL);
|
_thumbs = evas_hash_del(_thumbs, buf, NULL);
|
||||||
if (!_thumbs) _objid = 0;
|
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include <Eet.h>
|
#include <Eet.h>
|
||||||
#include <Edje.h>
|
#include <Edje.h>
|
||||||
|
#include "e_sha1.h"
|
||||||
|
|
||||||
typedef struct _E_Thumb E_Thumb;
|
typedef struct _E_Thumb E_Thumb;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ static int _e_ipc_cb_server_add(void *data, int type, void *event);
|
||||||
static int _e_ipc_cb_server_del(void *data, int type, void *event);
|
static int _e_ipc_cb_server_del(void *data, int type, void *event);
|
||||||
static int _e_ipc_cb_server_data(void *data, int type, void *event);
|
static int _e_ipc_cb_server_data(void *data, int type, void *event);
|
||||||
static int _e_cb_timer(void *data);
|
static int _e_cb_timer(void *data);
|
||||||
|
static int _e_thumb_valid(E_Thumb *eth);
|
||||||
static void _e_thumb_generate(E_Thumb *eth);
|
static void _e_thumb_generate(E_Thumb *eth);
|
||||||
static char *_e_thumb_file_id(char *file, char *key);
|
static char *_e_thumb_file_id(char *file, char *key);
|
||||||
|
|
||||||
|
@ -44,6 +46,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
nice(20);
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if ((!strcmp(argv[i], "-h")) ||
|
if ((!strcmp(argv[i], "-h")) ||
|
||||||
|
@ -168,7 +171,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
||||||
eth->file = strdup(file);
|
eth->file = strdup(file);
|
||||||
if (key) eth->key = strdup(key);
|
if (key) eth->key = strdup(key);
|
||||||
_thumblist = evas_list_append(_thumblist, eth);
|
_thumblist = evas_list_append(_thumblist, eth);
|
||||||
if (!_timer) _timer = ecore_timer_add(0.001, _e_cb_timer, NULL);
|
if (!_timer) _timer = ecore_timer_add(0.000001, _e_cb_timer, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -201,8 +204,26 @@ static int
|
||||||
_e_cb_timer(void *data)
|
_e_cb_timer(void *data)
|
||||||
{
|
{
|
||||||
E_Thumb *eth;
|
E_Thumb *eth;
|
||||||
|
Evas_List *del_list = NULL, *l;
|
||||||
|
|
||||||
/* take thumb at head of list */
|
/* take thumb at head of list */
|
||||||
|
if (_thumblist)
|
||||||
|
{
|
||||||
|
for (l = _thumblist; l; l = l->next)
|
||||||
|
{
|
||||||
|
eth = l->data;
|
||||||
|
if (_e_thumb_valid(eth))
|
||||||
|
del_list = evas_list_append(del_list, eth);
|
||||||
|
}
|
||||||
|
while (del_list)
|
||||||
|
{
|
||||||
|
eth = del_list->data;
|
||||||
|
del_list = evas_list_remove_list(del_list, del_list);
|
||||||
|
_thumblist = evas_list_remove(_thumblist, eth);
|
||||||
|
if (eth->file) free(eth->file);
|
||||||
|
if (eth->key) free(eth->key);
|
||||||
|
free(eth);
|
||||||
|
}
|
||||||
if (_thumblist)
|
if (_thumblist)
|
||||||
{
|
{
|
||||||
eth = _thumblist->data;
|
eth = _thumblist->data;
|
||||||
|
@ -211,7 +232,8 @@ _e_cb_timer(void *data)
|
||||||
if (eth->file) free(eth->file);
|
if (eth->file) free(eth->file);
|
||||||
if (eth->key) free(eth->key);
|
if (eth->key) free(eth->key);
|
||||||
free(eth);
|
free(eth);
|
||||||
if (_thumblist) _timer = ecore_timer_add(0.00001, _e_cb_timer, NULL);
|
}
|
||||||
|
if (_thumblist) _timer = ecore_timer_add(0.000001, _e_cb_timer, NULL);
|
||||||
else _timer = NULL;
|
else _timer = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -219,6 +241,39 @@ _e_cb_timer(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_e_thumb_valid(E_Thumb *eth)
|
||||||
|
{
|
||||||
|
char buf[4096], dbuf[4096], *id, *td;
|
||||||
|
time_t mtime_orig, mtime_thumb;
|
||||||
|
|
||||||
|
id = _e_thumb_file_id(eth->file, eth->key);
|
||||||
|
if (!id) return;
|
||||||
|
|
||||||
|
td = strdup(id);
|
||||||
|
if (!td)
|
||||||
|
{
|
||||||
|
free(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
td[2] = 0;
|
||||||
|
|
||||||
|
snprintf(dbuf, sizeof(dbuf), "%s/%s", _thumbdir, td);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s/%s-%ix%i.thm",
|
||||||
|
_thumbdir, td, id + 2, eth->w, eth->h);
|
||||||
|
free(id);
|
||||||
|
free(td);
|
||||||
|
|
||||||
|
mtime_orig = ecore_file_mod_time(eth->file);
|
||||||
|
mtime_thumb = ecore_file_mod_time(buf);
|
||||||
|
if (mtime_thumb > mtime_orig)
|
||||||
|
{
|
||||||
|
ecore_ipc_server_send(_e_ipc_server, 5, 2, eth->objid, 0, 0, buf, strlen(buf) + 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_thumb_generate(E_Thumb *eth)
|
_e_thumb_generate(E_Thumb *eth)
|
||||||
{
|
{
|
||||||
|
@ -240,11 +295,11 @@ _e_thumb_generate(E_Thumb *eth)
|
||||||
free(id);
|
free(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
td[3] = 0;
|
td[2] = 0;
|
||||||
|
|
||||||
snprintf(dbuf, sizeof(dbuf), "%s/%s", _thumbdir, td);
|
snprintf(dbuf, sizeof(dbuf), "%s/%s", _thumbdir, td);
|
||||||
snprintf(buf, sizeof(buf), "%s/%s/%s-%ix%i.thm",
|
snprintf(buf, sizeof(buf), "%s/%s/%s-%ix%i.thm",
|
||||||
_thumbdir, td, id + 3, eth->w, eth->h);
|
_thumbdir, td, id + 2, eth->w, eth->h);
|
||||||
free(id);
|
free(id);
|
||||||
free(td);
|
free(td);
|
||||||
|
|
||||||
|
@ -336,56 +391,36 @@ _e_thumb_generate(E_Thumb *eth)
|
||||||
ecore_ipc_server_send(_e_ipc_server, 5, 2, eth->objid, 0, 0, buf, strlen(buf) + 1);
|
ecore_ipc_server_send(_e_ipc_server, 5, 2, eth->objid, 0, 0, buf, strlen(buf) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: should use md5 or sha1 sum of the path */
|
||||||
static char *
|
static char *
|
||||||
_e_thumb_file_id(char *file, char *key)
|
_e_thumb_file_id(char *file, char *key)
|
||||||
{
|
{
|
||||||
char s[512], *sp;
|
char s[64];
|
||||||
const char *chmap =
|
const char *chmap = "0123456789abcdef";
|
||||||
"0123456789abcdef"
|
unsigned char *buf, id[20];
|
||||||
"ghijklmnopqrstuv";
|
int i, len, lenf;
|
||||||
unsigned int id[8], i, t, tt;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) id[i] = 0x55555555;
|
len = 0;
|
||||||
|
lenf = strlen(file);
|
||||||
|
len += lenf;
|
||||||
|
len++;
|
||||||
|
if (key)
|
||||||
|
{
|
||||||
|
key += strlen(key);
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
buf = alloca(len);
|
||||||
|
|
||||||
j = 0;
|
strcpy(buf, file);
|
||||||
sp = file;
|
if (key) strcpy(buf + lenf + 1, key);
|
||||||
while (*sp)
|
|
||||||
{
|
|
||||||
i = ((int)*sp) & 0x7;
|
|
||||||
id[i] ^= ((int)*sp) << j;
|
|
||||||
j++;
|
|
||||||
if (j == 25) j = 0;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp = key;
|
e_sha1_sum(buf, len, id);
|
||||||
if (sp)
|
|
||||||
{
|
|
||||||
while (*sp)
|
|
||||||
{
|
|
||||||
i = ((int)*sp) & 0x7;
|
|
||||||
id[i] ^= ((int)*sp) << j;
|
|
||||||
j++;
|
|
||||||
if (j == 25) j = 0;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sp = s;
|
for (i = 0; i < 20; i++)
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
{
|
{
|
||||||
t = id[i];
|
s[(i * 2) + 0] = chmap[(id[i] >> 4) & 0xf];
|
||||||
j = 32;
|
s[(i * 2) + 1] = chmap[(id[i] ) & 0xf];
|
||||||
while (j > 0)
|
|
||||||
{
|
|
||||||
tt = t & ((1 << 5) - 1);
|
|
||||||
*sp = chmap[tt];
|
|
||||||
t >>= 5;
|
|
||||||
j -= 5;
|
|
||||||
sp++;
|
|
||||||
}
|
}
|
||||||
}
|
s[(i * 2)] = 0;
|
||||||
*sp = 0;
|
|
||||||
return strdup(s);
|
return strdup(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,6 +595,77 @@ e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI char *
|
||||||
|
e_util_shell_env_path_eval(char *path)
|
||||||
|
{
|
||||||
|
/* evaluate things like:
|
||||||
|
* $HOME/bling -> /home/user/bling
|
||||||
|
* $HOME/bin/$HOSTNAME/blah -> /home/user/bin/localhost/blah
|
||||||
|
* etc. etc.
|
||||||
|
*/
|
||||||
|
char buf[4096], *pd, *p, *v1, *v2, *s, *v, *vp;
|
||||||
|
int esc = 0, invar = 0;
|
||||||
|
|
||||||
|
for (p = path, pd = buf; (pd < (buf + sizeof(buf) - 1)); p++)
|
||||||
|
{
|
||||||
|
if (invar)
|
||||||
|
{
|
||||||
|
if (!((isalnum(*p)) || (*p == '_')))
|
||||||
|
{
|
||||||
|
v2 = p;
|
||||||
|
invar = 0;
|
||||||
|
if ((v2 - v1) > 1)
|
||||||
|
{
|
||||||
|
s = alloca(v2 - v1);
|
||||||
|
strncpy(s, v1 + 1, v2 - v1 - 1);
|
||||||
|
s[v2 - v1 - 1] = 0;
|
||||||
|
v = getenv(s);
|
||||||
|
if (v)
|
||||||
|
{
|
||||||
|
vp = v;
|
||||||
|
while ((*vp) && (pd < (buf + sizeof(buf) - 1)))
|
||||||
|
{
|
||||||
|
*pd = *vp;
|
||||||
|
vp++;
|
||||||
|
pd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pd < (buf + sizeof(buf) - 1))
|
||||||
|
{
|
||||||
|
*pd = *p;
|
||||||
|
pd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (esc)
|
||||||
|
{
|
||||||
|
*pd = *p;
|
||||||
|
pd++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*p == '\\') esc = 1;
|
||||||
|
else if (*p == '$')
|
||||||
|
{
|
||||||
|
invar = 1;
|
||||||
|
v1 = p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pd = *p;
|
||||||
|
pd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*p == 0) break;
|
||||||
|
}
|
||||||
|
*pd = 0;
|
||||||
|
return strdup(buf);
|
||||||
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
static void
|
static void
|
||||||
_e_util_container_fake_mouse_up_cb(void *data)
|
_e_util_container_fake_mouse_up_cb(void *data)
|
||||||
|
|
|
@ -41,6 +41,7 @@ EAPI int e_util_edje_collection_exists(const char *file, const char *co
|
||||||
EAPI void e_util_dialog_internal(const char *title, const char *txt);
|
EAPI void e_util_dialog_internal(const char *title, const char *txt);
|
||||||
EAPI const char *e_util_filename_escape(const char *filename);
|
EAPI const char *e_util_filename_escape(const char *filename);
|
||||||
EAPI int e_util_icon_save(Ecore_X_Icon *icon, const char *filename);
|
EAPI int e_util_icon_save(Ecore_X_Icon *icon, const char *filename);
|
||||||
|
EAPI char *e_util_shell_env_path_eval(char *path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,33 @@ e_widget_scrollframe_pan_add(Evas *evas, Evas_Object *pan, void (*pan_set) (Evas
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_widget_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_scrollframe_child_pos_set(wd->o_scrollframe, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_widget_scrollframe_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_scrollframe_child_pos_get(wd->o_scrollframe, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_widget_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
/* Private functions */
|
/* Private functions */
|
||||||
static void
|
static void
|
||||||
_e_wid_del_hook(Evas_Object *obj)
|
_e_wid_del_hook(Evas_Object *obj)
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
#define E_WIDGET_SCROLLFRAME_H
|
#define E_WIDGET_SCROLLFRAME_H
|
||||||
|
|
||||||
EAPI Evas_Object *e_widget_scrollframe_pan_add(Evas *evas, Evas_Object *pan, void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y));
|
EAPI Evas_Object *e_widget_scrollframe_pan_add(Evas *evas, Evas_Object *pan, void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y));
|
||||||
|
EAPI void e_widget_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||||
|
EAPI void e_widget_scrollframe_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||||
|
EAPI void e_widget_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue