rage browser mode - make it come up every time properly...

remove race conditions and stop mainloopfrom being too flodded.
v-0.4.0
Carsten Haitzler 5 years ago
parent 4f0461cf39
commit a74ff71242
  1. 15
      src/bin/browser.c

@ -56,6 +56,7 @@ static Evas_Object *sc, *bt;
static Ecore_Thread *fill_thread = NULL;
static Entry *dir_entry = NULL;
static Eina_List *entries = NULL;
static Eina_Lock step_lock;
static void _sel_go(Evas_Object *win EINA_UNUSED, Entry *base_entry, int x, int y);
@ -169,6 +170,9 @@ _fill_message(Ecore_Thread *th, Type type, Entry *entry)
if (!message) return;
message->type = type;
message->entry = entry;
// take lock before sending message so we wait if the mainloop
// had not processed the previous message
eina_lock_take(&step_lock);
ecore_thread_feedback(th, message);
}
@ -523,7 +527,7 @@ _fill_feedback(void *data, Ecore_Thread *th, void *msg)
if (message->type == TYPE_NEW)
{
eina_lock_take(&(entry->lock));
if ((entry->dirs) || (entry->files))
// if ((entry->dirs) || (entry->files))
{
if (!entry->base)
{
@ -568,7 +572,9 @@ _fill_feedback(void *data, Ecore_Thread *th, void *msg)
elm_table_pack(entry->table, o, 0, 0, 1, 1);
evas_object_show(o);
if (!entry->parent)
if ((!entry->parent) ||
((entry->parent) && (!entry->parent->parent)) ||
(!entry->parent->box))
elm_box_pack_end(bx, entry->base);
else
elm_box_pack_end(entry->parent->box, entry->base);
@ -583,6 +589,8 @@ _fill_feedback(void *data, Ecore_Thread *th, void *msg)
_entry_files_redo(win, entry);
}
}
// allow the freedback thread to step more
eina_lock_release(&step_lock);
free(msg);
}
@ -591,6 +599,7 @@ _fill_end(void *data, Ecore_Thread *th)
{
Fill_Data *fdat = data;
if (th == fill_thread) fill_thread = NULL;
eina_lock_free(&step_lock);
free(fdat->videos);
free(fdat);
}
@ -639,6 +648,7 @@ _fill(Evas_Object *win)
if (!fdat) return;
fdat->videos = _videos_dir_get();
fdat->win = win;
eina_lock_new(&step_lock);
fill_thread = ecore_thread_feedback_run(_fill_thread, _fill_feedback,
_fill_end, _fill_cancel,
fdat, EINA_TRUE);
@ -948,7 +958,6 @@ browser_show(Evas_Object *win)
evas_object_show(bx);
elm_object_part_content_set(inf->lay, "rage.browser", sc);
evas_object_show(sc);
_fill(win);

Loading…
Cancel
Save