Elementary: fixed on-the-fly UI-mirroring in elc objects.
[framework/uifw/elementary.git] / src / lib / elc_fileselector_entry.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4  /**
5  * @defgroup File_Selector_Entry File Selector Entry
6  *
7  * An entry that shows to enter/display path and have an associated
8  * button to allow selecting the file from a dialog.
9  *
10  * The button, when clicked, creates an Elementary window (or inner
11  * window) with an Elementary File Selector within. When a file is
12  * chosen, the (inner) window is closed and the selected file is
13  * exposed as an evas_object_smart_callback_call() of the button.
14  */
15
16 typedef struct _Widget_Data Widget_Data;
17
18 struct _Widget_Data
19 {
20    Evas_Object *edje;
21    Evas_Object *button;
22    Evas_Object *entry;
23 };
24
25 static const char *widtype = NULL;
26
27 static const char SIG_CHANGED[] = "changed";
28 static const char SIG_ACTIVATED[] = "activated";
29 static const char SIG_PRESS[] = "press";
30 static const char SIG_LONGPRESSED[] = "longpressed";
31 static const char SIG_CLICKED[] = "clicked";
32 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
33 static const char SIG_FOCUSED[] = "focused";
34 static const char SIG_UNFOCUSED[] = "unfocused";
35 static const char SIG_SELECTION_PASTE[] = "selection,paste";
36 static const char SIG_SELECTION_COPY[] = "selection,copy";
37 static const char SIG_SELECTION_CUT[] = "selection,cut";
38 static const char SIG_UNPRESSED[] = "unpressed";
39 static const char SIG_FILE_CHOSEN[] = "file,chosen";
40 static const Evas_Smart_Cb_Description _signals[] =
41 {
42   {SIG_CHANGED, ""},
43   {SIG_ACTIVATED, ""},
44   {SIG_PRESS, ""},
45   {SIG_LONGPRESSED, ""},
46   {SIG_CLICKED, ""},
47   {SIG_CLICKED_DOUBLE, ""},
48   {SIG_FOCUSED, ""},
49   {SIG_UNFOCUSED, ""},
50   {SIG_SELECTION_PASTE, ""},
51   {SIG_SELECTION_COPY, ""},
52   {SIG_SELECTION_CUT, ""},
53   {SIG_UNPRESSED, ""},
54   {SIG_FILE_CHOSEN, "s"},
55   {NULL, NULL}
56 };
57
58 #define SIG_FWD(name)                                                    \
59 static void                                                              \
60 _##name##_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) \
61 {                                                                        \
62    evas_object_smart_callback_call(data, SIG_##name, event_info);        \
63 }
64 SIG_FWD(CHANGED)
65 SIG_FWD(PRESS)
66 SIG_FWD(LONGPRESSED)
67 SIG_FWD(CLICKED)
68 SIG_FWD(CLICKED_DOUBLE)
69 SIG_FWD(FOCUSED)
70 SIG_FWD(UNFOCUSED)
71 SIG_FWD(SELECTION_PASTE)
72 SIG_FWD(SELECTION_COPY)
73 SIG_FWD(SELECTION_CUT)
74 SIG_FWD(UNPRESSED)
75 #undef SIG_FWD
76
77 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
78
79 static void
80 _FILE_CHOSEN_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info)
81 {
82    Widget_Data *wd = elm_widget_data_get(data);
83    const char *file = event_info;
84    elm_scrolled_entry_entry_set(wd->entry, file);
85    evas_object_smart_callback_call(data, SIG_FILE_CHOSEN, event_info);
86 }
87
88 static void
89 _ACTIVATED_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info)
90 {
91    Widget_Data *wd = elm_widget_data_get(data);
92    const char *file = elm_scrolled_entry_entry_get(wd->entry);
93    elm_fileselector_button_path_set(wd->button, file);
94    evas_object_smart_callback_call(data, SIG_ACTIVATED, event_info);
95 }
96
97 static void
98 _del_hook(Evas_Object *obj)
99 {
100    Widget_Data *wd = elm_widget_data_get(obj);
101    free(wd);
102 }
103
104 static void
105 _sizing_eval(Evas_Object *obj)
106 {
107    Widget_Data *wd = elm_widget_data_get(obj);
108    Evas_Coord minw = -1, minh = -1;
109    if (!wd) return;
110    edje_object_size_min_calc(wd->edje, &minw, &minh);
111    evas_object_size_hint_min_set(obj, minw, minh);
112    evas_object_size_hint_max_set(obj, -1, -1);
113 }
114
115 static Eina_Bool
116 _elm_fileselector_entry_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
117 {
118    Widget_Data *wd = elm_widget_data_get(obj);
119
120    if (!wd)
121      return EINA_FALSE;
122
123    Evas_Object *chain[2];
124
125    /* Direction */
126    if (dir == ELM_FOCUS_PREVIOUS)
127      {
128         chain[0] = wd->button;
129         chain[1] = wd->entry;
130      }
131    else if (dir == ELM_FOCUS_NEXT)
132      {
133         chain[0] = wd->entry;
134         chain[1] = wd->button;
135      }
136    else
137      return EINA_FALSE;
138
139    unsigned char i = elm_widget_focus_get(chain[1]);
140
141    if (elm_widget_focus_next_get(chain[i], dir, next))
142      return EINA_TRUE;
143
144    i = !i;
145
146    Evas_Object *to_focus;
147    if (elm_widget_focus_next_get(chain[i], dir, &to_focus))
148      {
149         *next = to_focus;
150         return !!i;
151      }
152
153    return EINA_FALSE;
154 }
155
156 static void
157 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
158 {
159    Widget_Data *wd = elm_widget_data_get(obj);
160    if (!wd) return;
161    elm_widget_mirrored_set(wd->button, rtl);
162    edje_object_mirrored_set(wd->edje, rtl);
163 }
164
165 static void
166 _theme_hook(Evas_Object *obj)
167 {
168    Widget_Data *wd = elm_widget_data_get(obj);
169    const char *style = elm_widget_style_get(obj);
170    char buf[1024];
171
172    if (!wd) return;
173    _elm_widget_mirrored_reload(obj);
174    _mirrored_set(obj, elm_widget_mirrored_get(obj));
175
176    _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", style);
177    if (elm_object_disabled_get(obj))
178       edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm");
179
180    if (!style) style = "default";
181    snprintf(buf, sizeof(buf), "fileselector_entry/%s", style);
182    elm_widget_style_set(wd->button, buf);
183    elm_widget_style_set(wd->entry, buf);
184
185    edje_object_part_swallow(obj, "elm.swallow.button", wd->button);
186    edje_object_part_swallow(obj, "elm.swallow.entry", wd->entry);
187
188    edje_object_message_signal_process(wd->edje);
189    edje_object_scale_set
190      (wd->edje, elm_widget_scale_get(obj) * _elm_config->scale);
191    _sizing_eval(obj);
192 }
193
194 static void
195 _disable_hook(Evas_Object *obj)
196 {
197    Widget_Data *wd = elm_widget_data_get(obj);
198    Eina_Bool val = elm_widget_disabled_get(obj);
199    if (!wd) return;
200    if (val)
201      edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm");
202    else
203      edje_object_signal_emit(wd->edje, "elm,state,enabled", "elm");
204
205    elm_widget_disabled_set(wd->button, val);
206    elm_widget_disabled_set(wd->entry, val);
207 }
208
209 static void
210 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
211 {
212    _sizing_eval(data);
213 }
214
215 /**
216  * Add a new file selector entry into the parent object.
217  *
218  * @param parent The parent object
219  * @return The new object or NULL if it cannot be created
220  *
221  * @ingroup File_Selector_Entry
222  */
223 EAPI Evas_Object *
224 elm_fileselector_entry_add(Evas_Object *parent)
225 {
226    Evas_Object *obj;
227    Evas *e = evas_object_evas_get(parent);
228    if (!e) return NULL;
229    Widget_Data *wd;
230
231    EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
232
233    wd = ELM_NEW(Widget_Data);
234
235    obj = elm_widget_add(e);
236    ELM_SET_WIDTYPE(widtype, "fileselector_entry");
237    elm_widget_type_set(obj, "fileselector_entry");
238    elm_widget_sub_object_add(parent, obj);
239    elm_widget_data_set(obj, wd);
240    elm_widget_del_hook_set(obj, _del_hook);
241    elm_widget_disable_hook_set(obj, _disable_hook);
242    elm_widget_focus_next_hook_set(obj, _elm_fileselector_entry_focus_next_hook);
243    elm_widget_can_focus_set(obj, EINA_FALSE);
244    elm_widget_theme_hook_set(obj, _theme_hook);
245
246    wd->edje = edje_object_add(e);
247    _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", "default");
248    elm_widget_resize_object_set(obj, wd->edje);
249
250    wd->button = elm_fileselector_button_add(obj);
251    elm_widget_mirrored_automatic_set(wd->button, EINA_FALSE);
252    ELM_SET_WIDTYPE(widtype, "fileselector_entry");
253    elm_widget_style_set(wd->button, "fileselector_entry/default");
254    edje_object_part_swallow(wd->edje, "elm.swallow.button", wd->button);
255    elm_widget_sub_object_add(obj, wd->button);
256    evas_object_event_callback_add
257      (wd->button, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
258    elm_fileselector_button_expandable_set(wd->button,
259                                           _elm_config->fileselector_expand_enable);
260
261 #define SIG_FWD(name)                                                   \
262    evas_object_smart_callback_add(wd->button, SIG_##name, _##name##_fwd, obj)
263    SIG_FWD(CLICKED);
264    SIG_FWD(UNPRESSED);
265    SIG_FWD(FILE_CHOSEN);
266 #undef SIG_FWD
267
268    wd->entry = elm_scrolled_entry_add(obj);
269    elm_widget_mirrored_automatic_set(wd->entry, EINA_FALSE);
270    elm_widget_style_set(wd->entry, "fileselector_entry/default");
271    elm_scrolled_entry_single_line_set(wd->entry, EINA_TRUE);
272    elm_scrolled_entry_editable_set(wd->entry, EINA_TRUE);
273    edje_object_part_swallow(wd->edje, "elm.swallow.entry", wd->entry);
274    elm_widget_sub_object_add(obj, wd->entry);
275    evas_object_event_callback_add
276      (wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
277
278 #define SIG_FWD(name)                                                   \
279    evas_object_smart_callback_add(wd->entry, SIG_##name, _##name##_fwd, obj)
280    SIG_FWD(CHANGED);
281    SIG_FWD(ACTIVATED);
282    SIG_FWD(PRESS);
283    SIG_FWD(LONGPRESSED);
284    SIG_FWD(CLICKED);
285    SIG_FWD(CLICKED_DOUBLE);
286    SIG_FWD(FOCUSED);
287    SIG_FWD(UNFOCUSED);
288    SIG_FWD(SELECTION_PASTE);
289    SIG_FWD(SELECTION_COPY);
290    SIG_FWD(SELECTION_CUT);
291 #undef SIG_FWD
292
293    _mirrored_set(obj, elm_widget_mirrored_get(obj));
294    _sizing_eval(obj);
295
296    // TODO: convert Elementary to subclassing of Evas_Smart_Class
297    // TODO: and save some bytes, making descriptions per-class and not instance!
298    evas_object_smart_callbacks_descriptions_set(obj, _signals);
299    return obj;
300 }
301
302 /**
303  * Set the label used in the file selector entry.
304  *
305  * @param obj The entry object
306  * @param label The text label text to be displayed on the entry
307  *
308  * @ingroup File_Selector_Entry
309  */
310 EAPI void
311 elm_fileselector_entry_button_label_set(Evas_Object *obj, const char *label)
312 {
313    ELM_CHECK_WIDTYPE(obj, widtype);
314    Widget_Data *wd = elm_widget_data_get(obj);
315    if (!wd) return;
316    elm_fileselector_button_label_set(wd->button, label);
317 }
318
319 EAPI const char *
320 elm_fileselector_entry_button_label_get(const Evas_Object *obj)
321 {
322    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
323    Widget_Data *wd = elm_widget_data_get(obj);
324    if (!wd) return NULL;
325    return elm_fileselector_button_label_get(wd->button);
326 }
327
328 /**
329  * Set the path to start the entry's file selector with, when clicked.
330  *
331  * @param obj The entry object
332  * @param path Path to a file/directory
333  *
334  * Default path is "HOME" environment variable's value.
335  *
336  * @ingroup File_Selector_Entry
337  */
338 EAPI void
339 elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path)
340 {
341    ELM_CHECK_WIDTYPE(obj, widtype);
342    Widget_Data *wd = elm_widget_data_get(obj);
343    if (!wd) return;
344    elm_fileselector_button_path_set(wd->button, path);
345 }
346
347 /**
348  * Get the <b>last</b> path which the entry's file selector was set to.
349  *
350  * @param obj The entry object
351  * @param path Path to a file/directory
352  *
353  * Default path is "HOME" environment variable's value.
354  *
355  * @ingroup File_Selector_Entry
356  */
357 EAPI const char *
358 elm_fileselector_entry_selected_get(const Evas_Object *obj)
359 {
360    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
361    Widget_Data *wd = elm_widget_data_get(obj);
362    if (!wd) return NULL;
363    return elm_fileselector_button_path_get(wd->button);
364 }
365
366 /**
367  * Set the title of the file selector entry's window.
368  *
369  * @param obj The entry object
370  * @param title The title string
371  *
372  * Note that it will only take any effect if the fileselector entry
373  * not at "inwin mode".
374  *
375  * @ingroup File_Selector_Entry
376  */
377 EAPI void
378 elm_fileselector_entry_window_title_set(Evas_Object *obj, const char *title)
379 {
380    ELM_CHECK_WIDTYPE(obj, widtype);
381    Widget_Data *wd = elm_widget_data_get(obj);
382    if (!wd) return;
383    elm_fileselector_button_window_title_set(wd->button, title);
384 }
385
386 /**
387  * Get the title of the file selector entry's window.
388  *
389  * @param obj The entry object
390  *
391  * @ingroup File_Selector_Entry
392  */
393 EAPI const char *
394 elm_fileselector_entry_window_title_get(const Evas_Object *obj)
395 {
396    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
397    Widget_Data *wd = elm_widget_data_get(obj);
398    if (!wd) return NULL;
399    return elm_fileselector_button_window_title_get(wd->button);
400 }
401
402 /**
403  * Set the size of the file selector entry's window.
404  *
405  * @param obj The entry object
406  * @param width The width
407  * @param height The height
408  *
409  * Note that it will only take any effect if the fileselector entry not at
410  * "inwin mode". Default size for the window (when applicable) is 400x400.
411  *
412  * @ingroup File_Selector_Entry
413  */
414 EAPI void
415 elm_fileselector_entry_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height)
416 {
417    ELM_CHECK_WIDTYPE(obj, widtype);
418    Widget_Data *wd = elm_widget_data_get(obj);
419    if (!wd) return;
420    elm_fileselector_button_window_size_set(wd->button, width, height);
421 }
422
423 /**
424  * Get the size of the file selector entry's window.
425  *
426  * @param obj The entry object
427  * @param width Pointer into which to store the width value
428  * @param height Pointer into which to store the height value
429  *
430  * @ingroup File_Selector_Entry
431  */
432 EAPI void
433 elm_fileselector_entry_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height)
434 {
435    ELM_CHECK_WIDTYPE(obj, widtype);
436    Widget_Data *wd = elm_widget_data_get(obj);
437    if (!wd) return;
438    elm_fileselector_button_window_size_get(wd->button, width, height);
439 }
440
441 /**
442  * Set the starting path of the file selector entry's window.
443  *
444  * @param obj The entry object
445  * @param path The path string
446  *
447  * It must be a <b>directory</b> path.
448  *
449  * @ingroup File_Selector_Entry
450  */
451 EAPI void
452 elm_fileselector_entry_path_set(Evas_Object *obj, const char *path)
453 {
454    ELM_CHECK_WIDTYPE(obj, widtype);
455    Widget_Data *wd = elm_widget_data_get(obj);
456    if (!wd) return;
457    elm_fileselector_button_path_set(wd->button, path);
458    elm_scrolled_entry_entry_set(wd->entry, path);
459 }
460
461 /**
462  * Get the <b>last</b> path of the file selector entry's window.
463  *
464  * @param obj The entry object
465  *
466  * @ingroup File_Selector_Entry
467  */
468 EAPI const char *
469 elm_fileselector_entry_path_get(const Evas_Object *obj)
470 {
471    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
472    Widget_Data *wd = elm_widget_data_get(obj);
473    if (!wd) return NULL;
474    return elm_scrolled_entry_entry_get(wd->entry);
475 }
476
477 /**
478  * Set whether the entry's file selector is to present itself as an
479  * Elementary Generic List (which will expand its entries for nested
480  * directories) or as canonical list, which will be rendered again
481  * with the contents of each selected directory.
482  *
483  * @param obj The entry object
484  * @param value The expandable flag
485  *
486  * @ingroup File_Selector_Entry
487  */
488 EAPI void
489 elm_fileselector_entry_expandable_set(Evas_Object *obj, Eina_Bool value)
490 {
491    ELM_CHECK_WIDTYPE(obj, widtype);
492    Widget_Data *wd = elm_widget_data_get(obj);
493    if (!wd) return;
494    elm_fileselector_button_expandable_set(wd->button, value);
495 }
496
497 /**
498  * Get the entry's file selector expandable flag.
499  *
500  * @param obj The entry object
501  * @return value The expandable flag
502  *
503  * @ingroup File_Selector_Entry
504  */
505 EAPI Eina_Bool
506 elm_fileselector_entry_expandable_get(const Evas_Object *obj)
507 {
508    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
509    Widget_Data *wd = elm_widget_data_get(obj);
510    if (!wd) return EINA_FALSE;
511    return elm_fileselector_button_expandable_get(wd->button);
512 }
513
514 /**
515  * Set whether the entry's file selector list is to display folders
516  * only or the directory contents, as well.
517  *
518  * @param obj The entry object
519  * @param value The "folder only" flag
520  *
521  * @ingroup File_Selector_Entry
522  */
523 EAPI void
524 elm_fileselector_entry_folder_only_set(Evas_Object *obj, Eina_Bool value)
525 {
526    ELM_CHECK_WIDTYPE(obj, widtype);
527    Widget_Data *wd = elm_widget_data_get(obj);
528    if (!wd) return;
529    elm_fileselector_button_folder_only_set(wd->button, value);
530 }
531
532 /**
533  * Get the entry's file selector "folder only" flag.
534  *
535  * @param obj The entry object
536  * @return value The "folder only" flag
537  *
538  * @ingroup File_Selector_Entry
539  */
540 EAPI Eina_Bool
541 elm_fileselector_entry_folder_only_get(const Evas_Object *obj)
542 {
543    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
544    Widget_Data *wd = elm_widget_data_get(obj);
545    if (!wd) return EINA_FALSE;
546    return elm_fileselector_button_folder_only_get(wd->button);
547 }
548
549 /**
550  * Set whether the entry's file selector has an editable text entry
551  * which will hold its current selection.
552  *
553  * @param obj The entry object
554  * @param value The "is save" flag
555  *
556  * @ingroup File_Selector_Entry
557  */
558 EAPI void
559 elm_fileselector_entry_is_save_set(Evas_Object *obj, Eina_Bool value)
560 {
561    ELM_CHECK_WIDTYPE(obj, widtype);
562    Widget_Data *wd = elm_widget_data_get(obj);
563    if (!wd) return;
564    elm_fileselector_button_is_save_set(wd->button, value);
565 }
566
567 /**
568  * Get the entry's file selector "is save" flag.
569  *
570  * @param obj The entry object
571  * @return value The "is save" flag
572  *
573  * @ingroup File_Selector_Entry
574  */
575 EAPI Eina_Bool
576 elm_fileselector_entry_is_save_get(const Evas_Object *obj)
577 {
578    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
579    Widget_Data *wd = elm_widget_data_get(obj);
580    if (!wd) return EINA_FALSE;
581    return elm_fileselector_button_is_save_get(wd->button);
582 }
583
584 /**
585  * Set whether the entry's file selector will raise an Elementary
586  * Inner Window, instead of a dedicated Elementary Window. By default,
587  * it won't.
588  *
589  * @param obj The entry object
590  * @param value The "inwin mode" flag
591  *
592  * @ingroup File_Selector_Entry
593  */
594 EAPI void
595 elm_fileselector_entry_inwin_mode_set(Evas_Object *obj, Eina_Bool value)
596 {
597    ELM_CHECK_WIDTYPE(obj, widtype);
598    Widget_Data *wd = elm_widget_data_get(obj);
599    if (!wd) return;
600    elm_fileselector_button_inwin_mode_set(wd->button, value);
601 }
602
603 /**
604  * Get the entry's file selector "inwin mode" flag.
605  *
606  * @param obj The entry object
607  * @return value The "inwin mode" flag
608  *
609  * @ingroup File_Selector_Entry
610  */
611 EAPI Eina_Bool
612 elm_fileselector_entry_inwin_mode_get(const Evas_Object *obj)
613 {
614    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
615    Widget_Data *wd = elm_widget_data_get(obj);
616    if (!wd) return EINA_FALSE;
617    return elm_fileselector_button_inwin_mode_get(wd->button);
618 }
619
620 /**
621  * Set the icon used for the entry button
622  *
623  * Once the icon object is set, a previously set one will be deleted.
624  *
625  * @param obj The entry object
626  * @param icon  The image for the entry
627  *
628  * @ingroup File_Selector_Entry
629  */
630 EAPI void
631 elm_fileselector_entry_button_icon_set(Evas_Object *obj, Evas_Object *icon)
632 {
633    ELM_CHECK_WIDTYPE(obj, widtype);
634    Widget_Data *wd = elm_widget_data_get(obj);
635    if (!wd) return;
636    elm_fileselector_button_icon_set(wd->button, icon);
637 }
638
639 /**
640  * Get the icon used for the entry button
641  *
642  * @param obj The entry object
643  * @return The image for the entry
644  *
645  * @ingroup File_Selector_Entry
646  */
647 EAPI Evas_Object *
648 elm_fileselector_entry_button_icon_get(const Evas_Object *obj)
649 {
650    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
651    Widget_Data *wd = elm_widget_data_get(obj);
652    if (!wd) return NULL;
653    return elm_fileselector_button_icon_get(wd->button);
654 }
655
656 /**
657  * Unset the icon used for the entry button
658  *
659  * Unparent and return the icon object which was set for this widget.
660  *
661  * @param obj The entry object
662  * @return The icon object that was being used
663  *
664  * @ingroup File_Selector_Entry
665  */
666 EAPI Evas_Object *
667 elm_fileselector_entry_button_icon_unset(Evas_Object *obj)
668 {
669    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
670    Widget_Data *wd = elm_widget_data_get(obj);
671    if (!wd) return NULL;
672    return elm_fileselector_button_icon_unset(wd->button);
673 }