2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
#define EFL_ACCESS_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2010-04-08 13:36:37 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2016-10-26 16:53:12 -07:00
|
|
|
#include "elm_fileselector_button.eo.h"
|
|
|
|
#include "elm_fileselector_entry.eo.h"
|
2014-01-21 05:50:35 -08:00
|
|
|
#include "elm_interface_fileselector.h"
|
2012-08-01 14:04:26 -07:00
|
|
|
#include "elm_widget_fileselector_button.h"
|
2017-10-31 23:16:30 -07:00
|
|
|
#include "elm_fileselector.eo.h"
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_FILESELECTOR_BUTTON_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Fileselector_Button"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_fileselector_button"
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2014-04-09 08:49:10 -07:00
|
|
|
/* FIXME: need a way to find a gap between the size of item and thumbnail */
|
|
|
|
#define GENGRID_PADDING 16
|
|
|
|
|
2010-10-11 21:02:47 -07:00
|
|
|
#define DEFAULT_WINDOW_TITLE "Select a file"
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2013-09-02 16:39:02 -07:00
|
|
|
#define ELM_PRIV_FILESELECTOR_BUTTON_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_FILE_CHOSEN, "file,chosen", "s") \
|
|
|
|
|
|
|
|
ELM_PRIV_FILESELECTOR_BUTTON_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
2013-04-23 05:00:50 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-09-02 16:39:02 -07:00
|
|
|
ELM_PRIV_FILESELECTOR_BUTTON_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**<handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**<handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2012-05-03 15:44:01 -07:00
|
|
|
{NULL, NULL}
|
2010-10-19 07:17:14 -07:00
|
|
|
};
|
2013-10-18 10:20:34 -07:00
|
|
|
#undef ELM_PRIV_FILESELECTOR_BUTTON_SIGNALS
|
2010-09-22 10:45:49 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
|
|
|
_model_free_eo_cb(void *eo)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(eo);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_widget_theme_apply(Eo *obj, Elm_Fileselector_Button_Data *sd EINA_UNUSED)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
char buf[4096];
|
|
|
|
const char *style;
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
style = eina_stringshare_add(elm_widget_style_get(obj));
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
snprintf(buf, sizeof(buf), "fileselector_button/%s", style);
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
/* file selector button's style has an extra bit */
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&(wd->style), buf);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&(wd->style), style);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
eina_stringshare_del(style);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2010-09-22 10:45:43 -07:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
2016-09-29 09:12:09 -07:00
|
|
|
_replace_path_then(void *data, Efl_Event const *event)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Button_Data *sd = data;
|
2016-10-05 18:59:27 -07:00
|
|
|
Efl_Future_Event_Success *ev = event->info;
|
|
|
|
Eina_Value *v = ev->value;
|
2016-06-06 00:16:57 -07:00
|
|
|
const char *path = NULL;
|
2016-10-05 18:59:27 -07:00
|
|
|
|
|
|
|
eina_value_get(v, &path);
|
2016-06-06 00:16:57 -07:00
|
|
|
eina_stringshare_replace(&sd->fsd.path, path);
|
2016-08-22 17:59:10 -07:00
|
|
|
_event_to_legacy_call
|
|
|
|
(sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, (void *)path);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-09-29 09:12:09 -07:00
|
|
|
_replace_path_then_error(void *data, Efl_Event const* event EINA_UNUSED)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
|
|
|
Elm_Fileselector_Button_Data *sd = data;
|
|
|
|
ERR("could not get information from Efl.Model");
|
|
|
|
eina_stringshare_replace(&sd->fsd.path, NULL);
|
2016-08-22 17:59:10 -07:00
|
|
|
_event_to_legacy_call
|
|
|
|
(sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_selection_done(void *data, const Efl_Event *event)
|
2010-09-22 10:45:43 -07:00
|
|
|
{
|
2014-04-22 05:51:46 -07:00
|
|
|
Elm_Fileselector_Button_Data *sd = data;
|
2016-06-06 00:16:57 -07:00
|
|
|
Efl_Model *model = event->info;
|
2012-05-03 15:44:01 -07:00
|
|
|
Evas_Object *del;
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (model)
|
|
|
|
{
|
2016-09-29 09:12:09 -07:00
|
|
|
Efl_Future *future = NULL;
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fsd.model)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.model);
|
|
|
|
sd->fsd.model = efl_ref(model);
|
2016-09-29 09:12:09 -07:00
|
|
|
future = efl_model_property_get(model, "path");
|
|
|
|
efl_future_then(future, _replace_path_then, _replace_path_then_error, NULL, sd);
|
2016-08-22 17:59:10 -07:00
|
|
|
efl_event_callback_call
|
|
|
|
(sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, model);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_model_event_call
|
|
|
|
(sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL, NULL);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
2012-05-02 10:01:20 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
del = sd->fsw;
|
|
|
|
sd->fs = NULL;
|
|
|
|
sd->fsw = NULL;
|
|
|
|
evas_object_del(del);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2010-04-08 13:36:37 -07:00
|
|
|
static Evas_Object *
|
2014-04-22 05:51:46 -07:00
|
|
|
_new_window_add(Elm_Fileselector_Button_Data *sd)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
|
|
|
Evas_Object *win, *bg;
|
|
|
|
|
|
|
|
win = elm_win_add(NULL, "fileselector_button", ELM_WIN_DIALOG_BASIC);
|
2012-05-03 15:44:01 -07:00
|
|
|
elm_win_title_set(win, sd->window_title);
|
2010-04-08 13:36:37 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-07 07:41:48 -07:00
|
|
|
(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _selection_done, sd);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
|
|
|
bg = elm_bg_add(win);
|
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2015-03-10 06:41:44 -07:00
|
|
|
elm_win_resize_object_add(win, bg);
|
2010-04-08 13:36:37 -07:00
|
|
|
evas_object_show(bg);
|
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
evas_object_resize(win, sd->w, sd->h);
|
2010-04-08 13:36:37 -07:00
|
|
|
return win;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_parent_win_get(Evas_Object *obj)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
while (!efl_isa(obj, EFL_UI_WIN_CLASS))
|
2012-05-03 15:44:01 -07:00
|
|
|
obj = elm_object_parent_widget_get(obj);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2010-04-08 13:36:37 -07:00
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_activate(Elm_Fileselector_Button_Data *sd)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2010-10-19 07:17:14 -07:00
|
|
|
Eina_Bool is_inwin = EINA_FALSE;
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (sd->fs) return;
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (sd->inwin_mode)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->fsw = _parent_win_get(sd->obj);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (!sd->fsw)
|
|
|
|
sd->fsw = _new_window_add(sd);
|
2010-12-07 11:18:14 -08:00
|
|
|
else
|
2010-10-19 07:17:14 -07:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->fsw = elm_win_inwin_add(sd->fsw);
|
2010-10-19 07:17:14 -07:00
|
|
|
is_inwin = EINA_TRUE;
|
|
|
|
}
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
2010-10-19 07:17:14 -07:00
|
|
|
else
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->fsw = _new_window_add(sd);
|
|
|
|
|
|
|
|
sd->fs = elm_fileselector_add(sd->fsw);
|
2017-07-11 02:58:51 -07:00
|
|
|
elm_fileselector_hidden_visible_set(sd->fs, sd->fsd.hidden_visible);
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set
|
|
|
|
(sd->fs, efl_ui_mirrored_get(sd->obj));
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(sd->fs, EINA_FALSE);
|
2012-05-03 15:44:01 -07:00
|
|
|
elm_fileselector_expandable_set(sd->fs, sd->fsd.expandable);
|
|
|
|
elm_fileselector_folder_only_set(sd->fs, sd->fsd.folder_only);
|
|
|
|
elm_fileselector_is_save_set(sd->fs, sd->fsd.is_save);
|
2016-09-29 09:12:09 -07:00
|
|
|
elm_interface_fileselector_selected_model_set(sd->fs, sd->fsd.model);
|
2012-05-03 15:44:01 -07:00
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(sd->fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(sd->fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2016-08-22 17:59:10 -07:00
|
|
|
efl_event_callback_add
|
|
|
|
(sd->fs, ELM_FILESELECTOR_EVENT_DONE, _selection_done, sd);
|
2012-05-03 15:44:01 -07:00
|
|
|
evas_object_show(sd->fs);
|
2010-04-08 13:36:37 -07:00
|
|
|
|
2010-10-19 07:17:14 -07:00
|
|
|
if (is_inwin)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
elm_win_inwin_content_set(sd->fsw, sd->fs);
|
|
|
|
elm_win_inwin_activate(sd->fsw);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
elm_win_resize_object_add(sd->fsw, sd->fs);
|
|
|
|
evas_object_show(sd->fsw);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_button_clicked(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-05-02 10:01:20 -07:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
_activate(data);
|
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_fileselector_button_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Button_Data *priv)
|
2012-05-03 15:44:01 -07:00
|
|
|
{
|
2015-07-22 04:01:12 -07:00
|
|
|
const char *path;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
priv->window_title = eina_stringshare_add(DEFAULT_WINDOW_TITLE);
|
2015-07-22 04:01:12 -07:00
|
|
|
path = eina_environment_home_get();
|
|
|
|
if (path) priv->fsd.path = eina_stringshare_add(path);
|
2012-05-03 15:44:01 -07:00
|
|
|
else priv->fsd.path = eina_stringshare_add("/");
|
2012-05-02 10:01:20 -07:00
|
|
|
|
2016-09-05 08:57:35 -07:00
|
|
|
priv->fsd.model = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_added, priv->fsd.path));
|
2016-06-06 00:16:57 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
priv->fsd.expandable = _elm_config->fileselector_expand_enable;
|
|
|
|
priv->inwin_mode = _elm_config->inwin_dialogs_enable;
|
|
|
|
priv->w = 400;
|
|
|
|
priv->h = 400;
|
|
|
|
|
2017-06-14 19:12:00 -07:00
|
|
|
efl_ui_mirrored_automatic_set(obj, EINA_FALSE);
|
2012-05-03 15:44:01 -07:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _button_clicked, priv);
|
2012-05-03 15:44:01 -07:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2012-05-03 15:44:01 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_fileselector_button_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Button_Data *sd)
|
2011-07-04 03:13:59 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fsd.model)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.model);
|
2014-01-21 17:12:44 -08:00
|
|
|
eina_stringshare_del(sd->window_title);
|
|
|
|
eina_stringshare_del(sd->fsd.path);
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fsd.selection)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.selection);
|
2016-09-14 17:02:15 -07:00
|
|
|
eina_stringshare_del(sd->fsd.selection_path);
|
2014-01-21 17:12:44 -08:00
|
|
|
evas_object_del(sd->fsw);
|
2012-05-03 15:44:01 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2011-07-04 03:13:59 -07:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-16 18:28:49 -07:00
|
|
|
_elm_fileselector_button_efl_ui_autorepeat_autorepeat_supported_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED)
|
2012-08-01 14:04:26 -07:00
|
|
|
{
|
2014-03-29 22:34:10 -07:00
|
|
|
return EINA_FALSE;
|
2012-01-09 00:06:43 -08:00
|
|
|
}
|
|
|
|
|
2010-04-08 13:36:37 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_fileselector_button_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:01 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_fileselector_button_efl_object_constructor(Eo *obj, Elm_Fileselector_Button_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->obj = obj;
|
|
|
|
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_button_window_title_set(Eo *obj, const char *title)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj);
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
2012-05-03 15:44:01 -07:00
|
|
|
eina_stringshare_replace(&sd->window_title, title);
|
|
|
|
if (sd->fsw) elm_win_title_set(sd->fsw, sd->window_title);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI const char *
|
|
|
|
elm_fileselector_button_window_title_get(const Eo *obj)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj) NULL;
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
2014-03-29 22:34:10 -07:00
|
|
|
return sd->window_title;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_button_window_size_set(Eo *obj, Evas_Coord width, Evas_Coord height)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj);
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->w = width;
|
|
|
|
sd->h = height;
|
|
|
|
if (sd->fsw) evas_object_resize(sd->fsw, sd->w, sd->h);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_button_window_size_get(const Eo *obj, Evas_Coord *width, Evas_Coord *height)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
if (width) *width = 0;
|
|
|
|
if (height) *height = 0;
|
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj);
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
2012-05-03 15:44:01 -07:00
|
|
|
if (width) *width = sd->w;
|
|
|
|
if (height) *height = sd->h;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-07-04 13:17:38 -07:00
|
|
|
void
|
|
|
|
_elm_fileselector_button_path_set_internal(Evas_Object *obj, const char *path)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
|
|
|
|
2016-09-05 08:57:35 -07:00
|
|
|
Efl_Model *model = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_added, path));
|
2016-06-06 00:16:57 -07:00
|
|
|
if (!model)
|
|
|
|
{
|
|
|
|
ERR("Efl.Model allocation error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->fsd.model)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.model);
|
|
|
|
sd->fsd.model = efl_ref(model);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
eina_stringshare_replace(&sd->fsd.path, path);
|
|
|
|
|
2016-09-29 09:12:09 -07:00
|
|
|
if (sd->fs) elm_interface_fileselector_selected_model_set(sd->fs, model);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-07-04 13:17:38 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
|
|
|
elm_fileselector_button_path_set(Evas_Object *obj, const char *path)
|
|
|
|
{
|
2016-07-22 14:43:12 -07:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-09-14 17:02:15 -07:00
|
|
|
elm_fileselector_path_set(obj, path);
|
2016-07-04 13:17:38 -07:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Efl_Model *model)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fsd.model)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.model);
|
2016-06-06 00:16:57 -07:00
|
|
|
|
|
|
|
if (model)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
sd->fsd.model = efl_ref(model);
|
2016-09-29 09:12:09 -07:00
|
|
|
efl_future_then(efl_model_property_get(model, "path"),
|
|
|
|
_replace_path_then, _replace_path_then_error, NULL, sd);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->fsd.model = NULL;
|
|
|
|
eina_stringshare_replace(&sd->fsd.path, NULL);
|
|
|
|
}
|
2010-10-19 07:17:14 -07:00
|
|
|
|
2016-09-29 09:12:09 -07:00
|
|
|
if (sd->fs) elm_interface_fileselector_selected_model_set(sd->fs, model);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-07-04 13:17:38 -07:00
|
|
|
const char *
|
|
|
|
_elm_fileselector_button_path_get_internal(const Evas_Object *obj)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
|
|
|
return sd->fsd.path;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-07-04 13:17:38 -07:00
|
|
|
EINA_DEPRECATED EAPI const char *
|
|
|
|
elm_fileselector_button_path_get(const Evas_Object *obj)
|
|
|
|
{
|
2016-07-22 14:43:12 -07:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, NULL);
|
2016-09-14 17:02:15 -07:00
|
|
|
return elm_fileselector_path_get(obj);
|
2016-07-04 13:17:38 -07:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
EOLIAN static Efl_Model *
|
|
|
|
_elm_fileselector_button_elm_interface_fileselector_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
return sd->fsd.model;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_button_expandable_set(Evas_Object *obj,
|
2012-05-03 15:44:01 -07:00
|
|
|
Eina_Bool value)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_expandable_set(obj, value);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_expandable_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Eina_Bool value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->fsd.expandable = value;
|
2010-10-19 07:17:14 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (sd->fs) elm_fileselector_expandable_set(sd->fs, sd->fsd.expandable);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
2010-05-21 12:26:57 -07:00
|
|
|
elm_fileselector_button_expandable_get(const Evas_Object *obj)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_fileselector_expandable_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2010-10-11 21:02:47 -07:00
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_expandable_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-29 22:34:10 -07:00
|
|
|
return sd->fsd.expandable;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_button_folder_only_set(Evas_Object *obj,
|
2012-05-03 15:44:01 -07:00
|
|
|
Eina_Bool value)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_folder_only_set(obj, value);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_folder_only_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Eina_Bool value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->fsd.folder_only = value;
|
2010-10-19 07:17:14 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (sd->fs) elm_fileselector_folder_only_set(sd->fs, sd->fsd.folder_only);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
2010-05-21 12:26:57 -07:00
|
|
|
elm_fileselector_button_folder_only_get(const Evas_Object *obj)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_fileselector_folder_only_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2010-10-11 21:02:47 -07:00
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_folder_only_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-29 22:34:10 -07:00
|
|
|
return sd->fsd.folder_only;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2010-12-07 11:18:14 -08:00
|
|
|
elm_fileselector_button_is_save_set(Evas_Object *obj,
|
2012-05-03 15:44:01 -07:00
|
|
|
Eina_Bool value)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_fileselector_is_save_set(obj, value);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_is_save_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Eina_Bool value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->fsd.is_save = value;
|
2010-10-19 07:17:14 -07:00
|
|
|
|
2012-05-03 15:44:01 -07:00
|
|
|
if (sd->fs) elm_fileselector_is_save_set(sd->fs, sd->fsd.is_save);
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2014-01-21 06:42:56 -08:00
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
2010-05-21 12:26:57 -07:00
|
|
|
elm_fileselector_button_is_save_get(const Evas_Object *obj)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-01-21 05:50:35 -08:00
|
|
|
ELM_FILESELECTOR_INTERFACE_CHECK(obj, EINA_FALSE);
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_fileselector_is_save_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-03-29 22:34:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_is_save_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2010-04-08 13:36:37 -07:00
|
|
|
{
|
2014-03-29 22:34:10 -07:00
|
|
|
return sd->fsd.is_save;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-09 08:49:10 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_mode_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Elm_Fileselector_Mode mode)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
sd->fsd.mode = mode;
|
|
|
|
|
|
|
|
if (sd->fs) elm_fileselector_mode_set(sd->fs, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Fileselector_Mode
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_mode_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
return sd->fsd.mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_sort_method_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Elm_Fileselector_Sort sort)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
sd->fsd.sort_type = sort;
|
|
|
|
|
|
|
|
if (sd->fs) elm_fileselector_sort_method_set(sd->fs, sort);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Fileselector_Sort
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_sort_method_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
return sd->fsd.sort_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_multi_select_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Eina_Bool value)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
sd->fsd.multi = value;
|
|
|
|
|
|
|
|
if (sd->fs) elm_fileselector_multi_select_set(sd->fs, sd->fsd.multi);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_multi_select_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
return sd->fsd.multi;
|
|
|
|
}
|
|
|
|
|
2016-09-14 17:02:15 -07:00
|
|
|
const Eina_List *
|
|
|
|
_elm_fileselector_button_selected_paths_get_internal(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
|
|
|
|
|
|
|
if (sd->fs) return elm_fileselector_selected_paths_get(sd->fs);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-09 08:49:10 -07:00
|
|
|
EOLIAN static const Eina_List*
|
2016-06-06 00:16:57 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_selected_models_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fs) return elm_interface_fileselector_selected_models_get(sd->fs);
|
2014-04-09 08:49:10 -07:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-09-14 17:02:15 -07:00
|
|
|
const char *
|
|
|
|
_elm_fileselector_button_selected_get_internal(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
|
|
|
|
|
|
|
|
if (sd->fs) return elm_fileselector_selected_get(sd->fs);
|
|
|
|
|
|
|
|
return sd->fsd.selection_path;
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
EOLIAN static Efl_Model *
|
|
|
|
_elm_fileselector_button_elm_interface_fileselector_selected_model_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fs) return elm_interface_fileselector_selected_model_get(sd->fs);
|
2014-04-09 08:49:10 -07:00
|
|
|
|
2016-09-14 17:02:15 -07:00
|
|
|
return sd->fsd.selection;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_elm_fileselector_button_selected_set_internal(Evas_Object *obj, const char *_path)
|
|
|
|
{
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
|
|
|
Eina_Bool ret = EINA_TRUE;
|
|
|
|
|
|
|
|
if (sd->fs) ret = elm_fileselector_selected_set(sd->fs, _path);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *path = ecore_file_realpath(_path);
|
|
|
|
if (!ecore_file_is_dir(path) && !ecore_file_exists(path))
|
|
|
|
{
|
|
|
|
free(path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
free(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_stringshare_replace(&sd->fsd.selection_path, _path);
|
|
|
|
|
|
|
|
return ret;
|
2014-04-09 08:49:10 -07:00
|
|
|
}
|
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
2016-09-29 09:12:09 -07:00
|
|
|
_selected_model_then(void *data, Efl_Event const *event)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
2016-09-29 09:12:09 -07:00
|
|
|
Eo* v = (Eo*)((Efl_Future_Event_Success*)event->info)->value;
|
|
|
|
Efl_Promise *owner = data;
|
|
|
|
efl_promise_value_set(owner, efl_ref(v), _model_free_eo_cb);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
2014-04-09 08:49:10 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
static void
|
2016-09-29 09:12:09 -07:00
|
|
|
_selected_model_then_error(void *data, Efl_Event const* event)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
2016-09-29 09:12:09 -07:00
|
|
|
Efl_Promise *owner = data;
|
|
|
|
efl_promise_failed_set(owner, ((Efl_Future_Event_Failure*)event->info)->error);
|
2016-06-06 00:16:57 -07:00
|
|
|
}
|
|
|
|
|
2016-09-29 09:12:09 -07:00
|
|
|
EOLIAN static Efl_Future*
|
|
|
|
_elm_fileselector_button_elm_interface_fileselector_selected_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Efl_Model *model)
|
2016-06-06 00:16:57 -07:00
|
|
|
{
|
2016-09-29 09:12:09 -07:00
|
|
|
Efl_Promise* promise = efl_add(EFL_PROMISE_CLASS, obj);
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fs)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
2016-09-29 09:12:09 -07:00
|
|
|
efl_future_then(elm_interface_fileselector_selected_model_set(sd->fs, model),
|
|
|
|
_selected_model_then, _selected_model_then_error, NULL, promise);
|
2014-04-09 08:49:10 -07:00
|
|
|
}
|
2016-09-29 09:12:09 -07:00
|
|
|
else
|
|
|
|
efl_promise_failed_set(promise, EINA_ERROR_FUTURE_CANCEL);
|
2014-04-09 08:49:10 -07:00
|
|
|
|
2016-06-06 00:16:57 -07:00
|
|
|
if (sd->fsd.selection)
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(sd->fsd.selection);
|
|
|
|
sd->fsd.selection = model ? efl_ref(model) : NULL;
|
2016-09-29 09:12:09 -07:00
|
|
|
return efl_promise_future_get(promise);
|
2014-04-09 08:49:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_thumbnail_size_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Evas_Coord w, Evas_Coord h)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
if (sd->fs)
|
|
|
|
{
|
|
|
|
elm_fileselector_thumbnail_size_set(sd->fs, w, h);
|
|
|
|
elm_fileselector_thumbnail_size_get(sd->fs, &w, &h);
|
|
|
|
}
|
|
|
|
else if (!w || !h)
|
|
|
|
w = h = elm_config_finger_size_get() * 2 - GENGRID_PADDING;
|
|
|
|
|
|
|
|
sd->fsd.thumbnail_size.w = w;
|
|
|
|
sd->fsd.thumbnail_size.h = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_thumbnail_size_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
if (w) *w = sd->fsd.thumbnail_size.w;
|
|
|
|
if (h) *h = sd->fsd.thumbnail_size.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_hidden_visible_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, Eina_Bool visible)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
sd->fsd.hidden_visible = visible;
|
|
|
|
|
|
|
|
if (sd->fs) elm_fileselector_hidden_visible_set(sd->fs, visible);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_fileselector_button_elm_interface_fileselector_hidden_visible_get(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
|
2014-04-09 08:49:10 -07:00
|
|
|
{
|
|
|
|
return sd->fsd.hidden_visible;
|
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI void
|
|
|
|
elm_fileselector_button_inwin_mode_set(Eo *obj, Eina_Bool value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj);
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN(obj, sd);
|
2012-05-03 15:44:01 -07:00
|
|
|
sd->inwin_mode = value;
|
2010-04-08 13:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 22:48:35 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_fileselector_button_inwin_mode_get(const Eo *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-05-24 22:48:35 -07:00
|
|
|
ELM_FILESELECTOR_BUTTON_CHECK(obj) EINA_FALSE;
|
|
|
|
ELM_FILESELECTOR_BUTTON_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
2014-03-29 22:34:10 -07:00
|
|
|
return sd->inwin_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2010-10-11 21:02:47 -07:00
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_FILESELECTOR_BUTTON_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_fileselector_button)
|
|
|
|
|
2014-08-11 07:46:11 -07:00
|
|
|
#include "elm_fileselector_button.eo.c"
|