fix filesel - never gave right path!

SVN revision: 54977
This commit is contained in:
Carsten Haitzler 2010-11-25 10:01:39 +00:00
parent e5fe7f8d53
commit fc2c036041
2 changed files with 20 additions and 7 deletions

View File

@ -253,7 +253,7 @@ _sel_do(void *data)
elm_scrolled_entry_entry_set(wd->filename_entry, ecore_file_file_get(path)); elm_scrolled_entry_entry_set(wd->filename_entry, ecore_file_file_get(path));
} }
evas_object_smart_callback_call(sd->fs, SIG_SELECTED, (void*)path); evas_object_smart_callback_call(sd->fs, SIG_SELECTED, (void *)path);
end: end:
wd->sel_idler = NULL; wd->sel_idler = NULL;
@ -267,6 +267,7 @@ _sel(void *data, Evas_Object *obj __UNUSED__, void *event_info)
struct sel_data *sd; struct sel_data *sd;
Widget_Data *wd; Widget_Data *wd;
void *old_sd; void *old_sd;
char *dir;
wd = elm_widget_data_get(data); wd = elm_widget_data_get(data);
if (!wd) return; if (!wd) return;
@ -275,6 +276,17 @@ _sel(void *data, Evas_Object *obj __UNUSED__, void *event_info)
sd->fs = data; sd->fs = data;
sd->path = elm_genlist_item_data_get(event_info); sd->path = elm_genlist_item_data_get(event_info);
dir = ecore_file_dir_get(sd->path);
if (dir)
{
eina_stringshare_replace(&wd->path, dir);
free(dir);
}
else
{
eina_stringshare_replace(&wd->path, "");
}
if (wd->sel_idler) if (wd->sel_idler)
{ {
old_sd = ecore_idler_del(wd->sel_idler); old_sd = ecore_idler_del(wd->sel_idler);
@ -308,7 +320,7 @@ _ok(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ {
Evas_Object *fs = data; Evas_Object *fs = data;
evas_object_smart_callback_call(fs, SIG_DONE, evas_object_smart_callback_call(fs, SIG_DONE,
(void*)elm_fileselector_selected_get(fs)); (void *)elm_fileselector_selected_get(fs));
} }
static void static void
@ -329,7 +341,7 @@ _anchor_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info)
// keep a ref to path 'couse it will be destroyed by _populate // keep a ref to path 'couse it will be destroyed by _populate
p = eina_stringshare_add(info->name); p = eina_stringshare_add(info->name);
_populate(fs, p, NULL); _populate(fs, p, NULL);
evas_object_smart_callback_call(data, SIG_SELECTED, (void*)p); evas_object_smart_callback_call(data, SIG_SELECTED, (void *)p);
eina_stringshare_del(p); eina_stringshare_del(p);
} }
@ -377,7 +389,7 @@ _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent)
if ((!wd) || (!ecore_file_is_dir(path))) return; if ((!wd) || (!ecore_file_is_dir(path))) return;
dir = opendir(path); dir = opendir(path);
if (!dir) return; if (!dir) return;
evas_object_smart_callback_call(obj, SIG_DIRECTORY_OPEN, (void*)path); evas_object_smart_callback_call(obj, SIG_DIRECTORY_OPEN, (void *)path);
if (!parent) if (!parent)
{ {
elm_genlist_clear(wd->files_list); elm_genlist_clear(wd->files_list);
@ -394,7 +406,7 @@ _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent)
real = ecore_file_realpath(buf); //TODO this will resolv symlinks...I dont like it real = ecore_file_realpath(buf); //TODO this will resolv symlinks...I dont like it
if (ecore_file_is_dir(real)) if (ecore_file_is_dir(real))
dirs = eina_list_append(dirs, real); dirs = eina_list_append(dirs, real);
else if(!wd->only_folder) else if (!wd->only_folder)
files = eina_list_append(files, real); files = eina_list_append(files, real);
} }
closedir(dir); closedir(dir);
@ -634,7 +646,7 @@ elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, Eina_Bool visible)
{ {
ELM_CHECK_WIDTYPE(obj, widtype); ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *box, *bt; Evas_Object *bt;
if (!wd) return; if (!wd) return;
if (visible) if (visible)

View File

@ -214,7 +214,8 @@ _selection_done(void *data, Evas_Object *obj __UNUSED__, void *event_info)
wd->fsw = NULL; wd->fsw = NULL;
evas_object_del(del); evas_object_del(del);
evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN, event_info); evas_object_smart_callback_call(wd->self, SIG_FILE_CHOSEN,
(void *)wd->fsd.path);
} }
/** /**