diff --git a/src/bin/elementary/test_fileselector.c b/src/bin/elementary/test_fileselector.c index 3568fcdb57..1c23066097 100644 --- a/src/bin/elementary/test_fileselector.c +++ b/src/bin/elementary/test_fileselector.c @@ -511,13 +511,33 @@ _edje_filter(const char *path, Eina_Bool dir, return EINA_FALSE; } +static void +_create_dir_struct(void) +{ + FILE *fp; + if (mkdir("/tmp/test_fs", S_IRWXU) < 0) + printf("make dir /tmp/test_fs failed!\n"); + fp = fopen("/tmp/test_fs/a_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs/k_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs/m_file.txt", "w"); + if (fp) fclose(fp); + + if (mkdir("/tmp/test_fs/a_subdir", S_IRWXU) < 0) + printf("make dir /tmp/test_fs/a_subdir failed!\n"); + fp = fopen("/tmp/test_fs/a_subdir/d_sub_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_fs/a_subdir/j_sub_file.txt", "w"); + if (fp) fclose(fp); +} + void test_fileselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *win, *fs, *box, *vbox, *sep; - const char * home_env; /* Set the locale according to the system pref. * If you don't do so the file selector will order the files list in @@ -538,6 +558,7 @@ test_fileselector(void *data EINA_UNUSED, elm_win_resize_object_add(win, box); evas_object_show(box); + _create_dir_struct(); /* Create a dir struct in /tmp */ fs = elm_fileselector_add(box); evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -548,9 +569,7 @@ test_fileselector(void *data EINA_UNUSED, elm_fileselector_is_save_set(fs, EINA_TRUE); /* make the file list a tree with dir expandable in place */ elm_fileselector_expandable_set(fs, EINA_FALSE); - /* start the fileselector in the home dir */ - home_env = eina_environment_home_get(); - elm_fileselector_path_set(fs, home_env); + elm_fileselector_path_set(fs, "/tmp/test_fs"); /* provides suggested name (just for showing) */ elm_fileselector_current_name_set(fs, "No name"); diff --git a/src/bin/elementary/test_fileselector_button.c b/src/bin/elementary/test_fileselector_button.c index f87db9d0e9..b04e9d38ef 100644 --- a/src/bin/elementary/test_fileselector_button.c +++ b/src/bin/elementary/test_fileselector_button.c @@ -65,7 +65,7 @@ _api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } static void -create_dir_struct(void) +_create_dir_struct(void) { FILE *fp; if (mkdir("/tmp/test_fs_bt", S_IRWXU) < 0) @@ -182,7 +182,7 @@ test_fileselector_button(void *data EINA_UNUSED, elm_box_pack_end(bxx, vbox); - create_dir_struct(); /* Create a dir struct in /tmp */ + _create_dir_struct(); /* Create a dir struct in /tmp */ /* file selector button */ ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); diff --git a/src/bin/elementary/test_fileselector_entry.c b/src/bin/elementary/test_fileselector_entry.c index 07d6cf0fba..3bfd438204 100644 --- a/src/bin/elementary/test_fileselector_entry.c +++ b/src/bin/elementary/test_fileselector_entry.c @@ -65,25 +65,25 @@ _api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } static void -create_dir_struct(void) +_create_dir_struct(void) { FILE *fp; int ret = 0; - ret = mkdir("/tmp/test_fs_bt", S_IRWXU); + ret = mkdir("/tmp/test_fs_en", S_IRWXU); if (ret < 0) return; - fp = fopen("/tmp/test_fs_bt/a_file.txt", "w"); + fp = fopen("/tmp/test_fs_en/a_file.txt", "w"); if (fp) fclose(fp); - fp = fopen("/tmp/test_fs_bt/k_file.txt", "w"); + fp = fopen("/tmp/test_fs_en/k_file.txt", "w"); if (fp) fclose(fp); - fp = fopen("/tmp/test_fs_bt/m_file.txt", "w"); + fp = fopen("/tmp/test_fs_en/m_file.txt", "w"); if (fp) fclose(fp); - ret = mkdir("/tmp/test_fs_bt/a_subdir", S_IRWXU); + ret = mkdir("/tmp/test_fs_en/a_subdir", S_IRWXU); if (ret < 0) return; - fp = fopen("/tmp/test_fs_bt/a_subdir/d_sub_file.txt", "w"); + fp = fopen("/tmp/test_fs_en/a_subdir/d_sub_file.txt", "w"); if (fp) fclose(fp); - fp = fopen("/tmp/test_fs_bt/a_subdir/j_sub_file.txt", "w"); + fp = fopen("/tmp/test_fs_en/a_subdir/j_sub_file.txt", "w"); if (fp) fclose(fp); } @@ -190,14 +190,14 @@ test_fileselector_entry(void *data EINA_UNUSED, elm_box_pack_end(bxx, vbox); - create_dir_struct(); /* Create a dir struct in /tmp */ + _create_dir_struct(); /* Create a dir struct in /tmp */ /* file selector entry */ ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); fs_en = elm_fileselector_entry_add(win); - elm_fileselector_path_set(fs_en, "/tmp/test_fs_bt"); + elm_fileselector_path_set(fs_en, "/tmp/test_fs_en"); elm_object_text_set(fs_en, "Select a file"); elm_object_part_content_set(fs_en, "button icon", ic); evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0); diff --git a/src/bin/elementary/test_panel.c b/src/bin/elementary/test_panel.c index 60ad94edb2..371e6d5541 100644 --- a/src/bin/elementary/test_panel.c +++ b/src/bin/elementary/test_panel.c @@ -83,6 +83,27 @@ _item_del(void *data, Evas_Object *obj EINA_UNUSED) eina_stringshare_del(data); } +static void +_create_dir_struct(void) +{ + FILE *fp; + if (mkdir("/tmp/test_panel", S_IRWXU) < 0) + printf("make dir /tmp/test_panel failed!\n"); + fp = fopen("/tmp/test_panel/a_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_panel/k_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_panel/m_file.txt", "w"); + if (fp) fclose(fp); + + if (mkdir("/tmp/test_panel/a_subdir", S_IRWXU) < 0) + printf("make dir /tmp/test_panel/a_subdir failed!\n"); + fp = fopen("/tmp/test_panel/a_subdir/d_sub_file.txt", "w"); + if (fp) fclose(fp); + fp = fopen("/tmp/test_panel/a_subdir/j_sub_file.txt", "w"); + if (fp) fclose(fp); +} + static void _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc) { @@ -95,7 +116,8 @@ _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc) Eina_Iterator *it; const char *name; - it = eina_file_ls(eina_environment_home_get()); + _create_dir_struct(); + it = eina_file_ls("/tmp/test_panel"); EINA_ITERATOR_FOREACH(it, name) { if (x >= LIST_ITEM_MAX)