void image_browser_populate(void) { Eina_List *l, *images; char buf[4096]; etk_iconbox_clear(ETK_ICONBOX(UI_ImageBrowserIconbox)); etk_iconbox_freeze(ETK_ICONBOX(UI_ImageBrowserIconbox)); images = l = edje_edit_images_list_get(edje_o); while (l) { snprintf(buf,4096,"images/%d",edje_edit_image_id_get(edje_o, (char*)l->data)); etk_iconbox_append(ETK_ICONBOX(UI_ImageBrowserIconbox), Cur.edj_temp_name->string, buf, (char*)l->data); l = l->next; } edje_edit_string_list_free(images); etk_iconbox_thaw(ETK_ICONBOX(UI_ImageBrowserIconbox)); }
/* Sets the folder displayed in the iconbox */ static void _etk_test_iconbox_folder_set(Etk_Iconbox *iconbox, const char *folder) { Eina_List *files; Eina_List *l; char *filename; char file_path[PATH_MAX]; Etk_Iconbox_Icon *iicon; if (!iconbox) return; if (!folder && !(folder = getenv("HOME"))) return; if (!(files = ecore_file_ls(folder))) return; etk_iconbox_clear(iconbox); etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "actions/go-up_48", ".."); /* First, add the folders */ EINA_LIST_FOREACH(files, l, filename) { if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (!ecore_file_is_dir(file_path)) continue; iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "places/folder_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); } /* Then the files */ EINA_LIST_FOREACH(files, l, filename) { const char *ext; char *icon = NULL; int i; if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (ecore_file_is_dir(file_path)) continue; if ((ext = strrchr(filename, '.')) && (ext = ext + 1)) { for (i = 0; i < _etk_test_iconbox_num_types; i++) { if (strcasecmp(ext, _etk_test_iconbox_types[i].extension) == 0) { icon = _etk_test_iconbox_types[i].icon; break; } } } iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), icon ? icon : "mimetypes/text-x-generic_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); else if (ecore_file_can_exec(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "system"); } EINA_LIST_FREE(files, filename) free(filename); if (!_etk_test_iconbox_current_folder) _etk_test_iconbox_current_folder = etk_string_new(NULL); etk_string_set(_etk_test_iconbox_current_folder, folder); etk_window_title_set(ETK_WINDOW(win), folder); }