'everything'

- add evry_util_file_detail_set
- fix one more bugger in animated scrolling


SVN revision: 47997
This commit is contained in:
Hannes Janetzek 2010-04-14 10:49:28 +00:00
parent 186c24617b
commit a1809e0d8e
4 changed files with 47 additions and 35 deletions

View File

@ -42,8 +42,6 @@ static Evry_Action *act1 = NULL;
static Evry_Action *act2 = NULL;
static const char *mime_folder = NULL;
static char *home_dir;
static int home_dir_len;
static void
@ -209,7 +207,7 @@ _scan_end_func(void *data)
int cnt = 0;
Evry_Item *item;
char *filename, *path;
char buf[1024];
p->thread = NULL;
EINA_LIST_FREE(d->files, item)
@ -231,23 +229,12 @@ _scan_end_func(void *data)
file->mime = eina_stringshare_ref(mime_folder);
EVRY_ITEM(file)->context = eina_stringshare_ref(file->mime);
}
evry_util_file_detail_set(file);
if (p->command || cnt >= MAX_ITEMS) continue;
if (!file->mime) _item_fill(file);
if (!item->browseable)
path = ecore_file_dir_get(file->path);
else
path = file->path;
if (path && !strncmp(path, home_dir, home_dir_len))
{
snprintf(buf, sizeof(buf), "~%s", path + home_dir_len);
EVRY_ITEM(file)->detail = eina_stringshare_add(buf);
}
else
EVRY_ITEM(file)->detail = eina_stringshare_ref(file->path);
cnt += _append_file(p, file);
}
@ -564,8 +551,6 @@ e_modapi_init(E_Module *m)
active = module_init();
mime_folder = eina_stringshare_add("inode/directory");
home_dir = e_user_homedir_get();
home_dir_len = strlen(home_dir);
e_module_delayed_set(m, 1);

View File

@ -370,7 +370,7 @@ EAPI int evry_fuzzy_match(const char *str, const char *match);
EAPI Eina_List *evry_fuzzy_match_sort(Eina_List *items);
EAPI int evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file);
EAPI char *evry_util_unescape(const char *string, int length);
EAPI void evry_util_file_detail_set(Evry_Item_File *file);
/* e_mod_main.c */
EAPI void evry_plugin_register(Evry_Plugin *p, int priority);

View File

@ -634,19 +634,6 @@ _animator(void *data)
double spd = 25.0 / e_config->framerate;
int wait = 0;
if (sd->scroll_align != sd->scroll_align_to)
{
sd->scroll_align = (sd->scroll_align * (1.0 - spd)) + (sd->scroll_align_to * spd);
da = sd->scroll_align - sd->scroll_align_to;
if (da < 0.0) da = -da;
if (da < 0.02)
sd->scroll_align = sd->scroll_align_to;
else
wait++;
e_scrollframe_child_pos_set(sd->view->sframe, 0, sd->scroll_align);
}
if (sd->sel_pos != sd->sel_pos_to)
{
sd->sel_pos = (sd->sel_pos * (1.0 - spd)) + (sd->sel_pos_to * spd);
@ -661,6 +648,20 @@ _animator(void *data)
_e_smart_reconfigure(data);
}
if (sd->scroll_align != sd->scroll_align_to)
{
sd->scroll_align = (sd->scroll_align * (1.0 - spd)) + (sd->scroll_align_to * spd);
da = sd->scroll_align - sd->scroll_align_to;
if (da < 0.0) da = -da;
if (da < 0.02)
sd->scroll_align = sd->scroll_align_to;
else
wait++;
e_scrollframe_child_pos_set(sd->view->sframe, 0, sd->scroll_align);
}
if (wait) return 1;
sd->animator = NULL;
@ -696,10 +697,9 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll)
{
double now = ecore_time_get();
if (now - sd->last_select < 0.05)
if (now - sd->last_select < 0.05 && sd->sel_pos == sd->sel_pos_to)
{
sd->scroll_align = sd->scroll_align_to;
sd->sel_pos = sd->sel_pos_to;
scroll = 0;
}
@ -776,7 +776,6 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll)
{
if (align_to >= 0)
sd->sel_pos = align_to * it->h;
if (align >= 0)
{
sd->scroll_align = align;

View File

@ -3,6 +3,34 @@
#define MAX_FUZZ 100
#define MAX_WORDS 5
static const char *home_dir = NULL;
static int home_dir_len;
static char dir_buf[1024];
EAPI void
evry_util_file_detail_set(Evry_Item_File *file)
{
const char *path;
if (!home_dir)
{
home_dir = e_user_homedir_get();
home_dir_len = strlen(home_dir);
}
if (!EVRY_ITEM(file)->browseable)
path = ecore_file_dir_get(file->path);
else
path = file->path;
if (path && !strncmp(path, home_dir, home_dir_len))
{
snprintf(dir_buf, sizeof(dir_buf), "~%s", path + home_dir_len);
EVRY_ITEM(file)->detail = eina_stringshare_add(dir_buf);
}
else
EVRY_ITEM(file)->detail = eina_stringshare_add(path);
}
EAPI int
evry_fuzzy_match(const char *str, const char *match)