Ephoto: Eliminate duplicate thumbing.
This commit is contained in:
parent
96c1afb382
commit
75131514cc
|
@ -218,6 +218,7 @@ struct _Ephoto_Event_Entry_Create
|
||||||
|
|
||||||
Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path,
|
Ephoto_Entry *ephoto_entry_new(Ephoto *ephoto, const char *path,
|
||||||
const char *label, Eina_File_Type type);
|
const char *label, Eina_File_Type type);
|
||||||
|
Eina_Bool ephoto_entry_exists(Ephoto *ephoto, const char *path);
|
||||||
void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry);
|
void ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry);
|
||||||
void ephoto_entry_free_listener_add(Ephoto_Entry *entry,
|
void ephoto_entry_free_listener_add(Ephoto_Entry *entry,
|
||||||
void (*cb) (void *data, const Ephoto_Entry *entry), const void *data);
|
void (*cb) (void *data, const Ephoto_Entry *entry), const void *data);
|
||||||
|
|
|
@ -442,8 +442,8 @@ _ephoto_config_about(Evas_Object *parent)
|
||||||
evas_object_size_hint_weight_set(entry, 0.0, 0.0);
|
evas_object_size_hint_weight_set(entry, 0.0, 0.0);
|
||||||
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
eina_strbuf_append_printf(sbuf,
|
eina_strbuf_append_printf(sbuf,
|
||||||
_("Ephoto is a comprehensive image viewer based on the EFL.<br/>"
|
_("Ephoto is a comprehensive image viewer based on the EFL. For more<br/>"
|
||||||
"For more information, please visit the Ephoto project page:<br/>"
|
"information, please visit the Ephoto project page:<br/>"
|
||||||
"<a href=http://www.smhouston.us/ephoto/>"
|
"<a href=http://www.smhouston.us/ephoto/>"
|
||||||
"http://www.smhouston.us/ephoto/</a><br/><br/>"
|
"http://www.smhouston.us/ephoto/</a><br/><br/>"
|
||||||
"Ephoto also has a page on the Enlightenment wiki:<br/>"
|
"Ephoto also has a page on the Enlightenment wiki:<br/>"
|
||||||
|
|
|
@ -353,6 +353,8 @@ _ephoto_populate_main(void *data, Eio_File *handler EINA_UNUSED,
|
||||||
Ephoto_Entry *e;
|
Ephoto_Entry *e;
|
||||||
Ephoto_Event_Entry_Create *ev;
|
Ephoto_Event_Entry_Create *ev;
|
||||||
|
|
||||||
|
if (ephoto_entry_exists(ed->ephoto, info->path))
|
||||||
|
return;
|
||||||
e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start,
|
e = ephoto_entry_new(ed->ephoto, info->path, info->path + info->name_start,
|
||||||
info->type);
|
info->type);
|
||||||
|
|
||||||
|
@ -451,6 +453,7 @@ _ephoto_change_dir(void *data)
|
||||||
{
|
{
|
||||||
Ephoto_Dir_Data *ed = data;
|
Ephoto_Dir_Data *ed = data;
|
||||||
|
|
||||||
|
ed->ephoto->thumb_entry = NULL;
|
||||||
ed->ephoto->job.change_dir = NULL;
|
ed->ephoto->job.change_dir = NULL;
|
||||||
_ephoto_populate_entries(ed);
|
_ephoto_populate_entries(ed);
|
||||||
}
|
}
|
||||||
|
@ -471,16 +474,12 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
|
||||||
if (evas_object_image_extension_can_load_get(path))
|
if (evas_object_image_extension_can_load_get(path))
|
||||||
{
|
{
|
||||||
if (event == ECORE_FILE_EVENT_CREATED_FILE)
|
if (event == ECORE_FILE_EVENT_CREATED_FILE)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
|
||||||
Ephoto_Entry *entry;
|
Ephoto_Entry *entry;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ephoto->entries, l, entry)
|
if (ephoto_entry_exists(ephoto, path))
|
||||||
{
|
return;
|
||||||
if (!strcmp(entry->path, path))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
snprintf(buf, PATH_MAX, "%s", path);
|
snprintf(buf, PATH_MAX, "%s", path);
|
||||||
entry = ephoto_entry_new(ephoto, path, basename(buf),
|
entry = ephoto_entry_new(ephoto, path, basename(buf),
|
||||||
EINA_FILE_REG);
|
EINA_FILE_REG);
|
||||||
|
@ -553,6 +552,9 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
|
if (ephoto_entry_exists(ephoto, path))
|
||||||
|
return;
|
||||||
snprintf(buf, PATH_MAX, "%s", path);
|
snprintf(buf, PATH_MAX, "%s", path);
|
||||||
entry = ephoto_entry_new(ephoto, path, basename(buf),
|
entry = ephoto_entry_new(ephoto, path, basename(buf),
|
||||||
EINA_FILE_REG);
|
EINA_FILE_REG);
|
||||||
|
@ -763,6 +765,20 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
ephoto_entry_exists(Ephoto *ephoto, const char *path)
|
||||||
|
{
|
||||||
|
Ephoto_Entry *entry;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(ephoto->entries, l, entry)
|
||||||
|
{
|
||||||
|
if (!strcmp(entry->path, path))
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
|
ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry)
|
||||||
{
|
{
|
||||||
|
|
|
@ -551,6 +551,8 @@ _monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
|
||||||
{
|
{
|
||||||
ic = &_ephoto_dir_class;
|
ic = &_ephoto_dir_class;
|
||||||
snprintf(buf, PATH_MAX, "%s", path);
|
snprintf(buf, PATH_MAX, "%s", path);
|
||||||
|
if (ephoto_entry_exists(entry->ephoto, path))
|
||||||
|
return;
|
||||||
e = ephoto_entry_new(entry->ephoto, path, basename(buf),
|
e = ephoto_entry_new(entry->ephoto, path, basename(buf),
|
||||||
EINA_FILE_DIR);
|
EINA_FILE_DIR);
|
||||||
e->genlist = entry->genlist;
|
e->genlist = entry->genlist;
|
||||||
|
@ -662,7 +664,7 @@ _todo_items_process(void *data)
|
||||||
i++;
|
i++;
|
||||||
if (i > TODO_ITEM_MIN_BATCH)
|
if (i > TODO_ITEM_MIN_BATCH)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
if (entry->is_dir)
|
if (entry->is_dir && !entry->item)
|
||||||
{
|
{
|
||||||
const Elm_Genlist_Item_Class *ic;
|
const Elm_Genlist_Item_Class *ic;
|
||||||
|
|
||||||
|
@ -685,7 +687,7 @@ _todo_items_process(void *data)
|
||||||
entry->genlist = tb->fsel;
|
entry->genlist = tb->fsel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!entry->is_dir && !entry->item)
|
||||||
{
|
{
|
||||||
const Elm_Gengrid_Item_Class *ic;
|
const Elm_Gengrid_Item_Class *ic;
|
||||||
|
|
||||||
|
@ -3624,6 +3626,8 @@ _top_monitor_cb(void *data, Ecore_File_Monitor *em EINA_UNUSED,
|
||||||
item = elm_genlist_item_next_get(item);
|
item = elm_genlist_item_next_get(item);
|
||||||
}
|
}
|
||||||
snprintf(buf, PATH_MAX, "%s", path);
|
snprintf(buf, PATH_MAX, "%s", path);
|
||||||
|
if (ephoto_entry_exists(tb->ephoto, path))
|
||||||
|
return;
|
||||||
e = ephoto_entry_new(tb->ephoto, path, basename(buf),
|
e = ephoto_entry_new(tb->ephoto, path, basename(buf),
|
||||||
EINA_FILE_DIR);
|
EINA_FILE_DIR);
|
||||||
e->genlist = tb->fsel;
|
e->genlist = tb->fsel;
|
||||||
|
@ -3706,7 +3710,7 @@ ephoto_thumb_browser_insert(Ephoto *ephoto, Ephoto_Entry *entry)
|
||||||
Ephoto_Thumb_Browser *tb =
|
Ephoto_Thumb_Browser *tb =
|
||||||
evas_object_data_get(ephoto->thumb_browser, "thumb_browser");
|
evas_object_data_get(ephoto->thumb_browser, "thumb_browser");
|
||||||
|
|
||||||
if (!entry->is_dir)
|
if (!entry->is_dir && !entry->item)
|
||||||
{
|
{
|
||||||
Eina_File *f;
|
Eina_File *f;
|
||||||
const Elm_Gengrid_Item_Class *ic;
|
const Elm_Gengrid_Item_Class *ic;
|
||||||
|
|
Loading…
Reference in New Issue