aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-03-04 15:32:22 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-03-04 16:14:37 -0800
commit3410e632fd718a99523a709bf01c4a2f5aaa061a (patch)
tree14a0ecb0052d1ae22bc0e838b715ad43fcfbd5f1
parentmultibuttonentry: add elm.swallow.background part (diff)
downloadelementary-3410e632fd718a99523a709bf01c4a2f5aaa061a.tar.gz
fileselector: add backspace key binding to move to previous path.
Summary: Add backspace key to move to previous path. Test Plan: remove /home/username/.elementary (to apply new elementary config file) elementary_test -to fileselector Reviewers: cedric, jpeg Subscribers: bu5hm4n Differential Revision: https://phab.enlightenment.org/D3685
-rw-r--r--config/default/base.src.in6
-rw-r--r--config/mobile/base.src.in6
-rw-r--r--config/standard/base.src.in6
-rw-r--r--src/lib/elc_fileselector.c23
-rw-r--r--src/lib/elm_widget_fileselector.h1
5 files changed, 42 insertions, 0 deletions
diff --git a/config/default/base.src.in b/config/default/base.src.in
index f48f4a400..891a7b75b 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -360,6 +360,12 @@ group "Elm_Config" struct {
value "action" string: "escape";
value "params" string: "";
}
+ group "Elm_Config_Binding_Key" struct {
+ value "context" int: 0;
+ value "key" string: "BackSpace";
+ value "action" string: "backspace";
+ value "params" string: "";
+ }
}
}
group "Elm_Config_Bindings_Widget" struct {
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index 8eca4b8f0..b950c805c 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -364,6 +364,12 @@ group "Elm_Config" struct {
value "action" string: "escape";
value "params" string: "";
}
+ group "Elm_Config_Binding_Key" struct {
+ value "context" int: 0;
+ value "key" string: "BackSpace";
+ value "action" string: "backspace";
+ value "params" string: "";
+ }
}
}
group "Elm_Config_Bindings_Widget" struct {
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index 37c2cda1b..02344b083 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -361,6 +361,12 @@ group "Elm_Config" struct {
value "action" string: "escape";
value "params" string: "";
}
+ group "Elm_Config_Binding_Key" struct {
+ value "context" int: 0;
+ value "key" string: "BackSpace";
+ value "action" string: "backspace";
+ value "params" string: "";
+ }
}
}
group "Elm_Config_Bindings_Widget" struct {
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index 3ead81682..7fef6072b 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -47,21 +47,26 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
+static Eina_Bool _key_action_backspace(Evas_Object *obj, const char *params);
static const Elm_Action key_actions[] = {
{"select", _key_action_select},
{"escape", _key_action_escape},
+ {"backspace", _key_action_backspace},
{NULL, NULL}
};
static Eina_Bool _ok(void *data, const Eo_Event *event);
static Eina_Bool _canc(void *data, const Eo_Event *event);
+static Eina_Bool _on_dir_up(void *data, const Eo_Event *event);
+static void _populate(Evas_Object *obj, const char *path, Elm_Object_Item *parent_it, const char *selected);
/* final routine on deletion */
static void
_elm_fileselector_smart_del_do(Elm_Fileselector_Data *sd)
{
eina_stringshare_del(sd->path);
+ eina_stringshare_del(sd->prev_path);
eina_stringshare_del(sd->selection);
free(ecore_idler_del(sd->populate_idler));
ecore_idler_del(sd->path_entry_idler);
@@ -167,6 +172,21 @@ _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
return EINA_TRUE;
}
+static Eina_Bool
+_key_action_backspace(Evas_Object *obj, const char *params EINA_UNUSED)
+{
+ ELM_FILESELECTOR_DATA_GET(obj, sd);
+ if (sd->prev_path)
+ _populate(obj, sd->prev_path, NULL, NULL);
+ else
+ _on_dir_up(obj, NULL);
+
+ eina_stringshare_del(sd->prev_path);
+ sd->prev_path = NULL;
+
+ return EINA_TRUE;
+}
+
EOLIAN static Eina_Bool
_elm_fileselector_elm_widget_event(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
{
@@ -1076,6 +1096,8 @@ _on_text_activated(void *data, const Eo_Event *event)
if (ecore_file_is_dir(path))
{
+ // keep previous path for backspace key action
+ eina_stringshare_replace(&sd->prev_path, sd->path);
// keep a ref to path 'couse it will be destroyed by _populate
p = eina_stringshare_add(path);
_populate(fs, p, NULL, NULL);
@@ -2501,6 +2523,7 @@ _elm_fileselector_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA
static Elm_Atspi_Action atspi_actions[] = {
{ "select", "select", NULL, _key_action_select },
{ "escape", "escape", NULL, _key_action_escape},
+ { "backspace", "backspace", NULL, _key_action_backspace},
{ NULL, NULL, NULL, NULL}
};
return &atspi_actions[0];
diff --git a/src/lib/elm_widget_fileselector.h b/src/lib/elm_widget_fileselector.h
index e9b0f0390..e3f7c765f 100644
--- a/src/lib/elm_widget_fileselector.h
+++ b/src/lib/elm_widget_fileselector.h
@@ -49,6 +49,7 @@ struct _Elm_Fileselector_Data
Eina_List *paths;
const char *path;
+ const char *prev_path;
const char *selection;
Ecore_Idler *populate_idler;
Ecore_Idler *path_entry_idler;