forked from enlightenment/efl
fileselector: Added "selected,invalid" signal for wrong path on the path_entry.
If user typed wrong path on the path entry, "selected,invalid" will be emitted with "selected" for legacy. In addition, send "selected" signal when folder is changed in only folder mode. It's regression of 74f308df9. See more information from http://sourceforge.net/mailarchive/message.php?msg_id=31394571
This commit is contained in:
parent
9f34119498
commit
5a6f5b770b
|
@ -1607,3 +1607,7 @@
|
|||
2013-09-11 Daniel Juyung Seo (SeoZ)
|
||||
|
||||
* flip : Added support for focus direction.
|
||||
|
||||
2013-09-12 Ryuan Choi (ryuan)
|
||||
|
||||
* elc_fileselector : Added "selected,invalid" smart callbacks.
|
||||
|
|
|
@ -88,6 +88,7 @@ Additions:
|
|||
* Add support for more than one progress status in a progressbar.
|
||||
* Add elm_table_child_get().
|
||||
* Add support for flip focus direction.
|
||||
* Add "selected,invalid" smart callback for fileselector.
|
||||
|
||||
Improvements:
|
||||
|
||||
|
|
|
@ -43,6 +43,37 @@ my_fileselector_selected(void *data EINA_UNUSED,
|
|||
printf("or: %s\n", elm_fileselector_selected_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
_popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
evas_object_del(data);
|
||||
}
|
||||
|
||||
static void
|
||||
my_fileselector_invalid(void *data EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info)
|
||||
{
|
||||
Evas_Object *popup;
|
||||
Evas_Object *btn;
|
||||
char error_msg[256];
|
||||
|
||||
snprintf(error_msg, 256, "No such file or directory: %s", (char *)event_info);
|
||||
|
||||
popup = elm_popup_add(data);
|
||||
elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
|
||||
elm_object_part_text_set(popup, "title,text", "Error");
|
||||
elm_object_text_set(popup, error_msg);
|
||||
|
||||
btn = elm_button_add(popup);
|
||||
elm_object_text_set(btn, "OK");
|
||||
elm_object_part_content_set(popup, "button1", btn);
|
||||
evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
|
||||
|
||||
evas_object_show(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_is_save_clicked(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
|
@ -172,6 +203,8 @@ test_fileselector(void *data EINA_UNUSED,
|
|||
/* the 'selected' cb is called when the user click on a file/dir */
|
||||
evas_object_smart_callback_add(fs, "selected", my_fileselector_selected,
|
||||
win);
|
||||
evas_object_smart_callback_add(fs, "selected,invalid",
|
||||
my_fileselector_invalid, win);
|
||||
|
||||
/* test buttons */
|
||||
sep = elm_separator_add(win);
|
||||
|
|
|
@ -33,7 +33,8 @@ static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST];
|
|||
#define ELM_PRIV_FILESELECTOR_SIGNALS(cmd) \
|
||||
cmd(SIG_DIRECTORY_OPEN, "directory,open", "s") \
|
||||
cmd(SIG_DONE, "done", "s") \
|
||||
cmd(SIG_SELECTED, "selected", "s")
|
||||
cmd(SIG_SELECTED, "selected", "s") \
|
||||
cmd(SIG_SELECTED_INVALID, "selected,invalid", "s")
|
||||
|
||||
ELM_PRIV_FILESELECTOR_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
||||
|
||||
|
@ -813,8 +814,12 @@ _on_text_activated(void *data,
|
|||
|
||||
path = elm_object_text_get(obj);
|
||||
|
||||
// FIXME: Needs some feedback to user like alert.
|
||||
if (!ecore_file_exists(path)) goto end;
|
||||
if (!ecore_file_exists(path))
|
||||
{
|
||||
evas_object_smart_callback_call(fs, SIG_SELECTED, (void *)path);
|
||||
evas_object_smart_callback_call(fs, SIG_SELECTED_INVALID, (void *)path);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ecore_file_is_dir(path))
|
||||
{
|
||||
|
@ -822,6 +827,10 @@ _on_text_activated(void *data,
|
|||
p = eina_stringshare_add(path);
|
||||
_populate(fs, p, NULL, NULL);
|
||||
eina_stringshare_del(p);
|
||||
|
||||
if (sd->only_folder)
|
||||
evas_object_smart_callback_call(fs, SIG_SELECTED, (void *)path);
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -829,7 +838,12 @@ _on_text_activated(void *data,
|
|||
if (!dir) goto end;
|
||||
|
||||
if (strcmp(dir, sd->path))
|
||||
_populate(fs, dir, NULL, path);
|
||||
{
|
||||
_populate(fs, dir, NULL, path);
|
||||
|
||||
if (sd->only_folder)
|
||||
evas_object_smart_callback_call(fs, SIG_SELECTED, (void *)path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->mode == ELM_FILESELECTOR_LIST)
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
* @ref Layout:
|
||||
* - @c "selected" - the user has clicked on a file (when not in
|
||||
* folders-only mode) or directory (when in folders-only mode)
|
||||
* - @c "selected,invalid" - the user has tried to access wrong path
|
||||
* which does not exist.
|
||||
* - @c "directory,open" - the list has been populated with new
|
||||
* content (@c event_info is a pointer to the directory's
|
||||
* path, a @b stringshared string)
|
||||
|
|
Loading…
Reference in New Issue