diff options
Diffstat (limited to 'src/extantz')
-rw-r--r-- | src/extantz/extantz.c | 2 | ||||
-rw-r--r-- | src/extantz/files.c | 340 |
2 files changed, 176 insertions, 166 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 54caf82..0579552 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -413,7 +413,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
413 | // overlay_add(&ourGlobals); | 413 | // overlay_add(&ourGlobals); |
414 | woMan = woMan_add(&ourGlobals); | 414 | woMan = woMan_add(&ourGlobals); |
415 | chat = chat_add(&ourGlobals); | 415 | chat = chat_add(&ourGlobals); |
416 | // files = files_add(&ourGlobals); | 416 | files = files_add(&ourGlobals); |
417 | 417 | ||
418 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 418 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
419 | // This sucks, gotta redefine this menu each time we create a new window? | 419 | // This sucks, gotta redefine this menu each time we create a new window? |
diff --git a/src/extantz/files.c b/src/extantz/files.c index 84bf37b..b705e21 100644 --- a/src/extantz/files.c +++ b/src/extantz/files.c | |||
@@ -1,79 +1,7 @@ | |||
1 | #include "extantz.h" | 1 | #include "extantz.h" |
2 | #include <elm_interface_fileselector.h> | ||
2 | 3 | ||
3 | 4 | ||
4 | static void my_fileselector_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) | ||
5 | { | ||
6 | /* event_info conatin the full path of the selected file | ||
7 | * or NULL if none is selected or cancel is pressed */ | ||
8 | const char *selected = event_info; | ||
9 | |||
10 | if (selected) | ||
11 | printf("Selected file: %s\n", selected); | ||
12 | else | ||
13 | evas_object_del(data); /* delete the test window */ | ||
14 | } | ||
15 | |||
16 | static void my_fileselector_selected(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) | ||
17 | { | ||
18 | /* event_info conatin the full path of the selected file */ | ||
19 | const char *selected = event_info; | ||
20 | printf("Selected file: %s\n", selected); | ||
21 | |||
22 | /* or you can query the selection */ | ||
23 | if (elm_fileselector_multi_select_get(obj)) | ||
24 | { | ||
25 | const Eina_List *li; | ||
26 | const Eina_List *paths = elm_fileselector_selected_paths_get(obj); | ||
27 | char *path; | ||
28 | printf("All selected files are:\n"); | ||
29 | EINA_LIST_FOREACH(paths, li, path) | ||
30 | printf(" %s\n", path); | ||
31 | } | ||
32 | else | ||
33 | printf("or: %s\n", elm_fileselector_selected_get(obj)); | ||
34 | } | ||
35 | |||
36 | static void _popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
37 | { | ||
38 | evas_object_del(data); | ||
39 | } | ||
40 | |||
41 | static void my_fileselector_invalid(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) | ||
42 | { | ||
43 | Evas_Object *popup; | ||
44 | Evas_Object *btn; | ||
45 | char error_msg[256]; | ||
46 | |||
47 | snprintf(error_msg, 256, "No such file or directory: %s", (char *)event_info); | ||
48 | |||
49 | popup = elm_popup_add(data); | ||
50 | elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR); | ||
51 | elm_object_part_text_set(popup, "title,text", "Error"); | ||
52 | elm_object_text_set(popup, error_msg); | ||
53 | |||
54 | btn = elm_button_add(popup); | ||
55 | elm_object_text_set(btn, "OK"); | ||
56 | elm_object_part_content_set(popup, "button1", btn); | ||
57 | evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup); | ||
58 | |||
59 | evas_object_show(popup); | ||
60 | } | ||
61 | |||
62 | static void my_fileselector_activated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) | ||
63 | { | ||
64 | printf("Activated file: %s\n", (char *)event_info); | ||
65 | } | ||
66 | |||
67 | static void _expandable_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
68 | { | ||
69 | Evas_Object *fs = data; | ||
70 | |||
71 | if (elm_fileselector_expandable_get(fs)) | ||
72 | elm_fileselector_expandable_set(fs, EINA_FALSE); | ||
73 | else | ||
74 | elm_fileselector_expandable_set(fs, EINA_TRUE); | ||
75 | } | ||
76 | |||
77 | static void _hidden_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 5 | static void _hidden_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
78 | { | 6 | { |
79 | Evas_Object *fs = data; | 7 | Evas_Object *fs = data; |
@@ -105,39 +33,65 @@ static void _sort_selected_cb(void *data, Evas_Object *obj, void *event_info) | |||
105 | static void _tiny_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 33 | static void _tiny_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
106 | { | 34 | { |
107 | Evas_Object *fs = data; | 35 | Evas_Object *fs = data; |
108 | Evas_Coord w, h; | ||
109 | 36 | ||
110 | elm_fileselector_thumbnail_size_get(fs, &w, &h); | ||
111 | elm_fileselector_thumbnail_size_set(fs, 16, 16); | 37 | elm_fileselector_thumbnail_size_set(fs, 16, 16); |
112 | } | 38 | } |
113 | 39 | ||
114 | static void _small_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 40 | static void _small_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
115 | { | 41 | { |
116 | Evas_Object *fs = data; | 42 | Evas_Object *fs = data; |
117 | Evas_Coord w, h; | ||
118 | 43 | ||
119 | elm_fileselector_thumbnail_size_get(fs, &w, &h); | ||
120 | elm_fileselector_thumbnail_size_set(fs, 32, 32); | 44 | elm_fileselector_thumbnail_size_set(fs, 32, 32); |
121 | } | 45 | } |
122 | 46 | ||
123 | static void _middle_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 47 | static void _middle_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
124 | { | 48 | { |
125 | Evas_Object *fs = data; | 49 | Evas_Object *fs = data; |
126 | Evas_Coord w, h; | ||
127 | 50 | ||
128 | elm_fileselector_thumbnail_size_get(fs, &w, &h); | ||
129 | elm_fileselector_thumbnail_size_set(fs, 64, 64); | 51 | elm_fileselector_thumbnail_size_set(fs, 64, 64); |
130 | } | 52 | } |
131 | 53 | ||
132 | static void _big_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 54 | static void _big_icon_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
133 | { | 55 | { |
134 | Evas_Object *fs = data; | 56 | Evas_Object *fs = data; |
135 | Evas_Coord w, h; | ||
136 | 57 | ||
137 | elm_fileselector_thumbnail_size_get(fs, &w, &h); | ||
138 | elm_fileselector_thumbnail_size_set(fs, 128, 128); | 58 | elm_fileselector_thumbnail_size_set(fs, 128, 128); |
139 | } | 59 | } |
140 | 60 | ||
61 | static void _OK_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
62 | { | ||
63 | Evas_Object *fs = data; | ||
64 | |||
65 | if (elm_fileselector_multi_select_get(fs)) | ||
66 | { | ||
67 | Eina_List const *files = elm_fileselector_selected_paths_get(fs), *i; | ||
68 | char *file; | ||
69 | |||
70 | printf("SELECTED files : \n"); | ||
71 | EINA_LIST_FOREACH(files, i, file) | ||
72 | { | ||
73 | printf(" %s\n", file); | ||
74 | } | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | char const *file = elm_fileselector_selected_get(fs); | ||
79 | |||
80 | printf("SELECTED file : %s\n", file); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static void _CANCEL_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
85 | { | ||
86 | // Evas_Object *fs = data; | ||
87 | } | ||
88 | |||
89 | static void my_fileselector_activated(void *data, Evas_Object *obj, void *event_info) | ||
90 | { | ||
91 | _OK_clicked(data, obj, event_info); | ||
92 | } | ||
93 | |||
94 | #if 0 | ||
141 | static Eina_Bool _all_filter(const char *path EINA_UNUSED, Eina_Bool dir EINA_UNUSED, void *data EINA_UNUSED) | 95 | static Eina_Bool _all_filter(const char *path EINA_UNUSED, Eina_Bool dir EINA_UNUSED, void *data EINA_UNUSED) |
142 | { | 96 | { |
143 | return EINA_TRUE; | 97 | return EINA_TRUE; |
@@ -152,10 +106,40 @@ static Eina_Bool _edje_filter(const char *path, Eina_Bool dir, void *data EINA_U | |||
152 | return EINA_TRUE; | 106 | return EINA_TRUE; |
153 | return EINA_FALSE; | 107 | return EINA_FALSE; |
154 | } | 108 | } |
109 | #endif | ||
110 | |||
111 | // TODO - This is to work around a bug in Elm entry, remove it when the bug is fixed. | ||
112 | // The bug is that editable entry widgets cause the app to hang on exit. | ||
113 | // In this case, we have the name and path entry widgets. | ||
114 | void _on_fs_del(void *data, Evas_Object *obj, void *event_info) | ||
115 | { | ||
116 | // Make sure name entry is not editable. | ||
117 | elm_fileselector_is_save_set(obj, EINA_FALSE); | ||
118 | |||
119 | /* For future reference, these are the swallowed parts as of 2014-05-04 - | ||
120 | SWALLOW("elm.swallow.up", sd->up_button); | ||
121 | SWALLOW("elm.swallow.home", sd->home_button); | ||
122 | SWALLOW("elm.swallow.spinner", sd->spinner); | ||
123 | |||
124 | elm_layout_content_set(obj, "elm.swallow.files", sd->files_view); | ||
125 | |||
126 | SWALLOW("elm.swallow.path", sd->path_entry); | ||
127 | SWALLOW("elm.swallow.filename", sd->name_entry); | ||
128 | |||
129 | SWALLOW("elm.swallow.filters", sd->filter_hoversel); | ||
130 | SWALLOW("elm.swallow.cancel", sd->cancel_button); | ||
131 | SWALLOW("elm.swallow.ok", sd->ok_button); | ||
132 | */ | ||
133 | |||
134 | // Make sure path entry is not editable. We have to dig it out using private info here. | ||
135 | obj = elm_layout_content_get(obj, "elm.swallow.path"); | ||
136 | elm_entry_editable_set(obj, EINA_FALSE); | ||
137 | } | ||
155 | 138 | ||
156 | fangWin *files_add(globals *ourGlobals) | 139 | fangWin *files_add(globals *ourGlobals) |
157 | { | 140 | { |
158 | fangWin *me; | 141 | fangWin *me; |
142 | Widget *wid; | ||
159 | Evas_Object *bx, *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; | 143 | Evas_Object *bx, *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; |
160 | 144 | ||
161 | me = fang_win_add(ourGlobals); | 145 | me = fang_win_add(ourGlobals); |
@@ -169,35 +153,36 @@ fangWin *files_add(globals *ourGlobals) | |||
169 | elm_win_resize_object_add(me->win, bx); | 153 | elm_win_resize_object_add(me->win, bx); |
170 | 154 | ||
171 | fs = eo_add(ELM_OBJ_FILESELECTOR_CLASS, bx); | 155 | fs = eo_add(ELM_OBJ_FILESELECTOR_CLASS, bx); |
156 | wid = widgetAdd(me); | ||
157 | wid->obj = fs; | ||
158 | wid->on_del = _on_fs_del; | ||
172 | eo_do(fs, | 159 | eo_do(fs, |
173 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 160 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
174 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 161 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
162 | elm_obj_fileselector_buttons_ok_cancel_set(EINA_FALSE), | ||
163 | elm_interface_fileselector_expandable_set(EINA_TRUE), | ||
164 | elm_interface_fileselector_folder_only_set(EINA_FALSE), | ||
175 | evas_obj_visibility_set(EINA_TRUE) | 165 | evas_obj_visibility_set(EINA_TRUE) |
176 | ); | 166 | ); |
177 | elm_box_pack_end(bx, fs); | 167 | elm_box_pack_end(bx, fs); |
178 | 168 | ||
179 | /* disnable the fs file name entry */ | 169 | // TODO - Should allow these to be set from the caller. |
180 | elm_fileselector_is_save_set(fs, EINA_FALSE); | 170 | elm_fileselector_path_set(fs, elm_app_data_dir_get()); |
181 | /* make the file list a tree with dir expandable in place */ | 171 | elm_fileselector_is_save_set(fs, EINA_FALSE); |
182 | elm_fileselector_expandable_set(fs, EINA_FALSE); | 172 | elm_fileselector_multi_select_set(fs, EINA_TRUE); |
183 | /* start the fileselector in the home dir */ | 173 | |
184 | elm_fileselector_path_set(fs, getenv("HOME")); | 174 | // TODO - Should allow these to be set from the caller. |
185 | elm_fileselector_folder_only_set(fs, EINA_FALSE); | 175 | // TODO - Don't do these, it adds a horribly out of place button. |
186 | elm_fileselector_buttons_ok_cancel_set(fs, EINA_TRUE); | 176 | // Either fix Elm file selector to be more general purpose, |
187 | elm_fileselector_multi_select_set(fs, EINA_TRUE); | 177 | // clone and fix the fileselector theme, |
188 | 178 | // or write my own file selector. | |
189 | /* add filesters */ | 179 | // elm_fileselector_custom_filter_append(fs, _all_filter, NULL, "all files"); |
190 | elm_fileselector_custom_filter_append(fs, _all_filter, NULL, "all files"); | 180 | // elm_fileselector_custom_filter_append(fs, _edje_filter, NULL, "edje files"); |
191 | elm_fileselector_custom_filter_append(fs, _edje_filter, NULL, "edje files"); | 181 | // elm_fileselector_mime_types_filter_append(fs, "image/*", "image files"); |
192 | elm_fileselector_mime_types_filter_append(fs, "image/*", "image files"); | 182 | // elm_fileselector_mime_types_filter_append(fs, "text/*", "text files"); |
193 | elm_fileselector_mime_types_filter_append(fs, "text/*", "text files"); | 183 | |
194 | 184 | // Call back for double click or Enter pressed on file. | |
195 | evas_object_smart_callback_add(fs, "done", my_fileselector_done, win); | 185 | evas_object_smart_callback_add(fs, "activated", my_fileselector_activated, fs); |
196 | evas_object_smart_callback_add(fs, "selected", my_fileselector_selected, win); | ||
197 | evas_object_smart_callback_add(fs, "selected,invalid", my_fileselector_invalid, win); | ||
198 | evas_object_smart_callback_add(fs, "activated", my_fileselector_activated, win); | ||
199 | |||
200 | eo_unref(fs); | ||
201 | 186 | ||
202 | vbox = eo_add(ELM_OBJ_BOX_CLASS, me->win); | 187 | vbox = eo_add(ELM_OBJ_BOX_CLASS, me->win); |
203 | eo_do(vbox, | 188 | eo_do(vbox, |
@@ -206,69 +191,94 @@ fangWin *files_add(globals *ourGlobals) | |||
206 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) | 191 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL) |
207 | ); | 192 | ); |
208 | 193 | ||
209 | bt = elm_check_add(vbox); | 194 | hoversel = eo_add(ELM_OBJ_HOVERSEL_CLASS, vbox); |
210 | elm_object_text_set(bt, "tree"); | 195 | elm_object_text_set(hoversel, "sorting"); |
211 | elm_check_state_set(bt, elm_fileselector_expandable_get(fs)); | 196 | eo_do(hoversel, |
212 | evas_object_smart_callback_add(bt, "changed", _expandable_clicked, fs); | 197 | elm_obj_hoversel_hover_parent_set(me->win), |
213 | elm_box_pack_end(vbox, bt); | 198 | eo_key_data_set("fileselector", fs, NULL), |
214 | evas_object_show(bt); | 199 | elm_obj_hoversel_item_add("name(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_FILENAME_ASC), |
215 | 200 | elm_obj_hoversel_item_add("name(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_FILENAME_DESC), | |
216 | bt = elm_check_add(vbox); | 201 | elm_obj_hoversel_item_add("type(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_TYPE_ASC), |
217 | elm_object_text_set(bt, "hidden"); | 202 | elm_obj_hoversel_item_add("type(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_TYPE_DESC), |
218 | elm_check_state_set(bt, elm_fileselector_hidden_visible_get(fs)); | 203 | elm_obj_hoversel_item_add("size(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_SIZE_ASC), |
219 | evas_object_smart_callback_add(bt, "changed", _hidden_clicked, fs); | 204 | elm_obj_hoversel_item_add("size(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_SIZE_DESC), |
220 | elm_box_pack_end(vbox, bt); | 205 | elm_obj_hoversel_item_add("time(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC), |
221 | evas_object_show(bt); | 206 | elm_obj_hoversel_item_add("time(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC), |
222 | 207 | evas_obj_visibility_set(EINA_TRUE) | |
223 | rdg = rd = elm_radio_add(vbox); | 208 | ); |
224 | elm_radio_state_value_set(rd, ELM_FILESELECTOR_LIST); | 209 | elm_box_pack_end(vbox, hoversel); |
225 | elm_object_text_set(rd, "list"); | 210 | eo_unref(hoversel); |
226 | elm_box_pack_end(vbox, rd); | 211 | |
227 | evas_object_show(rd); | 212 | hoversel = eo_add(ELM_OBJ_HOVERSEL_CLASS, vbox); |
228 | evas_object_smart_callback_add(rd, "changed", _mode_changed_cb, fs); | 213 | elm_object_text_set(hoversel, "size"); |
229 | 214 | eo_do(hoversel, | |
230 | rd = elm_radio_add(vbox); | 215 | elm_obj_hoversel_hover_parent_set(me->win), |
231 | elm_radio_group_add(rd, rdg); | 216 | eo_key_data_set("fileselector", fs, NULL), |
232 | elm_radio_state_value_set(rd, ELM_FILESELECTOR_GRID); | 217 | elm_obj_hoversel_item_add("tiny", NULL, ELM_ICON_NONE, _tiny_icon_clicked, fs), |
233 | elm_object_text_set(rd, "grid"); | 218 | elm_obj_hoversel_item_add("small", NULL, ELM_ICON_NONE, _small_icon_clicked, fs), |
234 | elm_box_pack_end(vbox, rd); | 219 | elm_obj_hoversel_item_add("medium", NULL, ELM_ICON_NONE, _middle_icon_clicked, fs), |
235 | evas_object_show(rd); | 220 | elm_obj_hoversel_item_add("big", NULL, ELM_ICON_NONE, _big_icon_clicked, fs), |
236 | evas_object_smart_callback_add(rd, "changed", _mode_changed_cb, fs); | 221 | evas_obj_visibility_set(EINA_TRUE) |
237 | 222 | ); | |
238 | 223 | elm_box_pack_end(vbox, hoversel); | |
239 | hoversel = elm_hoversel_add(vbox); | 224 | // Make sure it starts off as small, works around "hitting grid mode before hitting size not showing anything" bug. |
240 | elm_hoversel_hover_parent_set(hoversel, me->win); | 225 | _small_icon_clicked(fs, hoversel, NULL); |
241 | evas_object_data_set(hoversel, "fileselector", fs); | 226 | eo_unref(hoversel); |
242 | elm_object_text_set(hoversel, "sorting"); | 227 | |
243 | 228 | ||
244 | elm_hoversel_item_add(hoversel, "name(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_FILENAME_ASC); | 229 | bt = eo_add(ELM_OBJ_CHECK_CLASS, vbox); |
245 | elm_hoversel_item_add(hoversel, "name(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_FILENAME_DESC); | 230 | elm_object_text_set(bt, "hidden"); |
246 | elm_hoversel_item_add(hoversel, "type(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_TYPE_ASC); | 231 | eo_do(bt, |
247 | elm_hoversel_item_add(hoversel, "type(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_TYPE_DESC); | 232 | elm_obj_check_state_set(elm_fileselector_hidden_visible_get(fs)), |
248 | elm_hoversel_item_add(hoversel, "size(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_SIZE_ASC); | 233 | evas_obj_visibility_set(EINA_TRUE) |
249 | elm_hoversel_item_add(hoversel, "size(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_SIZE_DESC); | 234 | ); |
250 | elm_hoversel_item_add(hoversel, "time(asc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC); | 235 | evas_object_smart_callback_add(bt, "changed", _hidden_clicked, fs); |
251 | elm_hoversel_item_add(hoversel, "time(desc)", NULL, ELM_ICON_NONE, _sort_selected_cb, (const void *) ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC); | 236 | elm_box_pack_end(vbox, bt); |
252 | 237 | eo_unref(bt); | |
253 | elm_box_pack_end(vbox, hoversel); | 238 | |
254 | evas_object_show(hoversel); | 239 | rdg = rd = eo_add(ELM_OBJ_RADIO_CLASS, vbox); |
255 | 240 | elm_object_text_set(rd, "grid"); | |
256 | hoversel = elm_hoversel_add(vbox); | 241 | eo_do(rd, |
257 | elm_hoversel_hover_parent_set(hoversel, me->win); | 242 | elm_obj_radio_state_value_set(ELM_FILESELECTOR_GRID), |
258 | evas_object_data_set(hoversel, "fileselector", fs); | 243 | evas_obj_visibility_set(EINA_TRUE) |
259 | elm_object_text_set(hoversel, "size"); | 244 | ); |
260 | 245 | elm_box_pack_end(vbox, rd); | |
261 | elm_hoversel_item_add(hoversel, "tiny", NULL, ELM_ICON_NONE, _tiny_icon_clicked, fs); | 246 | evas_object_smart_callback_add(rd, "changed", _mode_changed_cb, fs); |
262 | elm_hoversel_item_add(hoversel, "small", NULL, ELM_ICON_NONE, _small_icon_clicked, fs); | 247 | // Make it start in grid mode. It defaults to list mode, so this swaps it over. |
263 | elm_hoversel_item_add(hoversel, "medium", NULL, ELM_ICON_NONE, _middle_icon_clicked, fs); | 248 | _mode_changed_cb(fs, rd, NULL); |
264 | elm_hoversel_item_add(hoversel, "big", NULL, ELM_ICON_NONE, _big_icon_clicked, fs); | 249 | eo_unref(rd); |
265 | 250 | ||
266 | elm_box_pack_end(vbox, hoversel); | 251 | rd = eo_add(ELM_OBJ_RADIO_CLASS, vbox); |
267 | evas_object_show(hoversel); | 252 | elm_radio_group_add(rd, rdg); |
268 | 253 | elm_object_text_set(rd, "list"); | |
269 | elm_box_pack_end(bx, vbox); | 254 | eo_do(rd, |
270 | evas_object_show(vbox); | 255 | elm_obj_radio_state_value_set(ELM_FILESELECTOR_LIST), |
256 | evas_obj_visibility_set(EINA_TRUE) | ||
257 | ); | ||
258 | elm_box_pack_end(vbox, rd); | ||
259 | evas_object_smart_callback_add(rd, "changed", _mode_changed_cb, fs); | ||
260 | eo_unref(rd); | ||
261 | // No need to unref this, it's taken care of already. | ||
262 | //eo_unref(rdg); | ||
263 | |||
264 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win); | ||
265 | elm_object_text_set(bt, "OK"); | ||
266 | eo_do(bt, evas_obj_visibility_set(EINA_TRUE)); | ||
267 | evas_object_smart_callback_add(bt, "clicked", _OK_clicked, fs); | ||
268 | elm_box_pack_end(vbox, bt); | ||
269 | eo_unref(bt); | ||
270 | |||
271 | bt = eo_add(ELM_OBJ_BUTTON_CLASS, me->win); | ||
272 | elm_object_text_set(bt, "CANCEL"); | ||
273 | eo_do(bt, evas_obj_visibility_set(EINA_TRUE)); | ||
274 | evas_object_smart_callback_add(bt, "clicked", _CANCEL_clicked, fs); | ||
275 | elm_box_pack_end(vbox, bt); | ||
276 | eo_unref(bt); | ||
277 | |||
278 | elm_box_pack_end(bx, vbox); | ||
279 | evas_object_show(vbox); | ||
271 | evas_object_show(bx); | 280 | evas_object_show(bx); |
281 | eo_unref(vbox); | ||
272 | eo_unref(bx); | 282 | eo_unref(bx); |
273 | 283 | ||
274 | fang_win_complete(ourGlobals, me, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500); | 284 | fang_win_complete(ourGlobals, me, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500); |