EAPI int ensure_bug(struct enobj *enobj, enum ensure_severity sev, const char *type, const char *fmt, ...) { char *buf; struct bug *bug; int len; va_list ap; assert(enobj); va_start(ap, fmt); len = vsnprintf(NULL, 0, fmt, ap); va_end(ap); if (len < 0) { printf("Huh?"); abort(); } len++; buf = malloc(len); va_start(ap, fmt); vsnprintf(buf, len, fmt, ap); va_end(ap); bug = calloc(1, sizeof(struct bug)); bug->severity = sev; bug->desc = buf; bug->type = eina_stringshare_add(type); enobj->bugs = eina_list_prepend(enobj->bugs, bug); return 0; }
EAPI Evas_GL_Surface * evas_gl_surface_create(Evas_GL *evas_gl, Evas_GL_Config *config, int width, int height) { Evas_GL_Surface *surf; MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL); return NULL; MAGIC_CHECK_END(); if (!config) { ERR("Invalid Config\n"); return NULL; } surf = calloc(1, sizeof(Evas_GL_Surface)); if (!surf) return NULL; surf->data = evas_gl->evas->engine.func->gl_surface_create(evas_gl->evas->engine.data.output, config, width, height); if (!surf->data) { ERR("Failed creating a surface from the engine\n"); free(surf); return NULL; } // Keep track of the surface creations evas_gl->surfaces = eina_list_prepend(evas_gl->surfaces, surf); return surf; }
Enlil_IPTC_Job * enlil_iptc_job_prepend(Enlil_Photo *photo, Enlil_IPTC_Done_Cb cb, void *data) { ASSERT_RETURN(photo != NULL); Eina_List *l; Enlil_IPTC_Job *job; EINA_LIST_FOREACH(l_jobs, l, job) if(job->photo == photo) break; if(!job) { job = calloc(1, sizeof(Enlil_IPTC_Job)); job->photo = photo; job->cb = cb; job->data = data; } else l_jobs = eina_list_remove(l_jobs, job); l_jobs = eina_list_prepend(l_jobs, job); _job_next(); return job; }
static void toggle_floating(E_Border *bd) { if (!bd || !_G.tinfo) return; if (eina_list_data_find(_G.tinfo->floating_windows, bd) == bd) { _G.tinfo->floating_windows = eina_list_remove(_G.tinfo->floating_windows, bd); if (!tiling_g.config->dont_touch_borders && tiling_g.config->tiling_border && (!bd->bordername || strcmp(bd->bordername, tiling_g.config->tiling_border))) change_window_border(bd, tiling_g.config->tiling_border); e_border_idler_before(); rearrange_windows(bd, 0); } else { int w = bd->w, h = bd->h; /* To give the user a bit of feedback we restore the original border */ /* TODO: save the original border, don't just restore the default one */ _G.tinfo->floating_windows = eina_list_prepend(_G.tinfo->floating_windows, bd); if (!tiling_g.config->dont_touch_borders && tiling_g.config->floating_border && (!bd->bordername || strcmp(bd->bordername, tiling_g.config->floating_border))) change_window_border(bd, tiling_g.config->floating_border); e_border_idler_before(); e_border_resize(bd, w, h); } }
void utils_slide_insert(List_Item *item_prev) { List_Item *item = calloc(1, sizeof(List_Item)); Eina_List *l; List_Item *_item; int i_prev = -1; if(item_prev) { i_prev = 0; EINA_LIST_FOREACH(l_slides, l, _item) { if(item_prev == _item) break; else i_prev++; } } if(!item_prev) l_slides = eina_list_prepend(l_slides, item); else l_slides = eina_list_append_relative(l_slides, item, item_prev); eyelight_edit_slide_insert(eyelight_object_pres_get(pres), i_prev); slides_grid_append_relative(item, item_prev); slides_list_slide_append_relative(item, item_prev); }
/* externally accessible functions */ EAPI void e_canvas_add(Ecore_Evas *ee) { Evas *e; _e_canvases = eina_list_prepend(_e_canvases, ee); e = ecore_evas_get(ee); evas_image_cache_set(e, e_config->image_cache * 1024); evas_font_cache_set(e, e_config->font_cache * 1024); e_path_evas_append(path_fonts, e); if (e_config->font_hinting == 0) { if (evas_font_hinting_can_hint(e, EVAS_FONT_HINTING_BYTECODE)) evas_font_hinting_set(e, EVAS_FONT_HINTING_BYTECODE); else if (evas_font_hinting_can_hint(e, EVAS_FONT_HINTING_AUTO)) evas_font_hinting_set(e, EVAS_FONT_HINTING_AUTO); else evas_font_hinting_set(e, EVAS_FONT_HINTING_NONE); } else if (e_config->font_hinting == 1) { if (evas_font_hinting_can_hint(e, EVAS_FONT_HINTING_AUTO)) evas_font_hinting_set(e, EVAS_FONT_HINTING_AUTO); else evas_font_hinting_set(e, EVAS_FONT_HINTING_NONE); } else if (e_config->font_hinting == 2) evas_font_hinting_set(e, EVAS_FONT_HINTING_NONE); }
int main(int argc, char **argv) { int cache_strategy, cache_metric, cache_size, help; Eina_List *filters = NULL, *list_iter; Filter *f, *last, *load, *sink; char *file = NULL; int verbose; lime_init(); if (parse_cli(argc, argv, &filters, NULL, &cache_size, &cache_metric, &cache_strategy, &file, NULL, &verbose, &help)) return EXIT_FAILURE; if (help) { print_help(); return EXIT_SUCCESS; } print_init_info(NULL, cache_size, cache_metric, cache_strategy, NULL); lime_cache_set(cache_size, cache_strategy | cache_metric); if (!strcmp(((Filter*)eina_list_data_get(filters))->fc->shortname, "load")) { load = eina_list_data_get(filters); if (file) lime_setting_string_set(load, "filename", file); } else { if (!file) { printf("ERROR: need file to execute filter chain!\n"); return EXIT_FAILURE; } load = lime_filter_new("load"); lime_setting_string_set(load, "filename", file); filters = eina_list_prepend(filters, load); } last = NULL; EINA_LIST_FOREACH(filters, list_iter, f) { if (last) lime_filter_connect(last, f); last = f; } sink = last; lime_render(sink); cache_stats_print(); lime_shutdown(); return 0; }
EAPI void e_layout_child_lower(Evas_Object *obj) { E_Layout_Item *li; li = evas_object_data_get(obj, "e_layout_data"); if (!li) return; if (!eina_list_data_find(li->sd->items, obj)) return; if ((li->sd->items) && eina_list_next(li->sd->items)) { li->sd->items = eina_list_remove(li->sd->items, obj); evas_object_lower(obj); li->sd->items = eina_list_prepend(li->sd->items, obj); } }
void _elm_code_widget_undo_change_add(Evas_Object *widget, Elm_Code_Widget_Change_Info *info) { Elm_Code_Widget_Data *pd; Elm_Code_Widget_Change_Info *info_copy; info_copy = _elm_code_widget_undo_info_copy(info); pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); _elm_code_widget_undo_prev_clear(widget); pd->undo_stack_ptr = eina_list_prepend(pd->undo_stack_ptr, info_copy); pd->undo_stack = pd->undo_stack_ptr; }
EAPI void efreet_icon_extension_add(const char *ext) { Eina_List *l; EINA_SAFETY_ON_NULL_RETURN(ext); ext = eina_stringshare_add(ext); if ((l = eina_list_data_find_list(efreet_icon_extensions, ext))) { efreet_icon_extensions = eina_list_promote_list(efreet_icon_extensions, l); eina_stringshare_del(ext); } else efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, ext); }
static int _mixer_callback_add(E_Mixer_System *self, int (*func)(void *data, E_Mixer_System *self), void *data) { struct e_mixer_callback_desc *desc; struct pollfd *pfds; int len; len = snd_mixer_poll_descriptors_count(self); if (len <= 0) return 0; desc = malloc(sizeof(struct e_mixer_callback_desc)); if (!desc) return 0; desc->func = func; desc->data = data; desc->self = self; desc->idler = NULL; desc->handlers = NULL; pfds = alloca(len * sizeof(struct pollfd)); len = snd_mixer_poll_descriptors(self, pfds, len); if (len <= 0) { free(desc); return 0; } while (len > 0) { Ecore_Fd_Handler *fd_handler; len--; fd_handler = ecore_main_fd_handler_add( pfds[len].fd, ECORE_FD_READ, _cb_fd_handler, desc, NULL, NULL); desc->handlers = eina_list_prepend(desc->handlers, fd_handler); } snd_mixer_set_callback_private(self, desc); return 1; }
/** * @brief Pushs a new message on the statusbar's message-stack * @param statusbar a statusbar * @param message the message to push * @param context_id the context-id to associate to the message. * You can generate a context-id with @a etk_statusbar_context_id_get() * @return Returns the message-id of the message, or -1 on failure */ int etk_statusbar_message_push(Etk_Statusbar *statusbar, const char *message, int context_id) { Etk_Statusbar_Msg *new_msg; if (!statusbar || !message) return -1; new_msg = malloc(sizeof(Etk_Statusbar_Msg)); new_msg->msg = strdup(message); new_msg->context_id = context_id; new_msg->message_id = statusbar->next_message_id++; statusbar->msg_stack = eina_list_prepend(statusbar->msg_stack, new_msg); _etk_statusbar_update(statusbar); etk_object_notify(ETK_OBJECT(statusbar), "current-message"); return new_msg->message_id; }
EAPI Evas_GL_Context * evas_gl_context_create(Evas_GL *evas_gl, Evas_GL_Context *share_ctx) { Evas_GL_Context *ctx; // Magic MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL); return NULL; MAGIC_CHECK_END(); // Allocate a context object ctx = calloc(1, sizeof(Evas_GL_Context)); if (!ctx) { ERR("Unable to create a Evas_GL_Context object"); return NULL; } // Call engine->gl_create_context if (share_ctx) { ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, share_ctx->data); } else { ctx->data = evas_gl->evas->engine.func->gl_context_create(evas_gl->evas->engine.data.output, NULL); } // Set a few variables if (!ctx->data) { ERR("Failed creating a context from the engine."); free(ctx); return NULL; } // Keep track of the context creations evas_gl->contexts = eina_list_prepend(evas_gl->contexts, ctx); return ctx; }
/* * etox_line_prepend - prepend a bit to a line * @line: the line to prepend the bit * @bit: the bit to prepend to the line * * Returns no value. Prepends the bit @bit to the line @line and updates * display to reflect the change. */ void etox_line_prepend(Etox_Line * line, Evas_Object * bit) { Evas_Coord x, y, w, h; CHECK_PARAM_POINTER("line", line); CHECK_PARAM_POINTER("bit", bit); /* * Prepend the text and update necessary fields */ line->bits = eina_list_prepend(line->bits, bit); evas_object_geometry_get(bit, &x, &y, &w, &h); line->w += w; if (h > line->h) line->h = h; line->length += etox_style_length(bit); etox_selections_update(bit, line); }
static Eina_Bool _elixir_eet_release(const Elixir_Loader_File *file) { Elixir_Eet_Filename *lookup; Eina_List *last; /* LRU must never be bigger than 8 file. */ if (eina_list_count(lru) > 8) { last = eina_list_last(lru); lookup = eina_list_data_get(last); eina_hash_del(cache, lookup->filename, lookup); lru = eina_list_remove_list(lru, last); } file->file->reference--; lookup = eina_hash_find(cache, file->file->filename); if (lookup == file->file) lru = eina_list_prepend(lru, file->file); else if (file->file->reference < 0) { eet_close(file->file->eet); free(file->file->filename); free(file->file); } if (stack && eina_array_count_get(stack) > 0) eina_array_pop(stack); if (file->free_content) free(file->content); if (file->free_compiled) free(file->compiled); free(file->section); free((void*) file); return EINA_TRUE; }
/* * etox_line_merge_prepend - merge lines into the second line, empty the first * @line1: the destination of the merged lines * @line2: the line that will be merged with line1 * * Returns no value. Moves the bits from line2 into line 1. */ void etox_line_merge_prepend(Etox_Line * line1, Etox_Line * line2) { Evas_Object *bit; CHECK_PARAM_POINTER("line1", line1); CHECK_PARAM_POINTER("line2", line2); /* * Move the bits from line2 to line1. */ while (line1->bits) { bit = line1->bits->data; line2->bits = eina_list_prepend(line2->bits, bit); line1->bits = eina_list_remove(line1->bits, bit); line2->length += etox_style_length(bit); } /* * Adjust the height, width and length of the merged line. */ line2->w += line1->w; if (line1->h > line2->h) line2->h = line1->h; }
static void _elm_code_file_line_insert_data(Elm_Code_File *file, const char *content, unsigned int length, unsigned int row, Eina_Bool mapped, void *data) { Elm_Code_Line *line, *after; line = _elm_code_file_line_blank_create(file, row, data); if (!line) return; if (mapped) { line->content = content; line->length = length; } else { line->modified = malloc(sizeof(char)*(length+1)); strncpy(line->modified, content, length); line->modified[length] = 0; line->length = length; } if (row == 1) file->lines = eina_list_prepend(file->lines, line); else if (row == eina_list_count(file->lines) + 1) file->lines = eina_list_append(file->lines, line); else { after = eina_list_nth(file->lines, row - 2); file->lines = eina_list_append_relative(file->lines, line, after); } if (file->parent) { _elm_code_parse_line(file->parent, line); elm_code_callback_fire(file->parent, &ELM_CODE_EVENT_LINE_LOAD_DONE, line); } }
//--// callbacks static int _dnd_sorter(const void *d1, const void *d2) { Evas_Object *o1 = (Evas_Object *)d1; Evas_Object *o2 = (Evas_Object *)d2; Eina_List *o1l = NULL, *o2l = NULL, *l1, *l2, *list, *l; Evas_Object *common = NULL, *o; while (o1) { o1l = eina_list_prepend(o1l, o1); o1 = evas_object_smart_parent_get(o1); } while (o2) { o2l = eina_list_prepend(o2l, o2); o2 = evas_object_smart_parent_get(o2); } o1 = o1l->data; o2 = o2l->data; if (o1 != o2) { // different toplevels o = evas_object_bottom_get(evas_object_evas_get(o1)); while (o) { if (o1 == o) { // o1 below o2 eina_list_free(o1l); eina_list_free(o2l); return -1; } if (o2 == o) { // o2 below o1 eina_list_free(o1l); eina_list_free(o2l); return 1; } o = evas_object_above_get(o); } } for (l1 = o1l, l2 = o2l; l1 && l2; l1 = l1->next, l2 = l2->next) { o1 = l1->data; o2 = l2->data; if (o1 != o2) { // children differ, thus parent is common list = evas_object_smart_members_get(common); for (l = list; l; l = l->next) { o = l->data; if (o1 == o) { // o1 below o2 eina_list_free(list); eina_list_free(o1l); eina_list_free(o2l); return -1; } if (o2 == o) { // o2 below o1 eina_list_free(list); eina_list_free(o1l); eina_list_free(o2l); return 1; } } eina_list_free(list); break; } common = o1; } eina_list_free(o1l); eina_list_free(o2l); return 0; }
/** * @param path: The path to the directory to read * @param show_dot: TRUE shows dot files, FALSE does not * @param show_dot_dot: TRUE shows .. for navigating upwards, FALSE does not * @param filter: The Ewl_Filelist_Filter to use * @return Returns an Ewl_Filelist_Directory structure * @brief Retrieves all files in a directory */ Ewl_Filelist_Directory * ewl_filelist_model_directory_new(const char *path, unsigned char show_dot, unsigned int show_dot_dot, Ewl_Filelist_Filter *filter) { Ewl_Filelist_Directory *dir; Ewl_Filelist_File *file; char filename[PATH_MAX], *file_temp; int nf = 0, nd = 0; Eina_List *all_files; Ecore_List *dirs, *files; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(path, NULL); files = ecore_list_new(); dirs = ecore_list_new(); ecore_list_free_cb_set(files, ECORE_FREE_CB(ewl_filelist_file_destroy)); ecore_list_free_cb_set(dirs, ECORE_FREE_CB(ewl_filelist_file_destroy)); all_files = ecore_file_ls(path); if (!all_files) DRETURN_PTR(NULL, DLEVEL_STABLE); /* Add in the ".." entry for now */ if ((show_dot_dot) && (strcmp(path, "/"))) all_files = eina_list_prepend(all_files, strdup(path)); EINA_LIST_FREE(all_files, file_temp) { /* allocate the memory for the file structure */ file = ewl_filelist_file_new(); if (!file) { ecore_list_destroy(files); ecore_list_destroy(dirs); DRETURN_PTR(NULL, DLEVEL_STABLE); } /* test for .. */ if (strcmp(file_temp, path)) { snprintf(filename, PATH_MAX, "%s/%s", path, file_temp); ewl_filelist_file_name_set(file, file_temp); } else { snprintf(filename, PATH_MAX, "%s", file_temp); ewl_filelist_file_name_set(file, ".."); } /* Generate the file information */ if (!ewl_filelist_file_path_set(file, filename)) { ewl_filelist_file_destroy(file); ecore_list_destroy(files); ecore_list_destroy(dirs); DRETURN_PTR(NULL, DLEVEL_STABLE); } if (ewl_filelist_file_is_dir(file)) { ecore_list_append(dirs, file); nd = nd + 1; } else { ecore_list_append(files, file); nf = nf + 1; } FREE(file_temp); }
END_TEST START_TEST(eet_test_file_data_dump) { Eet_Data_Descriptor *edd; Eet_Test_Ex_Type *result; Eet_Data_Descriptor_Class eddc; Eet_Test_Ex_Type etbt; Eet_File *ef; char *string1; char *file; int test; int tmpfd; file = strdup("/tmp/eet_suite_testXXXXXX"); eet_init(); eet_test_ex_set(&etbt, 0); etbt.list = eina_list_prepend(etbt.list, eet_test_ex_set(NULL, 1)); etbt.list = eina_list_prepend(etbt.list, eet_test_ex_set(NULL, 1)); etbt.hash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.hash, EET_TEST_KEY1, eet_test_ex_set(NULL, 2)); eina_hash_add(etbt.hash, EET_TEST_KEY2, eet_test_ex_set(NULL, 2)); etbt.ilist = eina_list_prepend(etbt.ilist, &i42); etbt.ilist = eina_list_prepend(etbt.ilist, &i42); etbt.ihash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.ihash, EET_TEST_KEY1, &i7); eina_hash_add(etbt.ihash, EET_TEST_KEY2, &i7); etbt.slist = eina_list_prepend(NULL, "test"); etbt.shash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.shash, EET_TEST_KEY1, "test"); memset(&etbt.charray, 0, sizeof(etbt.charray)); etbt.charray[0] = "test"; eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Eet_Test_Ex_Type", sizeof(Eet_Test_Ex_Type)); edd = eet_data_descriptor_file_new(&eddc); fail_if(!edd); eet_build_ex_descriptor(edd, EINA_FALSE); fail_if(-1 == (tmpfd = mkstemp(file))); fail_if(!!close(tmpfd)); /* Save the encoded data in a file. */ ef = eet_open(file, EET_FILE_MODE_WRITE); fail_if(!ef); fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0)); eet_close(ef); /* Use dump/undump in the middle */ ef = eet_open(file, EET_FILE_MODE_READ_WRITE); fail_if(!ef); string1 = NULL; fail_if(eet_data_dump(ef, EET_TEST_FILE_KEY1, append_string, &string1) != 1); fail_if(eet_delete(ef, EET_TEST_FILE_KEY1) == 0); fail_if(!eet_data_undump(ef, EET_TEST_FILE_KEY1, string1, strlen(string1), 1)); eet_close(ef); /* Test the correctness of the reinsertion. */ ef = eet_open(file, EET_FILE_MODE_READ); fail_if(!ef); result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1); fail_if(!result); eet_close(ef); /* Test the resulting data. */ fail_if(eet_test_ex_check(result, 0, EINA_TRUE) != 0); fail_if(eet_test_ex_check(eina_list_data_get(result->list), 1, EINA_TRUE) != 0); fail_if(eina_list_data_get(result->ilist) == NULL); fail_if(*((int *)eina_list_data_get(result->ilist)) != 42); fail_if(eina_list_data_get(result->slist) == NULL); fail_if(strcmp(eina_list_data_get(result->slist), "test") != 0); fail_if(eina_hash_find(result->shash, EET_TEST_KEY1) == NULL); fail_if(strcmp(eina_hash_find(result->shash, EET_TEST_KEY1), "test") != 0); fail_if(strcmp(result->charray[0], "test") != 0); test = 0; _dump_call = EINA_TRUE; if (result->hash) eina_hash_foreach(result->hash, func, &test); _dump_call = EINA_FALSE; fail_if(test != 0); if (result->ihash) eina_hash_foreach(result->ihash, func7, &test); fail_if(test != 0); fail_if(unlink(file) != 0); eet_shutdown(); }
END_TEST START_TEST(eet_test_file_data) { Eet_Data_Descriptor *edd; Eet_Test_Ex_Type *result; Eet_Dictionary *ed; Eet_File *ef; char **list; char *file; Eet_Data_Descriptor_Class eddc; Eet_Test_Ex_Type etbt; int size; int test; int tmpfd; file = strdup("/tmp/eet_suite_testXXXXXX"); eet_init(); eet_test_ex_set(&etbt, 0); etbt.list = eina_list_prepend(etbt.list, eet_test_ex_set(NULL, 1)); etbt.list = eina_list_prepend(etbt.list, eet_test_ex_set(NULL, 1)); etbt.hash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.hash, EET_TEST_KEY1, eet_test_ex_set(NULL, 2)); etbt.hash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.hash, EET_TEST_KEY2, eet_test_ex_set(NULL, 2)); etbt.ilist = eina_list_prepend(etbt.ilist, &i42); etbt.ilist = eina_list_prepend(etbt.ilist, &i42); etbt.ihash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.ihash, EET_TEST_KEY1, &i7); etbt.ihash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.ihash, EET_TEST_KEY2, &i7); etbt.slist = eina_list_prepend(NULL, "test"); etbt.shash = eina_hash_string_superfast_new(NULL); eina_hash_add(etbt.shash, EET_TEST_KEY1, "test"); memset(&etbt.charray, 0, sizeof(etbt.charray)); etbt.charray[0] = "test"; eet_test_setup_eddc(&eddc); eddc.name = "Eet_Test_Ex_Type"; eddc.size = sizeof(Eet_Test_Ex_Type); edd = eet_data_descriptor_file_new(&eddc); fail_if(!edd); eet_build_ex_descriptor(edd, EINA_FALSE); fail_if(-1 == (tmpfd = mkstemp(file))); fail_if(!!close(tmpfd)); /* Insert an error in etbt. */ etbt.i = 0; /* Save the encoded data in a file. */ ef = eet_open(file, EET_FILE_MODE_READ_WRITE); fail_if(!ef); fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0)); result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1); fail_if(!result); fail_if(eet_mode_get(ef) != EET_FILE_MODE_READ_WRITE); /* Test string space. */ ed = eet_dictionary_get(ef); fail_if(!eet_dictionary_string_check(ed, result->str)); fail_if(eet_dictionary_string_check(ed, result->istr)); eet_close(ef); /* Attempt to replace etbt by the correct one. */ etbt.i = EET_TEST_INT; ef = eet_open(file, EET_FILE_MODE_READ_WRITE); fail_if(!ef); fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0)); result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1); fail_if(!result); /* Test the resulting data. */ fail_if(eet_test_ex_check(result, 0, EINA_FALSE) != 0); eet_close(ef); /* Read back the data. */ ef = eet_open(file, EET_FILE_MODE_READ_WRITE); fail_if(!ef); fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY2, &etbt, 0)); result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1); fail_if(!result); /* Test string space. */ ed = eet_dictionary_get(ef); fail_if(!ed); fail_if(!eet_dictionary_string_check(ed, result->str)); fail_if(eet_dictionary_string_check(ed, result->istr)); /* Test the resulting data. */ fail_if(eet_test_ex_check(result, 0, EINA_FALSE) != 0); fail_if(eet_test_ex_check(eina_list_data_get(result->list), 1, EINA_FALSE) != 0); fail_if(eina_list_data_get(result->ilist) == NULL); fail_if(*((int *)eina_list_data_get(result->ilist)) != 42); fail_if(eina_list_data_get(result->slist) == NULL); fail_if(strcmp(eina_list_data_get(result->slist), "test") != 0); fail_if(eina_hash_find(result->shash, EET_TEST_KEY1) == NULL); fail_if(strcmp(eina_hash_find(result->shash, EET_TEST_KEY1), "test") != 0); fail_if(strcmp(result->charray[0], "test") != 0); test = 0; if (result->hash) eina_hash_foreach(result->hash, func, &test); fail_if(test != 0); if (result->ihash) eina_hash_foreach(result->ihash, func7, &test); fail_if(test != 0); list = eet_list(ef, "keys/*", &size); fail_if(eet_num_entries(ef) != 2); fail_if(size != 2); fail_if(!(strcmp(list[0], EET_TEST_FILE_KEY1) == 0 && strcmp(list[1], EET_TEST_FILE_KEY2) == 0) && !(strcmp(list[0], EET_TEST_FILE_KEY2) == 0 && strcmp(list[1], EET_TEST_FILE_KEY1) == 0)); free(list); fail_if(eet_delete(ef, NULL) != 0); fail_if(eet_delete(NULL, EET_TEST_FILE_KEY1) != 0); fail_if(eet_delete(ef, EET_TEST_FILE_KEY1) == 0); list = eet_list(ef, "keys/*", &size); fail_if(size != 1); fail_if(eet_num_entries(ef) != 1); /* Test some more wrong case */ fail_if(eet_data_read(ef, edd, "plop") != NULL); fail_if(eet_data_read(ef, edd, EET_TEST_FILE_KEY1) != NULL); /* Reinsert and reread data */ fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0)); fail_if(eet_data_read(ef, edd, EET_TEST_FILE_KEY1) == NULL); fail_if(eet_read_direct(ef, EET_TEST_FILE_KEY1, &size) == NULL); eet_close(ef); fail_if(unlink(file) != 0); eet_shutdown(); }
/* Adds a new widget to the box, after the cell "after" */ static void _etk_box_insert_after_cell(Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, Etk_Box_Cell *after, Etk_Box_Fill_Policy fill_policy, int padding) { Etk_Box_Cell *cell; Etk_Widget *box_widget; if (!(box_widget = ETK_WIDGET(box)) || !child) return; if (after && after->group != group) { ETK_WARNING("The child to pack and the widget after which the child should be packed " "do not belong to the same child-group"); return; } cell = malloc(sizeof(Etk_Box_Cell)); cell->prev = NULL; cell->next = NULL; cell->child = child; cell->focus_node = NULL; cell->group = group; cell->fill_policy = fill_policy; cell->padding = padding; if (after) { cell->prev = after; cell->next = after->next; if (after->next) after->next->prev = cell; else box->last_cell[group] = cell; after->next = cell; box_widget->focus_order = eina_list_append_relative_list(box_widget->focus_order, child, after->focus_node); cell->focus_node = eina_list_next(after->focus_node); } else { cell->next = box->first_cell[group]; if (box->first_cell[group]) box->first_cell[group]->prev = cell; else box->last_cell[group] = cell; box->first_cell[group] = cell; if (group == ETK_BOX_START || !box->last_cell[ETK_BOX_START]) { box_widget->focus_order = eina_list_prepend(box_widget->focus_order, child); cell->focus_node = box_widget->focus_order; } else { box_widget->focus_order = eina_list_append_relative_list(box_widget->focus_order, child, box->last_cell[ETK_BOX_START]->focus_node); cell->focus_node = eina_list_next(box->last_cell[ETK_BOX_START]->focus_node); } } box->cells_count[group]++; etk_widget_parent_set(child, ETK_WIDGET(box)); etk_object_data_set(ETK_OBJECT(child), "_Etk_Box::Cell", cell); etk_signal_emit(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(box), child); }