static Enna_File * _file_get(const char *uri) { Enna_File *f; char *path; if (strlen(uri) < 7) { path = malloc(2 * sizeof(char)); path[0] = '/'; path[1] = '\0'; } else { path = malloc((strlen(uri + 7) + 1) * sizeof(char)); strncpy(path, uri + 7, strlen(uri + 7) + 1); } if (!ecore_file_exists(path)) return NULL; if (ecore_file_is_dir(path)) { const char *file; const char *label; file = ecore_file_file_get(path); if (!file || file[0] == '\0') { label = eina_stringshare_add("Root"); f = enna_file_directory_add(label, "file:///", path, label, "icon/directory"); eina_stringshare_del(label); } else { f = enna_file_directory_add(file, uri, path, file, "icon/directory"); } } else f = enna_file_file_add(ecore_file_file_get(path), uri, path, ecore_file_file_get(path), "icon/file"); free(path); return f; }
static Volume_Item * volume_dir_scan(char *dir) { Volume_Item *vi; const char *f; vi = calloc(1, sizeof(Volume_Item)); vi->path = strdup(dir); vi->rpath = ecore_file_realpath(vi->path); if (!vi->rpath) { free(vi->path); free(vi); return NULL; } vi->type = "directory"; f = ecore_file_file_get(dir); if (f) { char *c; vi->name = strdup(f); for (c = vi->name; *c; c++) { if (*c == '_') *c = ' '; } } return vi; }
/** * @param file The path to the theme file * @return Return an Eina_List* of Exchange_Theme* * @brief Get the list of all the themes in the given directory */ EAPI Exchange_Object* exchange_local_theme_all_data_get(const char *file) { Exchange_Object *td = NULL; char *name; DBG("0 %s\n", file); if (!file || !ecore_file_exists(file)) return NULL; //EINA_ERROR_PDBG("1 %s\n", file); td = calloc(1, sizeof(Exchange_Object)); if (!td) return NULL; td->id = -1; name = exchange_local_theme_name_get(file); if (name) td->name = name; else td->name = strdup(ecore_file_file_get(file)); td->author = exchange_local_theme_author_get(file); td->license = exchange_local_theme_license_get(file); td->version = exchange_local_theme_version_get(file); td->description[0] = '\0'; td->url = NULL; td->rating = -1; td->user_id = -1; td->thumbnail = NULL; td->screenshot = NULL; td->created_at = NULL; td->updated_at = NULL; return td; }
static Enna_File * _class_vfs_get(void *cookie) { return enna_vfs_create_directory(mod->cdda->uri, ecore_file_file_get(mod->cdda->uri), eina_stringshare_add("icon/cdda"), NULL); }
static void _rename_done_cb(void *data, Eio_File *handler) { Enna_Localfiles_Priv *priv = data; const char *new_path = priv->new_path; const char *new_uri; const char *new_mrl; new_uri = eina_stringshare_printf("%s/%s", ecore_file_dir_get(priv->file_dialog->uri), ecore_file_file_get(new_path)); new_mrl = eina_stringshare_printf("%s/%s", ecore_file_dir_get(priv->file_dialog->mrl), ecore_file_file_get(new_path)); priv->file_dialog->name = eina_stringshare_add(ecore_file_dir_get(new_path)); priv->file_dialog->uri = new_uri; priv->file_dialog->label = eina_stringshare_add(ecore_file_file_get(new_path)); priv->file_dialog->mrl = new_mrl; enna_browser_file_update(priv->browser, priv->file_dialog); eina_stringshare_del(new_path); priv->new_path = NULL; }
char *utils_file_move_in_pres(const char *file) { const char *pres_file = eyelight_object_presentation_file_get(pres); char *dir = ecore_file_dir_get(pres_file); char *res; int ok = 1; int i; //test if file is in a subdirectory of dir for(i=0;i<strlen(dir);i++) { if(i >= strlen(file) || dir[i] != file[i]) { ok = 0; break; } else i++; } if(!ok) { const char* file_name = ecore_file_file_get(file); char buf[PATH_MAX]; res = calloc(PATH_MAX, sizeof(char)); snprintf(buf, PATH_MAX, "%s/images/", dir); if(!ecore_file_exists(buf)) ecore_file_mkdir(buf); snprintf(buf, PATH_MAX, "%s/images/%s", dir, file_name); ecore_file_cp(file, buf); snprintf(res,PATH_MAX,"images/%s", file_name); } else { const char *_file = file + strlen(dir) + 1; res = strdup(_file); } EYELIGHT_FREE(dir); return res; }
/** * @brief Initializer for AtkObjectClass * * @param obj an AtkObject to be initialized * @param data additional initialization data (Evas_Object*) */ static void eail_app_initialize(AtkObject *obj, gpointer data) { int argc; char **argv; EailApp *eail_app = NULL; ATK_OBJECT_CLASS(eail_app_parent_class)->initialize(obj, data); ecore_app_args_get(&argc, &argv); obj->name = argv ? g_strdup((gchar *)ecore_file_file_get(argv[0])) : NULL; obj->role = ATK_ROLE_APPLICATION; obj->accessible_parent = NULL; /* storing last numbers of children to be for checking if children-changed * signal has to be propagated */ eail_app = EAIL_APP(obj); eail_app->child_count_last = atk_object_get_n_accessible_children(obj); }
/** * Find a desktop by exec * * return value must be freed by efreet_desktop_free * * @param exec the exec name * @return a desktop */ EAPI Efreet_Desktop * efreet_util_desktop_exec_find(const char *exec) { char **keys; int num, i; Efreet_Desktop *ret = NULL; if (!efreet_cache_check(&cache, efreet_desktop_util_cache_file(), EFREET_DESKTOP_UTILS_CACHE_MAJOR)) return NULL; if (!exec) return NULL; keys = eet_list(cache, "*::e", &num); if (!keys) return NULL; for (i = 0; i < num; i++) { const char *data, *file; char *exe; int size, id; char key[PATH_MAX]; data = eet_read_direct(cache, keys[i], &size); if (!data) continue; exe = ecore_file_app_exe_get(data); if (!exe) continue; file = ecore_file_file_get(exe); if (!file) continue; if (strcmp(exec, exe) && strcmp(exec, file)) { free(exe); continue; } free(exe); id = atoi(keys[i]); snprintf(key, sizeof(key), "%d::op", id); data = eet_read_direct(cache, key, &size); if (!data) continue; ret = efreet_desktop_get(data); if (ret) break; } free(keys); return ret; }
const char * _ex_file_get(char *path) { if(!path[0]) return NULL; if(path[strlen(path) - 1] == '/' && strlen(path) >= 2) { char *ret; ret = &path[strlen(path) - 2]; while(ret != path) { if(*ret == '/') return ++ret; --ret; } return path; } else return ecore_file_file_get(path); }
static Evry_Item_App * _item_exe_add(Plugin *p, const char *exe, int match) { Evry_Item_App *app = NULL; if ((app = eina_hash_find(p->added, exe))) { if (eina_list_data_find_list(p->base.items, app)) return app; } if (!app) { app = _item_new(p, ecore_file_file_get(exe), exe); app->file = eina_stringshare_ref(EVRY_ITEM(app)->id); } EVRY_ITEM(app)->fuzzy_match = match; EVRY_PLUGIN_ITEM_APPEND(p, app); return app; }
int main(int argc, char **argv) { int i; struct stat st; #ifdef HAVE_REALPATH char rpath[PATH_MAX], rpath2[PATH_MAX]; #endif setlocale(LC_NUMERIC, "C"); ecore_app_no_system_modules(); if (!eina_init()) return -1; _edje_cc_log_dom = eina_log_domain_register ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR); if (_edje_cc_log_dom < 0) { EINA_LOG_ERR("Enable to create a log domain."); exit(-1); } if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN)) eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN); progname = ecore_file_file_get(argv[0]); eina_log_print_cb_set(_edje_cc_log_cb, NULL); tmp_dir = getenv("TMPDIR"); img_dirs = eina_list_append(img_dirs, "."); /* add defines to epp so edc files can detect edje_cc version */ defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12")); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-h")) { main_help(); exit(0); } else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version"))) { printf("Version: %s\n", PACKAGE_VERSION); exit(0); } else if (!strcmp(argv[i], "-v")) { eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO); } else if (!strcmp(argv[i], "-no-lossy")) { no_lossy = 1; } else if (!strcmp(argv[i], "-no-comp")) { no_comp = 1; } else if (!strcmp(argv[i], "-no-raw")) { no_raw = 1; } else if (!strcmp(argv[i], "-no-etc1")) { no_etc1 = 1; } else if (!strcmp(argv[i], "-no-etc2")) { no_etc2 = 1; } else if (!strcmp(argv[i], "-no-save")) { no_save = 1; } else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1))) { i++; img_dirs = eina_list_append(img_dirs, argv[i]); } else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1))) { i++; fnt_dirs = eina_list_append(fnt_dirs, argv[i]); } else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1))) { i++; snd_dirs = eina_list_append(snd_dirs, argv[i]); } else if ((!strcmp(argv[i], "-md") || !strcmp(argv[i], "--mo_dir")) && (i < (argc - 1))) { i++; mo_dirs = eina_list_append(mo_dirs, argv[i]); } else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1))) { i++; vibration_dirs = eina_list_append(vibration_dirs, argv[i]); } else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1))) { i++; data_dirs = eina_list_append(data_dirs, argv[i]); } else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1))) { i++; if (!tmp_dir) tmp_dir = argv[i]; } else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1))) { i++; if (!license) license = argv[i]; else licenses = eina_list_append(licenses, argv[i]); } else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1))) { i++; if (!authors) authors = argv[i]; } else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1))) { i++; min_quality = atoi(argv[i]); if (min_quality < 0) min_quality = 0; if (min_quality > 100) min_quality = 100; } else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1))) { i++; max_quality = atoi(argv[i]); if (max_quality < 0) max_quality = 0; if (max_quality > 100) max_quality = 100; } else if (!strcmp(argv[i], "-fastcomp")) { compress_mode = EET_COMPRESSION_SUPERFAST; } else if (!strcmp(argv[i], "-fastdecomp")) { compress_mode = EET_COMPRESSION_VERYFAST; } else if (!strcmp(argv[i], "-threads")) { threads = 1; } else if (!strcmp(argv[i], "-nothreads")) { threads = 0; } else if (!strncmp(argv[i], "-D", 2)) { defines = eina_list_append(defines, mem_strdup(argv[i])); } else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1))) { i++; file_out = argv[i]; } else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1))) { i++; watchfile = argv[i]; unlink(watchfile); } else if (!strcmp(argv[i], "-annotate")) { annotate = 1; } else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1))) { i++; depfile = argv[i]; unlink(depfile); } else if (!file_in) file_in = argv[i]; else if (!file_out) file_out = argv[i]; } if (!file_in) { ERR("no input file specified."); main_help(); exit(-1); } pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */ main, /* an optional symbol to check path of */ "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */ PACKAGE_BIN_DIR, /* package bin dir @ compile time */ PACKAGE_LIB_DIR, /* package lib dir @ compile time */ PACKAGE_DATA_DIR, /* package data dir @ compile time */ PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */ ); /* check whether file_in exists */ #ifdef HAVE_REALPATH if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode)) #else if (stat(file_in, &st) || !S_ISREG(st.st_mode)) #endif { ERR("file not found: %s.", file_in); main_help(); exit(-1); } if (!file_out) { char *suffix; if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0)) { file_out = strdup(file_in); if (file_out) { suffix = strstr(file_out,".edc"); strcpy(suffix,".edj"); } } } if (!file_out) { ERR("no output file specified."); main_help(); exit(-1); } #ifdef HAVE_REALPATH if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2)) #else if (!strcmp (file_in, file_out)) #endif { ERR("input file equals output file."); main_help(); exit(-1); } using_file(file_in, 'E'); if (annotate) using_file(file_out, 'O'); if (!edje_init()) exit(-1); edje_file = mem_alloc(SZ(Edje_File)); edje_file->compiler = strdup("edje_cc"); edje_file->version = EDJE_FILE_VERSION; edje_file->minor = EDJE_FILE_MINOR; edje_file->feature_ver = 1; /* increment this every time we add a field * or feature to the edje file format that * does not load nicely as a NULL or 0 value * and needs a special fallback initialization */ edje_file->base_scale = FROM_INT(1); source_edd(); source_fetch(); data_setup(); compile(); reorder_parts(); data_process_scripts(); data_process_lookups(); data_process_script_lookups(); data_write(); eina_prefix_free(pfx); pfx = NULL; edje_shutdown(); eina_log_domain_unregister(_edje_cc_log_dom); eina_shutdown(); return 0; }
void media_info_get (xmmsv_t *value, media_info *info) { xmmsv_t *infos, *dict_entry; const char *artist, *album, *title, *url, *comment, *genre, *date; assert(value); assert(info); infos = xmmsv_propdict_to_dict(value, NULL); if (!xmmsv_dict_get (infos, "id", &dict_entry) || !xmmsv_get_int (dict_entry, &info->id)) { info->id = 0; } if (!xmmsv_dict_get (infos, "artist", &dict_entry) || !xmmsv_get_string (dict_entry, &artist)) { artist = "[Unknown Artist]"; } if (!xmmsv_dict_get (infos, "album", &dict_entry) || !xmmsv_get_string (dict_entry, &album)) { album = "[Unknown Album]"; } if (!xmmsv_dict_get (infos, "url", &dict_entry) || !xmmsv_get_string (dict_entry, &url)) { url = "[Unknown URL]"; } if (!xmmsv_dict_get (infos, "title", &dict_entry) || !xmmsv_get_string (dict_entry, &title)) { title = ecore_file_file_get(url); } if (!xmmsv_dict_get (infos, "comment", &dict_entry) || !xmmsv_get_string (dict_entry, &comment)) { comment = ""; } if (!xmmsv_dict_get (infos, "genre", &dict_entry) || !xmmsv_get_string (dict_entry, &genre)) { genre = "[Unknown Genre]"; } if (!xmmsv_dict_get (infos, "date", &dict_entry) || !xmmsv_get_string (dict_entry, &date)) { date = ""; } if (!xmmsv_dict_get (infos, "duration", &dict_entry) || !xmmsv_get_int (dict_entry, &info->duration)) { info->duration = 0; } if (!xmmsv_dict_get (infos, "bitrate", &dict_entry) || !xmmsv_get_int (dict_entry, &info->bitrate)) { info->bitrate = 0; } if (!xmmsv_dict_get (infos, "tracknr", &dict_entry) || !xmmsv_get_int (dict_entry, &info->tracknr)) { info->tracknr = 0; } info->artist = strdup(artist); info->album = strdup(album); info->title = decode_url(title); info->url = decode_url(url); info->comment = strdup(comment); info->genre = strdup(genre); info->date = strdup(date); xmmsv_unref(infos); }
//Update the gui infos about the current media file void eclair_update_current_file_info(Eclair *eclair, Evas_Bool force_cover_update) { char *window_title; char *artist_title_string; const char *filename; Eclair_Media_File *current_file; char string[10]; if (!eclair) return; current_file = eclair_playlist_current_media_file(&eclair->playlist); //Update the name of the current file only if video is created if (eclair->video.video_object) { if (current_file) { if ((artist_title_string = eclair_utils_mediafile_to_artist_title_string(current_file))) { eclair_all_windows_text_set(eclair, "current_media_name", artist_title_string); free(artist_title_string); } else if (current_file->path && eclair_utils_uri_is_mrl(current_file->path)) eclair_all_windows_text_set(eclair, "current_media_name", current_file->path); else if (current_file->path && (filename = ecore_file_file_get(current_file->path))) eclair_all_windows_text_set(eclair, "current_media_name", filename); else eclair_all_windows_text_set(eclair, "current_media_name", "No media opened"); } else eclair_all_windows_text_set(eclair, "current_media_name", "No media opened"); } //Update current media file data if (current_file) { if (current_file->samplerate > 0) { snprintf(string, 10, "%d", current_file->samplerate / 1000); eclair_all_windows_text_set(eclair, "samplerate", string); } else eclair_all_windows_text_set(eclair, "samplerate", "-"); if (current_file->bitrate > 0) { snprintf(string, 10, "%d", current_file->bitrate); eclair_all_windows_text_set(eclair, "bitrate", string); } else eclair_all_windows_text_set(eclair, "bitrate", "-"); } else { eclair_all_windows_text_set(eclair, "samplerate", "-"); eclair_all_windows_text_set(eclair, "bitrate", "-"); } //Update the title of the video window if (eclair->video.video_window) { if (current_file && current_file->path) { window_title = malloc(strlen(current_file->path) + strlen("eclair: ") + 1); sprintf(window_title, "eclair: %s", current_file->path); ecore_evas_title_set(eclair->video.video_window, window_title); free(window_title); } else ecore_evas_title_set(eclair->video.video_window, "eclair"); } //Update the current cover if (current_file) { if (current_file->cover_path || (current_file->cover_path = eclair_cover_file_get_from_local(&eclair->cover_manager, current_file->artist, current_file->album, current_file->path))) eclair_gui_cover_set(eclair, current_file->cover_path, force_cover_update); else eclair_gui_cover_set(eclair, NULL, force_cover_update); } else eclair_gui_cover_set(eclair, NULL, force_cover_update); }
static Enna_File * vfs_get_music(void *cookie) { return enna_vfs_create_directory(mod->music->uri, ecore_file_file_get(mod->music->uri), eina_stringshare_add("icon/music"), NULL); }
static void _dbus_cb_tracklist_metadata(void *data, DBusMessage *reply, DBusError *error) { DBusMessageIter array, item, iter, iter_val; Instance *inst = data; int type, cnt = 0; char *key, *tmp, *location = NULL; int title = 0; Evas_Object *empris = inst->empris; Evas_Object *o_popup = inst->o_popup; if (error) { if (!_dbus_check_msg(reply, error)) { printf("dbus garbage!\n"); goto error; } } edje_object_part_text_set (empris, "empris.artist", ""); edje_object_part_text_set (o_popup, "empris.artist", ""); edje_object_part_text_set (empris, "empris.title", ""); edje_object_part_text_set (o_popup, "empris.title", ""); edje_object_part_text_set (empris, "empris.album", ""); edje_object_part_text_set (o_popup, "empris.album", ""); dbus_message_iter_init(reply, &array); if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) { dbus_message_iter_recurse(&array, &item); while(dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_DICT_ENTRY) { dbus_message_iter_recurse(&item, &iter); if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) { dbus_message_iter_get_basic(&iter, &key); } else { printf("not string{n"); goto error; } dbus_message_iter_next(&iter); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) { printf("not variant\n"); goto error; } if (!strcmp(key, "artist")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.artist", tmp); edje_object_part_text_set (o_popup, "empris.artist", tmp); } } else if (!strcmp(key, "title")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.title", tmp); edje_object_part_text_set (o_popup, "empris.title", tmp); title = 1; } } else if (!strcmp(key, "location")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { location = strdup(tmp); } } else if (!strcmp(key, "album")) { dbus_message_iter_recurse (&iter, &iter_val); dbus_message_iter_get_basic (&iter_val, &tmp); if (tmp && tmp[0]) { edje_object_part_text_set (empris, "empris.album", tmp); edje_object_part_text_set (o_popup, "empris.album", tmp); } } /* else if (!strcmp(key, "mtime")) * { * dbus_message_iter_recurse (&iter, &iter_val); * dbus_message_iter_get_basic (&iter_val, &(t->length)); * } */ dbus_message_iter_next(&item); } } if (!title && location) { char *tmp = _util_unescape(ecore_file_file_get(location), 0); if (tmp) { edje_object_part_text_set (empris, "empris.title", tmp); edje_object_part_text_set (o_popup, "empris.title", tmp); free(tmp); } free(location); } error: return; }
int ewallset_main() { Evas_Object *win, *bg, *bx, *bx2, *bx3, *bt, *ic, *image , *frame, *rd, *rdg,*sl; int tw,th; char buf[1024]; e->win = elm_win_add(NULL, "Ewallset", ELM_WIN_BASIC); elm_win_autodel_set(e->win, 1); evas_object_focus_set(e->win, 1); evas_object_smart_callback_add(e->win, "delete,request", usr_click_cancel, NULL); bg = elm_bg_add(e->win); elm_win_resize_object_add(e->win, bg); evas_object_size_hint_weight_set(bg, 1.0, 1.0); evas_object_show(bg); bx = elm_box_add(e->win); evas_object_size_hint_weight_set(bx, 1.0, 1.0); elm_win_resize_object_add(e->win,bx); evas_object_show(bx); image = elm_image_add(bx); elm_image_file_set(image, e->image_file, NULL); evas_object_size_hint_weight_set(image, 1.0, 1.0); evas_object_size_hint_align_set(image, -1.0, -1.0); elm_image_object_size_get(image,&e->w,&e->h); get_correct_size(410,e->w,e->h,&tw,&th,BY_HEIGHT); //printf("Res:%dx%d \n",e->w,e->h); //_get_correct_size(w,h,&tw,&th); evas_object_size_hint_min_set(image, tw, th); elm_box_pack_end(bx, image); evas_object_show(image); snprintf(buf, sizeof(buf), "Ewallset - %s", ecore_file_file_get(e->image_file)); elm_win_title_set(e->win, buf); e->quality = 90; sl = elm_slider_add(e->win); elm_slider_indicator_show_set(sl, EINA_FALSE); elm_object_text_set(sl, "Quality"); elm_slider_unit_format_set(sl, "%1.0f Percent"); elm_slider_span_size_set(sl, 250); elm_slider_min_max_set(sl, 10, 100); elm_slider_value_set(sl, e->quality); evas_object_smart_callback_add(sl, "delay,changed", slider_change_cb, NULL); evas_object_size_hint_align_set(sl, 0.5, 0.5); evas_object_size_hint_weight_set(sl, 0.0, 0.0); elm_box_pack_end(bx, sl); evas_object_show(sl); frame = elm_frame_add(e->win); elm_object_text_set(frame,"Where to place this Wallpaper"); elm_object_style_set(frame,"outdent_bottom"); elm_box_pack_end(bx, frame); evas_object_show(frame); bx3 = elm_box_add(e->win); elm_box_horizontal_set(bx3, 1); elm_object_content_set(frame,bx3); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, 0); elm_object_text_set(rd, "All Desktops"); evas_object_smart_callback_add(rd, "changed", desk_changed,e->rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); e->rdg = rd; rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, 1); elm_radio_group_add(rd, e->rdg); elm_object_text_set(rd, "This Desktop"); evas_object_smart_callback_add(rd, "changed", desk_changed,e->rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, 2); elm_radio_group_add(rd, e->rdg); elm_object_text_set(rd, "This Screen"); evas_object_smart_callback_add(rd, "changed", desk_changed,e->rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); ecore_timer_add(0.1,get_config_timer,NULL); frame = elm_frame_add(e->win); elm_object_text_set(frame,"Fill and Stretch Options"); elm_object_style_set(frame,"outdent_top"); elm_box_pack_end(bx, frame); evas_object_show(frame); bx3 = elm_box_add(e->win); elm_box_horizontal_set(bx3, 1); elm_box_homogeneous_set(bx3, EINA_TRUE); elm_object_content_set(frame,bx3); evas_object_show(bx3); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_STRETCH); elm_object_text_set(rd, "Stretch"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rdg = rd; rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_TILE); elm_radio_group_add(rd, rdg); elm_object_text_set(rd, "Tile"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_CENTER); elm_radio_group_add(rd, rdg); elm_object_text_set(rd, "Center"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_SCALE_ASPECT_IN); elm_radio_group_add(rd, rdg); elm_object_text_set(rd, "Within"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_SCALE_ASPECT_OUT); elm_radio_group_add(rd, rdg); elm_object_text_set(rd, "Fill"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); rd = elm_radio_add(e->win); elm_radio_state_value_set(rd, IMPORT_SCALE_ASPECT_IN_TILE); elm_radio_group_add(rd, rdg); elm_object_text_set(rd, "Tile-In"); evas_object_smart_callback_add(rd, "changed", selection_changed,rdg); elm_box_pack_end(bx3, rd); evas_object_show(rd); elm_radio_value_set(rdg, 0); bx2 = elm_box_add(e->win); elm_box_horizontal_set(bx2, 1); elm_box_homogeneous_set(bx2, EINA_TRUE); elm_box_pack_end(bx, bx2); evas_object_show(bx2); ic = elm_icon_add(e->win); elm_icon_file_set(ic, "/usr/share/ewallset/data/dialog-ok.png", NULL); bt = elm_button_add(bx2); elm_object_text_set(bt, "Continue"); //elm_button_icon_set(bt, ic); evas_object_smart_callback_add(bt, "clicked", usr_click_ok, NULL); elm_box_pack_end(bx2, bt); evas_object_show(bt); ic = elm_icon_add(e->win); elm_icon_file_set(ic, "/usr/share/ewallset/data/dialog-cancel.png", NULL); bt = elm_button_add(bx2); elm_object_text_set(bt, "Cancel"); //elm_button_icon_set(bt, ic); evas_object_smart_callback_add(bt, "clicked", usr_click_cancel, NULL); elm_box_pack_end(bx2, bt); evas_object_show(bt); evas_object_show(e->win); //evas_object_del(e->win); return 0; }
static Volume_Item * volume_file_scan(char *file) { Volume_Item *vi; char *ext; vi = calloc(1, sizeof(Volume_Item)); vi->path = strdup(file); vi->rpath = ecore_file_realpath(vi->path); printf("%s -> %s\n", vi->path, vi->rpath); if (!vi->rpath) { free(vi->path); free(vi); return NULL; } ext = strrchr(vi->path, '.'); if (!ext) { free(vi->path); free(vi->rpath); free(vi); return NULL; } ext++; if ((!strcasecmp(ext, "avi")) || (!strcasecmp(ext, "mov")) || (!strcasecmp(ext, "mpg")) || (!strcasecmp(ext, "mpeg")) || (!strcasecmp(ext, "vob")) || (!strcasecmp(ext, "wmv")) || (!strcasecmp(ext, "asf")) || (!strcasecmp(ext, "mng")) || (!strcasecmp(ext, "3gp")) || (!strcasecmp(ext, "wmx")) || (!strcasecmp(ext, "wvx")) || (!strcasecmp(ext, "mp4")) || (!strcasecmp(ext, "mpe")) || (!strcasecmp(ext, "qt")) || (!strcasecmp(ext, "fli")) || (!strcasecmp(ext, "dv")) || (!strcasecmp(ext, "asx")) || (!strcasecmp(ext, "wm")) || (!strcasecmp(ext, "lsf")) || (!strcasecmp(ext, "movie") || (!strcasecmp(ext, "mkv"))) ) { vi->type = "video"; video_count++; } else if ((!strcasecmp(ext, "mp3")) || (!strcasecmp(ext, "ogg")) || (!strcasecmp(ext, "aac")) || (!strcasecmp(ext, "wav")) ) { vi->type = "audio"; audio_count++; } else if ((!strcasecmp(ext, "jpg")) || (!strcasecmp(ext, "jpeg")) || (!strcasecmp(ext, "jpe")) || (!strcasecmp(ext, "jfif")) ) { vi->type = "photo"; photo_count++; } else { free(vi->path); free(vi); return NULL; } /* FIXME: get name and genre from local "database" first - if this doesn't * hold the info we want - then invent it from the filesystem */ /* 1. look for full path in db */ /* 2. look for just filename in db */ /* invent the data */ if (!vi->name) { const char *f; /* guess name from filename minus extension with _ converted to space */ f = ecore_file_file_get(file); if (f) { char *c; vi->name = strdup(f); c = strrchr(vi->name, '.'); if (c) *c = 0; for (c = vi->name; *c; c++) { if (*c == '_') *c = ' '; } } } if (!vi->genre) { char *f; /* guess genre from parent directory name with _ converted to space */ f = ecore_file_dir_get(file); if (f) { char *c, *ff; ff = ecore_file_dir_get(f); if (ff) { char buf[4096]; snprintf(buf, sizeof(buf), "%s/%s", ecore_file_file_get(ff), ecore_file_file_get(f)); for (c = buf; *c; c++) { if (*c == '_') *c = ' '; } vi->genre = eina_stringshare_add(buf); free(ff); } else { vi->genre = eina_stringshare_add(f); } free(f); } else vi->genre = eina_stringshare_add("Unknown"); } ecore_event_add(VOLUME_TYPE_ADD, strdup(vi->path), NULL, NULL); /* FIXME: check last played and play count db entry */ return vi; }
static Enna_File * vfs_get_video(void *cookie) { return enna_vfs_create_directory(mod->video->uri, ecore_file_file_get(mod->video->uri), eina_stringshare_add("icon/video"), NULL); }
/** * @param uri: The local uri to move in the trash * @param force_delete: If you set this to 1 than files on different filesystems * will be deleted permanently * @return Return 1 on success, 0 on failure or -1 in case the uri is not on the * same filesystem and force_delete is not set. * @brief This function try to move the given uri to the trash. Files on * different filesystem can't be moved to trash. If force_delete * is 0 than non-local files will be ignored and -1 is returned, if you set * force_delete to 1 non-local files will be deleted without asking. */ EAPI int efreet_trash_delete_uri(Efreet_Uri *uri, int force_delete) { char dest[PATH_MAX]; char times[64]; const char *fname; const char *escaped; const char *trash_dir; int i = 1; time_t now; FILE *f; if (!uri || !uri->path || !ecore_file_can_write(uri->path)) return 0; fname = ecore_file_file_get(uri->path); trash_dir = efreet_trash_dir_get(uri->path); if (!trash_dir) { ERR("EFREET TRASH ERROR: No trash directory."); return 0; } snprintf(dest, sizeof(dest), "%s/files/%s", trash_dir, fname); /* search for a free filename */ while (ecore_file_exists(dest) && (i < 100)) snprintf(dest, sizeof(dest), "%s/files/%s$%d", trash_dir, fname, i++); fname = ecore_file_file_get(dest); /* move file to trash dir */ if (rename(uri->path, dest)) { if (errno == EXDEV) { if (!force_delete) { eina_stringshare_del(trash_dir); return -1; } if (!ecore_file_recursive_rm(uri->path)) { ERR("EFREET TRASH ERROR: Can't delete file."); eina_stringshare_del(trash_dir); return 0; } } else { ERR("EFREET TRASH ERROR: Can't move file to trash."); eina_stringshare_del(trash_dir); return 0; } } /* create info file */ snprintf(dest, sizeof(dest), "%s/info/%s.trashinfo", trash_dir, fname); if ((f = fopen(dest, "w"))) { fputs("[Trash Info]\n", f); //TODO is '\n' right?? (or \r\c??) fputs("Path=", f); escaped = efreet_uri_encode(uri); fputs(escaped + 7, f); // +7 == don't write 'file://' IF_RELEASE(escaped); time(&now); strftime(times, sizeof(times), "%Y-%m-%dT%H:%M:%S", localtime(&now)); fputs("\nDeletionDate=", f); fputs(times, f); fputs("\n", f); fclose(f); } else { ERR("EFREET TRASH ERROR: Can't create trash info file."); return 0; } return 1; }
static void usr_click_ok(void *data, Evas_Object *obj, void *event_info) { evas_object_del(e->win); FILE *f; int fd,sw,sh; char enc[128]; char *path, *bs_name, cmd[1024],bg_file[1024],set_bg[1024], *home; const char *image_file; home = getenv("HOME"); path = ecore_file_dir_get(e->image_file); image_file = ecore_file_file_get(e->image_file); bs_name = ecore_file_strip_ext(image_file); get_correct_size(900,e->w,e->h,&sw,&sh,BY_WIDTH); if ( e->quality > 99.5 ) snprintf(enc, sizeof(enc), "COMP"); else snprintf(enc, sizeof(enc), "LOSSY %1.0f", e->quality); //printf ("ENC:%s \n",enc); strcpy(e->tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX"); fd = mkstemp(e->tmpn); close(fd); f = fopen(e->tmpn, "w"); switch (e->sel) { case IMPORT_STRETCH: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"0\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,image_file); break; case IMPORT_TILE: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"1\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "fill { size {\n" "relative: 0.0 0.0;\n" "offset: %i %i;\n" "} } } } } } }\n",image_file,enc,e->w,e->h,image_file,e->w,e->h); break; case IMPORT_CENTER: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"2\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "min: %i %i; max: %i %i;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,e->w,e->h,e->w,e->h,image_file); break; case IMPORT_SCALE_ASPECT_IN: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"3\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "aspect: %1.9f %1.9f; aspect_preference: BOTH;\n" "image { normal: \"%s\"; }\n" "} } } } }\n",image_file,enc,e->w,e->h,(double)e->w / (double)e->h,(double)e->w / (double)e->h,image_file); break; case IMPORT_SCALE_ASPECT_OUT: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"4\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "aspect: %1.9f %1.9f; aspect_preference: NONE;\n" "} } } } }\n",image_file,enc,e->w,e->h,image_file,(double)e->w / (double)e->h,(double)e->w / (double)e->h); break; case IMPORT_SCALE_ASPECT_IN_TILE: fprintf(f,"//Created by PrinceAMD\n" "images { image: \"%s\" %s; }\n" "collections {\n" "group { name: \"e/desktop/background\";\n" "data { item: \"style\" \"1\"; }\n" "max: %i %i;\n" "parts {\n" "part { name: \"bg\"; mouse_events: 0;\n" "description { state: \"default\" 0.0;\n" "image { normal: \"%s\"; }\n" "fill { size {\n" "relative: 0.0 0.0;\n" "offset: %i %i;\n" "} } } } } } }\n",image_file,enc,e->w,e->h,image_file,sw,sh); break; default: /*seriously ?*/ break; } fclose(f); if (strcmp(path, image_file)) { snprintf(cmd, sizeof(cmd), "cd \"%s\" && edje_cc %s $HOME/.e/e/backgrounds/\"%s\".edj",path,e->tmpn,bs_name); } else { snprintf(cmd, sizeof(cmd), "edje_cc %s $HOME/.e/e/backgrounds/\"%s\".edj",e->tmpn,bs_name); } snprintf(set_bg, sizeof(set_bg), "%s/.e/e/backgrounds/%s.edj",home,bs_name); e->edj = eina_stringshare_add(set_bg); Ecore_Exe *exe; exe = ecore_exe_run(cmd, NULL); ecore_timer_add(0.1,set_bg_timer,NULL); //need code here to end the window session. }