_populate_do(void *data)
{
struct sel_data *sdata = data;
- const char *p;
-
ELM_FILESELECTOR_DATA_GET(sdata->fs, sd);
- /* keep a ref to path 'couse it will be destroyed by _populate */
- p = eina_stringshare_add(sdata->path);
- _populate(sdata->fs, p, NULL, NULL);
- eina_stringshare_del(p);
+ _populate(sdata->fs, sdata->path, NULL, sdata->selected);
+ eina_stringshare_del(sdata->path);
+ eina_stringshare_del(sdata->selected);
sd->populate_idler = NULL;
+
free(sdata);
return ECORE_CALLBACK_CANCEL;
}
static void
+_schedule_populate(Evas_Object *fs,
+ Elm_Fileselector_Data *sd,
+ Eina_Stringshare *path,
+ Eina_Stringshare *selected)
+{
+ struct sel_data *sdata;
+ sdata = malloc(sizeof(*sdata));
+ if (!sdata) return;
+
+ sdata->fs = fs;
+ sdata->path = path;
+ sdata->selected = selected;
+
+ if (sd->populate_idler)
+ {
+ struct sel_data *old_sdata;
+ old_sdata = ecore_idler_del(sd->populate_idler);
+ eina_stringshare_del(old_sdata->path);
+ eina_stringshare_del(old_sdata->selected);
+ free(old_sdata);
+ }
+ sd->populate_idler = ecore_idler_add(_populate_do, sdata);
+}
+
+static void
_on_item_activated(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info)
{
//This event_info could be a list or gengrid item
Elm_Object_Item *it = event_info;
- struct sel_data *sdata;
- void *old_sdata;
const char *path;
Eina_Bool is_dir;
if (!sd->double_tap_navigation) return;
- sdata = malloc(sizeof(*sdata));
- if (!sdata) return;
-
- sdata->fs = data;
- sdata->path = path;
-
- if (sd->populate_idler)
- {
- old_sdata = ecore_idler_del(sd->populate_idler);
- free(old_sdata);
- }
- sd->populate_idler = ecore_idler_add(_populate_do, sdata);
+ _schedule_populate(data, sd, eina_stringshare_add(path), NULL);
}
static void
{
//This event_info could be a list or gengrid item
Elm_Object_Item *it = event_info;
- struct sel_data *sdata;
- void *old_sdata;
const char *path;
char *parent_path;
Eina_Bool is_dir;
if (sd->double_tap_navigation) return;
- sdata = malloc(sizeof(*sdata));
- if (!sdata) return;
-
- sdata->fs = data;
- sdata->path = path;
-
- if (sd->populate_idler)
- {
- old_sdata = ecore_idler_del(sd->populate_idler);
- free(old_sdata);
- }
- sd->populate_idler = ecore_idler_add(_populate_do, sdata);
+ _schedule_populate(data, sd, eina_stringshare_add(path), NULL);
}
static void
if (sd->only_folder == only) return;
sd->only_folder = !!only;
- if (sd->path) _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI Eina_Bool
{
sd->expand = !!expand;
- if (sd->path) _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI Eina_Bool
}
EOLIAN static void
-_elm_fileselector_elm_interface_fileselector_path_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, const char *_path)
+_elm_fileselector_elm_interface_fileselector_path_set(Eo *obj, Elm_Fileselector_Data *sd, const char *_path)
{
char *path;
path = ecore_file_realpath(_path);
- _populate(obj, path, NULL, NULL);
+ _schedule_populate(obj, sd, eina_stringshare_add(path), NULL);
free(path);
}
sd->mode = mode;
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI Elm_Fileselector_Mode
path = ecore_file_realpath(_path);
- if (ecore_file_is_dir(path)) _populate(obj, path, NULL, NULL);
+ if (ecore_file_is_dir(path))
+ _schedule_populate(obj, sd, eina_stringshare_add(path), NULL);
else
{
if (!ecore_file_exists(path))
}
dir = ecore_file_dir_get(path);
- _populate(obj, dir, NULL, path);
eina_stringshare_replace(&sd->selection, path);
+ eina_stringshare_ref(sd->selection);
+ _schedule_populate(obj, sd, eina_stringshare_add(dir), sd->selection);
free(dir);
}
sd->filter_list = eina_list_append(sd->filter_list, ff);
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
if (need_theme)
eo_do(obj, elm_obj_widget_theme_apply());
sd->filter_list = eina_list_append(sd->filter_list, ff);
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
if (need_theme)
eo_do(obj, elm_obj_widget_theme_apply());
ELM_SAFE_FREE(sd->filter_hoversel, evas_object_del);
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI void
sd->hidden_visible = visible;
_clear_selections(sd, NULL);
- _populate(obj, sd->path, NULL, NULL);
+
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI Eina_Bool
if (sd->mode == ELM_FILESELECTOR_GRID)
elm_gengrid_item_size_set(sd->files_view, w + GENGRID_PADDING, h + GENGRID_PADDING);
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI void
sd->sort_method = strcoll;
}
- _populate(obj, sd->path, NULL, NULL);
+ if (sd->path)
+ {
+ eina_stringshare_ref(sd->path);
+ _schedule_populate(obj, sd, sd->path, NULL);
+ }
}
EAPI Elm_Fileselector_Sort