summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/elc_fileselector_button.c50
-rw-r--r--src/lib/elementary/elm_fileselector_button.eo4
-rw-r--r--src/lib/elementary/elm_widget_fileselector_button.h1
-rw-r--r--src/tests/elementary/elm_test_fileselector_button.c14
4 files changed, 68 insertions, 1 deletions
diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c
index 86632611bc..16d76cbf51 100644
--- a/src/lib/elementary/elc_fileselector_button.c
+++ b/src/lib/elementary/elc_fileselector_button.c
@@ -98,7 +98,7 @@ _selection_done(void *data, const Efl_Event *event EINA_UNUSED)
98 _model_event_call 98 _model_event_call
99 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL, NULL); 99 (sd->obj, ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN, NULL, NULL);
100 } 100 }
101 101 eina_stringshare_replace(&sd->fsd.current_name, elm_interface_fileselector_current_name_get(sd->fs));
102 del = sd->fsw; 102 del = sd->fsw;
103 sd->fs = NULL; 103 sd->fs = NULL;
104 sd->fsw = NULL; 104 sd->fsw = NULL;
@@ -629,6 +629,54 @@ _elm_fileselector_button_elm_interface_fileselector_hidden_visible_set(Eo *obj E
629 if (sd->fs) elm_fileselector_hidden_visible_set(sd->fs, visible); 629 if (sd->fs) elm_fileselector_hidden_visible_set(sd->fs, visible);
630} 630}
631 631
632EOLIAN static void
633_elm_fileselector_button_elm_interface_fileselector_current_name_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd, const char *name)
634{
635 eina_stringshare_replace(&sd->fsd.current_name, name);
636 if (sd->fs) elm_fileselector_current_name_set(sd->fs, sd->fsd.current_name);
637}
638
639EOLIAN static const char*
640_elm_fileselector_button_elm_interface_fileselector_current_name_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
641{
642 if (sd->fs)
643 return elm_fileselector_current_name_get(sd->fs);
644
645 return sd->fsd.current_name;
646}
647
648#define FS_USAGE_API(ret)\
649 if (!pd->fs) \
650 { \
651 ERR("This function is only supported when there is a fileselector"); \
652 return ret; \
653 } \
654
655EOLIAN static Eina_Bool
656_elm_fileselector_button_elm_interface_fileselector_custom_filter_append(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *pd, Elm_Fileselector_Filter_Func func, void *data, const char *filter_name)
657{
658 FS_USAGE_API(EINA_FALSE)
659
660 return elm_interface_fileselector_custom_filter_append(pd->fs, func, data, filter_name);
661}
662
663EOLIAN static Eina_Bool
664_elm_fileselector_button_elm_interface_fileselector_mime_types_filter_append(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *pd, const char *mime_types, const char *filter_name)
665{
666 FS_USAGE_API(EINA_FALSE)
667
668 return elm_interface_fileselector_mime_types_filter_append(pd->fs, mime_types, filter_name);
669}
670
671EOLIAN static void
672_elm_fileselector_button_elm_interface_fileselector_filters_clear(Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *pd)
673{
674 FS_USAGE_API()
675
676 elm_interface_fileselector_filters_clear(pd->fs);
677}
678
679
632EOLIAN static Eina_Bool 680EOLIAN static Eina_Bool
633_elm_fileselector_button_elm_interface_fileselector_hidden_visible_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd) 681_elm_fileselector_button_elm_interface_fileselector_hidden_visible_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd)
634{ 682{
diff --git a/src/lib/elementary/elm_fileselector_button.eo b/src/lib/elementary/elm_fileselector_button.eo
index 545409f229..be3de44d08 100644
--- a/src/lib/elementary/elm_fileselector_button.eo
+++ b/src/lib/elementary/elm_fileselector_button.eo
@@ -18,6 +18,10 @@ class Elm.Fileselector_Button extends Efl.Ui.Button implements Elm.Interface.Fil
18 Elm.Interface.Fileselector.multi_select { get; set; } 18 Elm.Interface.Fileselector.multi_select { get; set; }
19 Elm.Interface.Fileselector.folder_only { get; set; } 19 Elm.Interface.Fileselector.folder_only { get; set; }
20 Elm.Interface.Fileselector.mode { get; set; } 20 Elm.Interface.Fileselector.mode { get; set; }
21 Elm.Interface.Fileselector.current_name { get; set; }
22 Elm.Interface.Fileselector.custom_filter_append;
23 Elm.Interface.Fileselector.mime_types_filter_append;
24 Elm.Interface.Fileselector.filters_clear;
21 } 25 }
22 events { 26 events {
23 /* FIXME: Can be Efl.Model, string and NULL */ 27 /* FIXME: Can be Efl.Model, string and NULL */
diff --git a/src/lib/elementary/elm_widget_fileselector_button.h b/src/lib/elementary/elm_widget_fileselector_button.h
index e055ae10de..86c8b53810 100644
--- a/src/lib/elementary/elm_widget_fileselector_button.h
+++ b/src/lib/elementary/elm_widget_fileselector_button.h
@@ -41,6 +41,7 @@ struct _Elm_Fileselector_Button_Data
41 const char *path; 41 const char *path;
42 Efl_Model *selection; 42 Efl_Model *selection;
43 const char *selection_path; 43 const char *selection_path;
44 const char *current_name;
44 Evas_Coord_Size thumbnail_size; 45 Evas_Coord_Size thumbnail_size;
45 Elm_Fileselector_Mode mode; 46 Elm_Fileselector_Mode mode;
46 Elm_Fileselector_Sort sort_type; 47 Elm_Fileselector_Sort sort_type;
diff --git a/src/tests/elementary/elm_test_fileselector_button.c b/src/tests/elementary/elm_test_fileselector_button.c
index c5bba5ccfa..97db3dcd58 100644
--- a/src/tests/elementary/elm_test_fileselector_button.c
+++ b/src/tests/elementary/elm_test_fileselector_button.c
@@ -26,6 +26,19 @@ EFL_START_TEST (elm_fileselector_button_legacy_type_check)
26} 26}
27EFL_END_TEST 27EFL_END_TEST
28 28
29EFL_START_TEST (elm_fileselector_button_current_name)
30{
31 Evas_Object *win, *fs_button;
32
33 win = win_add(NULL, "fileselector_button", ELM_WIN_BASIC);
34
35 fs_button = elm_fileselector_button_add(win);
36
37 elm_fileselector_current_name_set(fs_button, "test.txt");
38 ck_assert_str_eq(elm_fileselector_current_name_get(fs_button), "test.txt");
39}
40EFL_END_TEST
41
29EFL_START_TEST (elm_atspi_role_get) 42EFL_START_TEST (elm_atspi_role_get)
30{ 43{
31 Evas_Object *win, *fs_button; 44 Evas_Object *win, *fs_button;
@@ -44,5 +57,6 @@ EFL_END_TEST
44void elm_test_fileselector_button(TCase *tc) 57void elm_test_fileselector_button(TCase *tc)
45{ 58{
46 tcase_add_test(tc, elm_fileselector_button_legacy_type_check); 59 tcase_add_test(tc, elm_fileselector_button_legacy_type_check);
60 tcase_add_test(tc, elm_fileselector_button_current_name);
47 tcase_add_test(tc, elm_atspi_role_get); 61 tcase_add_test(tc, elm_atspi_role_get);
48} 62}