From: Enlightenment S. <no-...@en...> - 2010-12-08 16:18:46
|
Log: All fileselector cases (mixing save, folder only, expand) seem OK, now. Author: glima Date: 2010-12-08 08:18:37 -0800 (Wed, 08 Dec 2010) New Revision: 55378 Trac: http://trac.enlightenment.org/e/changeset/55378 Modified: trunk/TMP/st/elementary/src/lib/elc_fileselector.c Modified: trunk/TMP/st/elementary/src/lib/elc_fileselector.c =================================================================== --- trunk/TMP/st/elementary/src/lib/elc_fileselector.c 2010-12-08 16:18:30 UTC (rev 55377) +++ trunk/TMP/st/elementary/src/lib/elc_fileselector.c 2010-12-08 16:18:37 UTC (rev 55378) @@ -259,23 +259,29 @@ if (wd->expand) { _do_anchors(sd->fs, path); - if (wd->filename_entry) - elm_scrolled_entry_entry_set(wd->filename_entry, ""); + elm_scrolled_entry_entry_set(wd->filename_entry, ""); } else { - // 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(path); _populate(sd->fs, p, NULL); eina_stringshare_del(p); } goto end; } - else + else /* navigating through folders only or file is not a dir. */ { - if (wd->filename_entry) - elm_scrolled_entry_entry_set(wd->filename_entry, - ecore_file_file_get(path)); + if (wd->expand) _do_anchors(sd->fs, path); + else if (wd->only_folder) + { + /* keep a ref to path 'couse it will be destroyed by _populate */ + p = eina_stringshare_add(path); + _populate(sd->fs, p, NULL); + eina_stringshare_del(p); + } + elm_scrolled_entry_entry_set(wd->filename_entry, + ecore_file_file_get(path)); } evas_object_smart_callback_call(sd->fs, SIG_SELECTED, (void *)path); @@ -303,7 +309,13 @@ sd->fs = data; sd->path = elm_genlist_item_data_get(event_info); - dir = ecore_file_dir_get(sd->path); + if (!sd->path) + { + eina_stringshare_replace(&wd->path, ""); + goto end; + } + + dir = wd->only_folder ? strdup(sd->path) : ecore_file_dir_get(sd->path); if (dir) { eina_stringshare_replace(&wd->path, dir); @@ -314,6 +326,7 @@ eina_stringshare_replace(&wd->path, ""); } +end: if (wd->sel_idler) { old_sd = ecore_idler_del(wd->sel_idler); @@ -656,6 +669,7 @@ if (!wd) return; if (wd->only_folder == only) return; wd->only_folder = !!only; + if (wd->path) _populate(obj, wd->path, NULL); } /** @@ -764,6 +778,8 @@ if (!wd) return; wd->expand = !!expand; + + if (wd->path) _populate(obj, wd->path, NULL); } /** @@ -838,7 +854,9 @@ char buf[PATH_MAX]; name = elm_scrolled_entry_entry_get(wd->filename_entry); - snprintf(buf, sizeof(buf), "%s/%s", wd->path, name); + snprintf(buf, sizeof(buf), "%s/%s", + wd->only_folder ? ecore_file_dir_get(wd->path) : wd->path, + name); eina_stringshare_replace(&wd->selection, buf); return wd->selection; } |