/** * Shutdown the ecore string internal structures */ EAPI void ecore_string_shutdown() { --ecore_string_init_count; if (!ecore_string_init_count) { ecore_hash_destroy(ecore_strings); ecore_strings = NULL; } }
void egxp_node_free (Egxp_Node * n) { #ifdef EGXP_DEBUG printf("TRACE: egxp_node_free\n"); #endif assert (n); if (n->conditions) ecore_list_destroy (n->conditions); if (n->childs) ecore_hash_destroy (n->childs); FREE (n); }
/** * Destroys this xml document * @param xml The xml document * @return nothing */ void exml_destroy(EXML *xml) { CHECK_PARAM_POINTER("xml", xml); exml_clear(xml); ecore_hash_destroy(xml->buffers); FREE(xml); }
/** * close the current project */ static void project_close( Ewler_Project *p ) { IF_FREE(p->name); IF_FREE(p->path); IF_FREE(p->filename); ecore_hash_destroy(p->files); FREE(p); }
void entropy_thumbnail_destroy (entropy_thumbnail * thumb) { if (thumb) { if (thumb->text) ecore_hash_destroy (thumb->text); entropy_free (thumb); allocated_thumbnails--; print_allocation (); } }
static void _exml_node_destroy( void *data ) { EXML_Node *node = data; if (node) { ecore_hash_destroy(node->attributes); IF_FREE(node->tag); IF_FREE(node->value); ecore_list_destroy(node->children); FREE(node); } }
void egxp_opcode_free (Egxp_Opcode * op) { #ifdef EGXP_DEBUG printf("TRACE: egxp_opcode_free\n"); #endif assert (op); /* free only the initial pointer */ IF_FREE (op->id_string); // static string, so it's forbidden to destroy if (op->id_string) free (op->id_string); ecore_hash_destroy (op->string_id); FREE (op); }
void widget_clear_ui_hooks( Ewler_Widget *w ) { Ecore_Hash *elems; Ecore_List *elems_stack; Ecore_List *names, *names_stack; char *name; names = ecore_hash_keys(w->elems); elems = w->elems; elems_stack = ecore_list_new(); names_stack = ecore_list_new(); while( (name = ecore_list_next(names)) ) { Ewler_Widget_Elem *elem; elem = ecore_hash_get(elems, name); elem->entry = NULL; elem->text = NULL; if( elem->items ) ecore_hash_destroy(elem->items); elem->items = NULL; if( elem->spec->type == EWLER_SPEC_ELEM_STRUCT ) { ecore_list_prepend(elems_stack, elems); ecore_list_prepend(names_stack, names); elems = elem->info.children; names = ecore_hash_keys(elems); } while( !ecore_list_current(names) && elems != w->elems ) { ecore_list_destroy(names); elems = ecore_list_first_remove(elems_stack); names = ecore_list_first_remove(names_stack); } } ecore_list_destroy(names); ecore_list_destroy(elems_stack); ecore_list_destroy(names_stack); }
void eli_highscore_shutdown(void) { /* free the data */ ecore_hash_free_value_cb_set(hiscore_hash, ECORE_FREE_CB(_eli_highscore_list_free)); ecore_hash_destroy(hiscore_hash); eet_data_descriptor_free(edd_hiscore); eet_data_descriptor_free(edd_entry); free(eet_file_name); /* and the set the pointer to null */ hiscore_hash = NULL; edd_hiscore = NULL; edd_entry = NULL; eet_file_name = NULL; eet_shutdown(); }
static void eina_bench_lookup_ecore(int request) { Ecore_Hash *hash = NULL; Eina_Bench_Ecore *elm; unsigned int i; unsigned int j; hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); ecore_hash_free_key_cb_set(hash, NULL); ecore_hash_free_value_cb_set(hash, free); for (i = 0; i < (unsigned int)request; ++i) { elm = malloc(sizeof (Eina_Bench_Ecore) + 10); if (!elm) continue; elm->key = (char *)(elm + 1); eina_convert_itoa(i, elm->key); elm->value = i; ecore_hash_set(hash, elm->key, elm); } srand(time(NULL)); for (j = 0; j < 200; ++j) for (i = 0; i < (unsigned int)request; ++i) { char tmp_key[10]; eina_convert_itoa(rand() % request, tmp_key); elm = ecore_hash_get(hash, tmp_key); } ecore_hash_destroy(hash); }
static EWL_CALLBACK_DEFN(widget_destroy) { Ewler_Widget *ewler_w; int i; ewler_w = user_data; if( !ewler_w ) return; if( ewler_w->form ) form_remove(ewler_w->form, ewler_w); IF_FREE(ewler_w->source); IF_FREE(ewler_w->parent); ecore_hash_destroy(ewler_w->elems); for( i=0;i<EWL_CALLBACK_MAX;i++ ) if( ewler_w->callbacks[i] ) ecore_list_destroy(ewler_w->callbacks[i]); FREE(ewler_w); }
void gui_object_destroy_and_free (entropy_gui_component_instance * comp, Ecore_Hash * gui_hash) { Ecore_List *list; entropy_generic_file *obj; gui_file *freeobj; /*Temporarily stop callbacks, we don't want to clobber an in-op process */ entropy_notify_lock_loop (comp->core->notify); list = ecore_hash_keys (gui_hash); ecore_list_first_goto (list); while ((obj = ecore_list_next (list))) { freeobj = ecore_hash_get (gui_hash, obj); if (freeobj) { /*Associate this icon with this file in the core, so DND works */ entropy_core_object_file_disassociate (freeobj->icon); gui_file_destroy (freeobj); } /*Tell the core we no longer need this file - it might free it now */ entropy_core_file_cache_remove_reference (obj->md5); } ecore_hash_destroy (gui_hash); ecore_list_destroy (list); entropy_notify_unlock_loop (comp->core->notify); }
void inspector_update( Ecore_List *selected ) { Ewl_Widget *prow; Ecore_Sheap *slist, *sheap; Ecore_Hash *elems; Ecore_List *keys; Ecore_List *prow_stack, *sheap_stack, *elems_stack; Ewler_Widget *w; char *key; ewl_container_reset(EWL_CONTAINER(tree)); if( !selected ) return; /* add support for multiple selections later */ w = ecore_list_first_goto(selected); if( !w ) return; keys = ecore_hash_keys(w->elems); slist = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys)); while( (key = ecore_list_next(keys)) ) ecore_sheap_insert(slist, key); ecore_list_destroy(keys); ecore_sheap_sort(slist); sheap = slist; elems = w->elems; sheap_stack = ecore_list_new(); elems_stack = ecore_list_new(); prow_stack = ecore_list_new(); prow = NULL; while( (key = ecore_sheap_extract(sheap)) ) { Ewler_Widget_Elem *elem; Ewl_Widget *row_items[2], *row; Ewl_Widget *text, *entry; int len; elem = ecore_hash_get(elems, key); text = ewl_text_new(key); len = ewl_text_length_get(EWL_TEXT(text)); ewl_text_cursor_position_set(EWL_TEXT(text), 0); if( elem->changed ) ewl_text_color_apply(EWL_TEXT(text), 255, 0, 0, 255, len); switch( elem->spec->type ) { case EWLER_SPEC_ELEM_STRUCT: entry = NULL; break; case EWLER_SPEC_ELEM_ENUM: entry = ewl_combo_new(elem_to_s(elem)); if( elem->items ) ecore_hash_destroy(elem->items); elem->items = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); keys = ecore_hash_keys(elem->spec->info.edata.map_rev); while( (key = ecore_list_next(keys)) ) { Ewl_Widget *combo_item; int value; value = (int) ecore_hash_get(elem->spec->info.edata.map_rev, key); combo_item = ewl_menu_item_new(NULL, key); ecore_hash_set(elem->items, (void *) value, combo_item); ewl_container_child_append(EWL_CONTAINER(entry), combo_item); ewl_widget_show(combo_item); } ecore_list_destroy(keys); ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED, combo_value_changed, elem); break; default: entry = ewl_entry_new(elem_to_s(elem)); if( !elem->spec->modifiable ) ewl_entry_editable_set(EWL_ENTRY(entry), false); ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED, entry_value_changed, elem); ewl_callback_append(entry, EWL_CALLBACK_DESELECT, entry_value_changed, elem); ewl_callback_append(entry, EWL_CALLBACK_FOCUS_OUT, entry_focus_out, elem); break; } elem->text = text; elem->entry = entry; row_items[0] = text; row_items[1] = entry; row = ewl_tree_row_add(EWL_TREE(tree), EWL_ROW(prow), row_items); ewl_widget_show(text); if( entry ) ewl_widget_show(entry); if( elem->spec->type == EWLER_SPEC_ELEM_STRUCT ) { ecore_list_prepend(prow_stack, prow); ecore_list_prepend(sheap_stack, sheap); ecore_list_prepend(elems_stack, elems); prow = row; elems = elem->info.children; /* TODO: check for indexed struct */ keys = ecore_hash_keys(elems); sheap = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys)); while( (key = ecore_list_next(keys)) ) ecore_sheap_insert(sheap, key); ecore_list_destroy(keys); ecore_sheap_sort(sheap); } if( sheap->size == 0 && ecore_list_count(sheap_stack) ) { ecore_sheap_destroy(sheap); prow = ecore_list_first_remove(prow_stack); sheap = ecore_list_first_remove(sheap_stack); elems = ecore_list_first_remove(elems_stack); } } ecore_list_destroy(sheap_stack); ecore_list_destroy(elems_stack); ecore_sheap_destroy(slist); }
void gui_event_callback (entropy_notify_event * eevent, void *requestor, void *ret, void *user_data) { entropy_gui_component_instance *comp = (entropy_gui_component_instance *) user_data; switch (eevent->event_type) { case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL: case ENTROPY_NOTIFY_FILELIST_REQUEST:{ event_idle_processor *proc = entropy_malloc (sizeof (event_idle_processor)); entropy_generic_file *event_file; entropy_file_request *request = eevent->data; /*A file request's data is the dest dir */ entropy_icon_viewer *view = comp->data; Ecore_Hash *tmp_gui_hash; Ecore_Hash *tmp_icon_hash; printf ("Icon viewer got a directory change order!\n"); /*Keep a reference to our existing hash */ tmp_gui_hash = view->gui_hash; tmp_icon_hash = view->icon_hash; view->gui_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); view->icon_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); /*Terminate our last load if we are still going...Not the most elegant solution, but there can only be 1 at once */ if (view->last_processor) view->last_processor->terminate = 1; /*Setup the background processor object */ //proc->eevent = eevent; proc->requestor = comp; proc->count = 0; proc->terminate = 0; proc->user_data = ecore_list_new (); view->last_processor = proc; ecore_list_first_goto (ret); while ((event_file = ecore_list_next (ret))) { //printf("Populating with '%s'\n", event_file->filename); entropy_core_file_cache_add_reference (event_file->md5); ecore_list_append (proc->user_data, event_file); } ecore_idle_enterer_add (idle_add_icons, proc); /*Set the current path from the event source... */ snprintf (view->current_dir, 1024, "%s://%s/%s", request->file->uri_base, request->file->path, request->file->filename); /*Before we begin, see if our file hash is initialized, if so - we must destroy it first */ /*TODO*/ gui_object_destroy_and_free (comp, tmp_gui_hash); ecore_hash_destroy (tmp_icon_hash); /*Clear the view, if there's anything to nuke */ ewl_iconbox_clear (EWL_ICONBOX (view->iconbox)); /*See if there is a custom BG image for this folder */ if (entropy_config_str_get ("iconbox_viewer", view->current_dir)) { ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), entropy_config_str_get ("iconbox_viewer", view-> current_dir)); view->default_bg = 0; } else { /*if (!view->default_bg) { */ ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), NULL); view->default_bg = 1; } /*Goto the root of the iconbox */ ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (view->iconbox)); ewl_iconbox_scrollpane_goto_root (EWL_ICONBOX (view->iconbox)); } break; case ENTROPY_NOTIFY_THUMBNAIL_REQUEST:{ /*Only bother if we have a thumbnail, and a component */ if (ret && user_data) { gui_file *obj; entropy_thumbnail *thumb = (entropy_thumbnail *) ret; entropy_icon_viewer *view = comp->data; obj = ecore_hash_get (view->gui_hash, thumb->parent); if (obj) { obj->thumbnail = thumb; /*printf("Received callback notify from notify event..\n"); */ /*Make sure the icon still exists */ /*if (obj->icon) { */ ewl_iconbox_icon_image_set (EWL_ICONBOX_ICON (obj->icon), obj->thumbnail->thumbnail_filename); /*FIXME This is inefficient as all hell - find a better way to do this */ //ewl_iconbox_icon_arrange(EWL_ICONBOX(view->iconbox)); } else { //printf("ERR: Couldn't find a hash reference for this file!\n"); } } } //End case break; case ENTROPY_NOTIFY_FILE_CHANGE:{ //printf ("Received file change event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename); } break; case ENTROPY_NOTIFY_FILE_CREATE:{ //printf ("Received file create event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename); ewl_icon_local_viewer_add_icon (comp, (entropy_generic_file *) ret, DO_MIME); } break; case ENTROPY_NOTIFY_FILE_REMOVE_DIRECTORY: case ENTROPY_NOTIFY_FILE_REMOVE:{ printf ("Received a remove file notify\n"); ewl_icon_local_viewer_remove_icon (comp, (entropy_generic_file *) ret); } break; case ENTROPY_NOTIFY_FILE_STAT_EXECUTED:{ //printf("STAT EXECUTED Response back at ewl_icon_local_viewer\n"); } break; case ENTROPY_NOTIFY_USER_INTERACTION_YES_NO_ABORT: { printf("Yes/No/Abort to file copy?\n"); entropy_ewl_user_interaction_dialog_new((entropy_file_operation*)ret); } break; case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE:{ entropy_file_stat *file_stat = (entropy_file_stat *) eevent->return_struct; if (file_stat->file == NULL) { printf ("***** File stat file is null\n"); } ewl_icon_local_viewer_show_stat (file_stat); } break; case ENTROPY_NOTIFY_FILE_PROGRESS:{ entropy_icon_viewer *view = comp->data; entropy_file_progress *progress = ret; if (!view->progress->progress_window) { printf ("Showing progressbar dialog..\n"); ewl_progress_window_create (view->progress); ewl_widget_show (view->progress->progress_window); } if (view->progress->progress_window) { ewl_text_text_set (EWL_TEXT (view->progress->file_from), progress->file_from->filename); ewl_text_text_set (EWL_TEXT (view->progress->file_to), progress->file_to->filename); ewl_progressbar_value_set (EWL_PROGRESSBAR (view->progress->progressbar), progress->progress); } /*Is it time to hide (i.e. end) */ if (progress->type == TYPE_END) { printf ("Hiding progressbar dialog..\n"); ewl_widget_destroy (view->progress->progress_window); view->progress->progress_window = NULL; } } break; } //End switch }