summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-09-03 12:44:05 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-09-03 12:47:23 +0900
commit85ef73cdb499dc0ea73b9a5085e543ae67c5d931 (patch)
tree8ea2053579da101bdad016feff11385661f2ae7a /src/lib
parent54e5c0fba5f046b56e695c967e69645f8b871ef1 (diff)
fileselector: Fix that anchors are remained when path_entry was focused via keyboard.
Removed trick that checks whether mouse is pressed in text field or anchors.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elc_fileselector.c52
-rw-r--r--src/lib/elm_widget_fileselector.h1
2 files changed, 33 insertions, 20 deletions
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index cedbc7a2e..201345323 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -69,6 +69,7 @@ _elm_fileselector_smart_del_do(Elm_Fileselector_Data *sd)
69 eina_stringshare_del(sd->path); 69 eina_stringshare_del(sd->path);
70 eina_stringshare_del(sd->selection); 70 eina_stringshare_del(sd->selection);
71 free(ecore_idler_del(sd->populate_idler)); 71 free(ecore_idler_del(sd->populate_idler));
72 ecore_idler_del(sd->path_entry_idler);
72 73
73 eo_do_super(sd->obj, MY_CLASS, evas_obj_smart_del()); 74 eo_do_super(sd->obj, MY_CLASS, evas_obj_smart_del());
74} 75}
@@ -1048,25 +1049,6 @@ _canc(void *data,
1048} 1049}
1049 1050
1050static void 1051static void
1051_on_text_clicked(void *data EINA_UNUSED,
1052 Evas_Object *obj,
1053 void *event_info EINA_UNUSED)
1054{
1055 ELM_FILESELECTOR_DATA_GET(data, sd);
1056
1057 /* FIXME: When anchor is clicked, current callback is also called.
1058 * But when it is "anchor,clicked" entry should be unfocused, so we remove
1059 * focus in achor_clicked.
1060 *
1061 * Check if entry is focused.
1062 * It will be so if empty place (not anchor) was clicked. */
1063 if (!elm_object_focus_get(obj)) return;
1064
1065 elm_entry_entry_set(obj, sd->path);
1066 elm_entry_cursor_pos_set(obj, eina_stringshare_strlen(sd->path));
1067}
1068
1069static void
1070_on_text_activated(void *data, 1052_on_text_activated(void *data,
1071 Evas_Object *obj, 1053 Evas_Object *obj,
1072 void *event_info EINA_UNUSED) 1054 void *event_info EINA_UNUSED)
@@ -1150,6 +1132,29 @@ end:
1150 elm_object_focus_set(obj, EINA_FALSE); 1132 elm_object_focus_set(obj, EINA_FALSE);
1151} 1133}
1152 1134
1135static Eina_Bool
1136_anchors_undo(void *data)
1137{
1138 ELM_FILESELECTOR_DATA_GET(data, sd);
1139
1140 elm_entry_entry_set(sd->path_entry, sd->path);
1141 elm_entry_cursor_pos_set(sd->path_entry, eina_stringshare_strlen(sd->path));
1142
1143 sd->path_entry_idler = NULL;
1144
1145 return ECORE_CALLBACK_CANCEL;
1146}
1147
1148static void
1149_on_text_focused(void *data,
1150 Evas_Object *obj EINA_UNUSED,
1151 void *event_info EINA_UNUSED)
1152{
1153 ELM_FILESELECTOR_DATA_GET(data, sd);
1154
1155 if (!sd->path_entry_idler)
1156 sd->path_entry_idler = ecore_idler_add(_anchors_undo, data);
1157}
1153static void 1158static void
1154_on_text_unfocused(void *data, 1159_on_text_unfocused(void *data,
1155 Evas_Object *obj EINA_UNUSED, 1160 Evas_Object *obj EINA_UNUSED,
@@ -1168,6 +1173,8 @@ _anchor_clicked(void *data,
1168 Evas_Object *fs = data; 1173 Evas_Object *fs = data;
1169 const char *p; 1174 const char *p;
1170 1175
1176 ELM_FILESELECTOR_DATA_GET(fs, sd);
1177
1171 // keep a ref to path 'couse it will be destroyed by _populate 1178 // keep a ref to path 'couse it will be destroyed by _populate
1172 p = eina_stringshare_add(info->name); 1179 p = eina_stringshare_add(info->name);
1173 _populate(fs, p, NULL, NULL); 1180 _populate(fs, p, NULL, NULL);
@@ -1175,6 +1182,11 @@ _anchor_clicked(void *data,
1175 /* After anchor was clicked, entry will be focused, and will be editable. 1182 /* After anchor was clicked, entry will be focused, and will be editable.
1176 * It's wrong. So remove focus. */ 1183 * It's wrong. So remove focus. */
1177 elm_object_focus_set(obj, EINA_FALSE); 1184 elm_object_focus_set(obj, EINA_FALSE);
1185
1186 if (sd->path_entry_idler) {
1187 ecore_idler_del(sd->path_entry_idler);
1188 sd->path_entry_idler = NULL;
1189 }
1178} 1190}
1179 1191
1180static Evas_Object * 1192static Evas_Object *
@@ -1444,7 +1456,7 @@ _elm_fileselector_evas_object_smart_add(Eo *obj, Elm_Fileselector_Data *priv)
1444 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); 1456 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
1445 1457
1446 evas_object_smart_callback_add(en, "anchor,clicked", _anchor_clicked, obj); 1458 evas_object_smart_callback_add(en, "anchor,clicked", _anchor_clicked, obj);
1447 evas_object_smart_callback_add(en, "clicked", _on_text_clicked, obj); 1459 evas_object_smart_callback_add(en, "focused", _on_text_focused, obj);
1448 evas_object_smart_callback_add(en, "unfocused", _on_text_unfocused, obj); 1460 evas_object_smart_callback_add(en, "unfocused", _on_text_unfocused, obj);
1449 evas_object_smart_callback_add(en, "activated", _on_text_activated, obj); 1461 evas_object_smart_callback_add(en, "activated", _on_text_activated, obj);
1450 1462
diff --git a/src/lib/elm_widget_fileselector.h b/src/lib/elm_widget_fileselector.h
index b970f84f0..08c0f697f 100644
--- a/src/lib/elm_widget_fileselector.h
+++ b/src/lib/elm_widget_fileselector.h
@@ -51,6 +51,7 @@ struct _Elm_Fileselector_Data
51 const char *path; 51 const char *path;
52 const char *selection; 52 const char *selection;
53 Ecore_Idler *populate_idler; 53 Ecore_Idler *populate_idler;
54 Ecore_Idler *path_entry_idler;
54 55
55 const char *path_separator; 56 const char *path_separator;
56 const char *search_string; 57 const char *search_string;