summaryrefslogtreecommitdiff
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
parent66c1d5694428e2683a8074f5c1ecda5f56f1a387 (diff)
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 {
360 value "action" string: "escape"; 360 value "action" string: "escape";
361 value "params" string: ""; 361 value "params" string: "";
362 } 362 }
363 group "Elm_Config_Binding_Key" struct {
364 value "context" int: 0;
365 value "key" string: "BackSpace";
366 value "action" string: "backspace";
367 value "params" string: "";
368 }
363 } 369 }
364 } 370 }
365 group "Elm_Config_Bindings_Widget" struct { 371 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 {
364 value "action" string: "escape"; 364 value "action" string: "escape";
365 value "params" string: ""; 365 value "params" string: "";
366 } 366 }
367 group "Elm_Config_Binding_Key" struct {
368 value "context" int: 0;
369 value "key" string: "BackSpace";
370 value "action" string: "backspace";
371 value "params" string: "";
372 }
367 } 373 }
368 } 374 }
369 group "Elm_Config_Bindings_Widget" struct { 375 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 {
361 value "action" string: "escape"; 361 value "action" string: "escape";
362 value "params" string: ""; 362 value "params" string: "";
363 } 363 }
364 group "Elm_Config_Binding_Key" struct {
365 value "context" int: 0;
366 value "key" string: "BackSpace";
367 value "action" string: "backspace";
368 value "params" string: "";
369 }
364 } 370 }
365 } 371 }
366 group "Elm_Config_Bindings_Widget" struct { 372 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[] = {
47 47
48static Eina_Bool _key_action_select(Evas_Object *obj, const char *params); 48static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
49static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params); 49static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
50static Eina_Bool _key_action_backspace(Evas_Object *obj, const char *params);
50 51
51static const Elm_Action key_actions[] = { 52static const Elm_Action key_actions[] = {
52 {"select", _key_action_select}, 53 {"select", _key_action_select},
53 {"escape", _key_action_escape}, 54 {"escape", _key_action_escape},
55 {"backspace", _key_action_backspace},
54 {NULL, NULL} 56 {NULL, NULL}
55}; 57};
56 58
57static Eina_Bool _ok(void *data, const Eo_Event *event); 59static Eina_Bool _ok(void *data, const Eo_Event *event);
58static Eina_Bool _canc(void *data, const Eo_Event *event); 60static Eina_Bool _canc(void *data, const Eo_Event *event);
61static Eina_Bool _on_dir_up(void *data, const Eo_Event *event);
62static void _populate(Evas_Object *obj, const char *path, Elm_Object_Item *parent_it, const char *selected);
59 63
60/* final routine on deletion */ 64/* final routine on deletion */
61static void 65static void
62_elm_fileselector_smart_del_do(Elm_Fileselector_Data *sd) 66_elm_fileselector_smart_del_do(Elm_Fileselector_Data *sd)
63{ 67{
64 eina_stringshare_del(sd->path); 68 eina_stringshare_del(sd->path);
69 eina_stringshare_del(sd->prev_path);
65 eina_stringshare_del(sd->selection); 70 eina_stringshare_del(sd->selection);
66 free(ecore_idler_del(sd->populate_idler)); 71 free(ecore_idler_del(sd->populate_idler));
67 ecore_idler_del(sd->path_entry_idler); 72 ecore_idler_del(sd->path_entry_idler);
@@ -167,6 +172,21 @@ _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
167 return EINA_TRUE; 172 return EINA_TRUE;
168} 173}
169 174
175static Eina_Bool
176_key_action_backspace(Evas_Object *obj, const char *params EINA_UNUSED)
177{
178 ELM_FILESELECTOR_DATA_GET(obj, sd);
179 if (sd->prev_path)
180 _populate(obj, sd->prev_path, NULL, NULL);
181 else
182 _on_dir_up(obj, NULL);
183
184 eina_stringshare_del(sd->prev_path);
185 sd->prev_path = NULL;
186
187 return EINA_TRUE;
188}
189
170EOLIAN static Eina_Bool 190EOLIAN static Eina_Bool
171_elm_fileselector_elm_widget_event(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info) 191_elm_fileselector_elm_widget_event(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
172{ 192{
@@ -1076,6 +1096,8 @@ _on_text_activated(void *data, const Eo_Event *event)
1076 1096
1077 if (ecore_file_is_dir(path)) 1097 if (ecore_file_is_dir(path))
1078 { 1098 {
1099 // keep previous path for backspace key action
1100 eina_stringshare_replace(&sd->prev_path, sd->path);
1079 // keep a ref to path 'couse it will be destroyed by _populate 1101 // keep a ref to path 'couse it will be destroyed by _populate
1080 p = eina_stringshare_add(path); 1102 p = eina_stringshare_add(path);
1081 _populate(fs, p, NULL, NULL); 1103 _populate(fs, p, NULL, NULL);
@@ -2501,6 +2523,7 @@ _elm_fileselector_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA
2501 static Elm_Atspi_Action atspi_actions[] = { 2523 static Elm_Atspi_Action atspi_actions[] = {
2502 { "select", "select", NULL, _key_action_select }, 2524 { "select", "select", NULL, _key_action_select },
2503 { "escape", "escape", NULL, _key_action_escape}, 2525 { "escape", "escape", NULL, _key_action_escape},
2526 { "backspace", "backspace", NULL, _key_action_backspace},
2504 { NULL, NULL, NULL, NULL} 2527 { NULL, NULL, NULL, NULL}
2505 }; 2528 };
2506 return &atspi_actions[0]; 2529 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
49 Eina_List *paths; 49 Eina_List *paths;
50 50
51 const char *path; 51 const char *path;
52 const char *prev_path;
52 const char *selection; 53 const char *selection;
53 Ecore_Idler *populate_idler; 54 Ecore_Idler *populate_idler;
54 Ecore_Idler *path_entry_idler; 55 Ecore_Idler *path_entry_idler;