/** * @brief Cleanup internal data structures used by ewl. * * This should be called to cleanup internal EWL data structures, if using * ecore directly rather than using ewl_main(). */ int ewl_shutdown(void) { Ewl_Shutdown_Hook hook; void (*shutdown)(void); DENTER_FUNCTION(DLEVEL_STABLE); if (--ewl_init_count) DRETURN_INT(ewl_init_count, DLEVEL_STABLE); while ((hook = ecore_list_first_remove(shutdown_hooks))) hook(); IF_FREE_LIST(shutdown_hooks); /* * Destroy all existing widgets. */ if (ewl_embed_list) { Ewl_Widget *emb; while ((emb = ecore_list_first_remove(ewl_embed_list))) ewl_widget_destroy(emb); while (ewl_garbage_collect_idler(NULL) > 0) ; IF_FREE_LIST(ewl_embed_list); } if (idle_enterer) { ecore_idle_enterer_del(idle_enterer); idle_enterer = NULL; } /* * Free internal accounting lists. */ IF_FREE_LIST(ewl_window_list); IF_FREE_LIST(reveal_list); IF_FREE_LIST(obscure_list); IF_FREE_LIST(configure_active); IF_FREE_LIST(configure_available); IF_FREE_LIST(realize_list); IF_FREE_LIST(destroy_list); IF_FREE_LIST(free_evas_list); IF_FREE_LIST(free_evas_object_list); IF_FREE_LIST(child_add_list); /* shutdown all the subsystems */ while ((shutdown = ecore_list_first_remove(shutdown_queue))) shutdown(); IF_FREE_LIST(shutdown_queue); DRETURN_INT(ewl_init_count, DLEVEL_STABLE); }
void etk_entropy_delete_dialog_cb(Etk_Object* w, void* user_data) { Etk_Widget* window = NULL; int result = (int)user_data; entropy_generic_file* file; Ecore_List* files; entropy_gui_component_instance* instance; window = etk_object_data_get(ETK_OBJECT(w), "window"); files= etk_object_data_get(ETK_OBJECT(window), "files"); instance = etk_object_data_get(ETK_OBJECT(window), "instance"); switch (result) { case ENTROPY_USER_INTERACTION_RESPONSE_YES: { ecore_list_first_goto(files); while ((file = ecore_list_first_remove(files))) { entropy_plugin_filesystem_file_remove(file, instance); } } break; case ENTROPY_USER_INTERACTION_RESPONSE_NO: { } break; default: break; } ecore_list_destroy(files); etk_object_destroy(ETK_OBJECT(window)); }
void etk_file_cache_dialog_refresh(Etk_Widget* tree) { Etk_Tree_Col* col1; Etk_Tree_Col* col2; char* key; char buffer[PATH_MAX]; Ecore_List* keys; etk_tree_clear(ETK_TREE(tree)); /*Populate the tree*/ col1 = etk_tree_nth_col_get(ETK_TREE(tree), 0); col2 = etk_tree_nth_col_get(ETK_TREE(tree), 1); etk_tree_freeze(ETK_TREE(tree)); keys = entropy_core_file_cache_keys_retrieve(); while ( (key = ecore_list_first_remove(keys))) { entropy_file_listener* listen = entropy_core_file_cache_retrieve(key); if (listen) { snprintf(buffer, PATH_MAX, "%s/%s", listen->file->path, listen->file->filename); etk_tree_row_append(ETK_TREE(tree), NULL, col1, listen->count, col2, buffer, NULL); } } ecore_list_destroy(keys); etk_tree_thaw(ETK_TREE(tree)); }
/** * Move the current xml document pointer to the indicated node * @param xml The xml document * @param node The position within the document to move to * @return The current xml tag name * @ingroup EXML_Traversal_Group */ char *exml_goto_node(EXML *xml, EXML_Node *node) { Ecore_List *stack; EXML_Node *n, *l; CHECK_PARAM_POINTER_RETURN("xml", xml, NULL); stack = ecore_list_new(); n = node; while( n->parent != NULL ) { ecore_list_prepend(stack, n); n = n->parent; } l = xml->top; if (n != l) return NULL; while( (n = ecore_list_first_remove(stack)) ) { l = ecore_list_goto(l->children, n); if (!l) return NULL; } xml->current = node; return xml->current ? xml->current->tag : NULL; }
void ewl_icon_local_viewer_menu_rename_cb (Ewl_Widget * w, void *ev_data, void *user_data) { entropy_gui_component_instance *instance = user_data; entropy_icon_viewer *viewer = instance->data; Ecore_List *sel = ewl_iconbox_get_selection (EWL_ICONBOX (viewer->iconbox)); if (ecore_list_count (sel) == 1) { Ewl_Iconbox_Icon *icon = ecore_list_first_remove (sel); gui_file *local_file = ecore_hash_get (viewer->icon_hash, icon); if (icon) { printf ("Rename dialog..\n"); entropy_ewl_rename_dialog_new (entropy_file_gui_component_new_with_data (local_file->file, instance)); } } else { printf ("Can't rename more than 1 file\n"); } ecore_list_destroy (sel); }
int entropy_notify_loop(void* data) { entropy_notification_engine* notify = (entropy_notification_engine*)data; entropy_notify_event* next; void* (*call_func)(void* arg); ecore_list_first_goto (notify->op_queue); if ( (next = ecore_list_next(notify->op_queue)) ) { next->processed = 1; /*printf ("*************************************** Notify loop - Processing event..\n"); */ /*printf("Calling function '%s'\n", next->function);*/ call_func = dlsym(next->plugin->dl_ref, next->function); next->return_struct = (*call_func)(next->data); /*Relock to remove next*/ ecore_list_first_remove(notify->op_queue); ecore_list_append(notify->exe_queue, next); ecore_ipc_server_send(notify->server, ENTROPY_IPC_EVENT_CORE, 6, 0, 0, 0, NULL, 0); } else { } return 1; }
char * EvfsFilereference_to_string(EvfsFilereference * ref) { int length = 0; char *uri; Ecore_List *parent_list = ecore_list_new(); EvfsFilereference *parent; ecore_list_prepend(parent_list, ref); length += strlen(ref->plugin_uri) + strlen("://"); if (ref->username) { length += strlen(ref->username) + strlen(ref->password) + strlen(":") + strlen("@"); } length += strlen(ref->path); while ((parent = ref->parent)) { ecore_list_prepend(parent_list, parent); length += strlen(parent->plugin_uri) + strlen("://"); if (parent->username) { length += strlen(parent->username) + strlen(parent->password) + strlen(":") + strlen("@"); } length += strlen(parent->path); length += strlen("#"); } length += 1; uri = calloc(length, sizeof(char)); while ((parent = ecore_list_first_remove(parent_list))) { strcat(uri, parent->plugin_uri); strcat(uri, "://"); if (parent->username) { strcat(uri, parent->username); strcat(uri, ":"); strcat(uri, parent->password); strcat(uri, "@"); } strcat(uri, parent->path); if (ecore_list_next(parent_list)) strcat(uri, "#"); } ecore_list_destroy(parent_list); return uri; }
int evfs_client_disconnect(evfs_client * client) { Ecore_List *mon_list; Ecore_List *indiv_list; evfs_file_monitor *mon; char *key; Ecore_List *watched_keys = ecore_list_new(); /*printf("Received disconnect for client at evfs_fs_posix.c for client %lu\n", client->id); printf("Scanning monitors for client and removing...\n");*/ mon_list = ecore_hash_keys(posix_monitor_hash); if (mon_list) { while ((key = ecore_list_first_remove(mon_list))) { /*printf("Looking for clients for '%s'\n", key);*/ indiv_list = ecore_hash_get(posix_monitor_hash, key); ecore_list_first_goto(indiv_list); while ((mon = ecore_list_next(indiv_list))) { if (mon->client == client) { ecore_list_append(watched_keys, key); } } } ecore_list_destroy(mon_list); } else { /*printf("No directories/files monitored by any client\n");*/ } while ((key = ecore_list_first_remove(watched_keys))) { evfs_posix_monitor_remove(client, key); } ecore_list_destroy(watched_keys); return 1; }
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 entropy_notify_event_bulk_commit(entropy_notification_engine* engine, Ecore_List* list) { entropy_notify_event* ev; while ( (ev = ecore_list_first_remove(list))) { ecore_list_append(engine->op_queue, ev); } ecore_list_destroy(list); }
/*Location related functions*/ static void _etk_layout_location_delete_confirm_cb(Etk_Object * object, void *data) { entropy_gui_component_instance* instance = data; entropy_layout_gui* gui = instance->data; Etk_Tree_Row* row = gui->delete_row; Entropy_Config_Structure* structure; Ecore_List* row_refs = NULL; _layout_etk_row_structure_plugin* ref; if (row) { structure = ecore_hash_get(_etk_layout_row_reference, row); row_refs = ecore_hash_get(_etk_layout_structure_plugin_reference, structure); if (row_refs) { while ( (ref = ecore_list_first_remove(row_refs))) { etk_tree_row_delete(ref->row); IF_FREE(ref); } ecore_list_destroy(row_refs); ecore_hash_remove(_etk_layout_structure_plugin_reference, structure); } entropy_config_standard_structure_remove(structure); } }
void entropy_ewl_mime_dialog_display() { Ewl_Widget* window = ewl_window_new(); Ewl_Widget* box = ewl_vbox_new(); Ewl_Widget* button = ewl_button_new(); Ewl_Widget* hbox; entropy_core* core = entropy_core_get_core(); char* entries[3]; char* key; entropy_mime_action* action; Ecore_List* keys; last_select_text = NULL; /*Init the mime tree*/ mime_tree = ewl_tree_new(2); ewl_tree_mode_set(EWL_TREE(mime_tree), EWL_SELECTION_MODE_SINGLE); ewl_object_minimum_size_set(EWL_OBJECT(window), 530, 400); ewl_window_title_set(EWL_WINDOW(window), "Edit MIME Actions.."); ewl_container_child_append(EWL_CONTAINER(window), box); ewl_container_child_append(EWL_CONTAINER(box), mime_tree); ewl_widget_show(box); keys = ecore_hash_keys(core->mime_action_hint); while ((key = ecore_list_first_remove(keys))) { Ewl_Widget* row; entries[0] = key; entries[1] = ((entropy_mime_action*)ecore_hash_get(core->mime_action_hint, key))->executable; entries[2] = NULL; row = ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries); ewl_widget_color_set(row,0,0,0,255); ewl_callback_append(row, EWL_CALLBACK_MOUSE_DOWN, mime_row_click_cb, key); } ecore_list_destroy(keys); hbox = ewl_hbox_new(); ewl_container_child_append(EWL_CONTAINER(box), hbox); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK); ewl_widget_show(hbox); /*Add Button*/ ewl_button_label_set(EWL_BUTTON(button), "Add MIME Action"); ewl_object_maximum_h_set(EWL_OBJECT(button), 15); ewl_callback_append(button, EWL_CALLBACK_CLICKED, entropy_ewl_mime_add_display_cb, NULL); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_widget_show(button); /*OK Button*/ button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "Close"); ewl_object_maximum_h_set(EWL_OBJECT(button), 15); ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, window); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_widget_show(button); ewl_widget_show(window); ewl_widget_show(mime_tree); }
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 entropy_notify_event_destroy(entropy_notify_event* eevent) { entropy_notify_event_cb_data* cb_data; void *clean; /*Remove any file references*/ if (eevent->data) { switch (eevent->event_type) { case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL: case ENTROPY_NOTIFY_FILELIST_REQUEST: { } break; case ENTROPY_NOTIFY_THUMBNAIL_REQUEST: { /*Remove ref to thumbnail's file*/ entropy_file_request* req = eevent->data; //printf("De-refing for thumbnail:\n"); entropy_core_file_cache_remove_reference ( req->file->md5); } break; case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE: { /*Remove a reference to the calling file*/ entropy_generic_file* file = eevent->data; //printf("Derefing for stat..\n"); entropy_core_file_cache_remove_reference ( file->md5); } break; case ENTROPY_NOTIFY_HOVER: { entropy_generic_file* file = eevent->data; entropy_core_file_cache_remove_reference ( file->md5); }; break; case ENTROPY_NOTIFY_DEHOVER: { entropy_generic_file* file = eevent->data; entropy_core_file_cache_remove_reference ( file->md5); }; break; } } /*Cleanup the return struct*/ if (eevent->return_struct) { switch (eevent->event_type) { case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL: case ENTROPY_NOTIFY_FILELIST_REQUEST: { Ecore_List* list = eevent->return_struct; entropy_generic_file* file; //printf("Freeing files at return struct for filelist..\n"); /*It's a filelist request - return is an ecore list - destroy*/ while ((file = ecore_list_first_remove(list))) { entropy_core_file_cache_remove_reference (file->md5); } ecore_list_destroy(eevent->return_struct); } break; case ENTROPY_NOTIFY_THUMBNAIL_REQUEST: { } break; case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE: { } break; default: //printf("Event type: %d\n", eevent->event_type); break; } } /*This is potentially bad - we need some way to identify what we are freeing*/ ecore_list_first_goto(eevent->cb_list); while ( (cb_data = ecore_list_next(eevent->cb_list)) ) { entropy_free(cb_data); } /*Nuke our cleanup objs*/ ecore_list_first_goto(eevent->cleanup_list); while ( (clean = ecore_list_next(eevent->cleanup_list))) { entropy_free(clean); } ecore_list_destroy(eevent->cleanup_list); ecore_list_destroy(eevent->cb_list); entropy_free(eevent); }
int idle_add_icons (void *data) { event_idle_processor *proc = (event_idle_processor *) data; entropy_gui_component_instance *comp = (entropy_gui_component_instance *) proc->requestor; entropy_icon_viewer *view = ((entropy_icon_viewer *) comp->data); Ecore_List *el = proc->user_data; entropy_generic_file *file; int i = 0; char *mime; entropy_plugin *thumb; Ecore_List *added_list = ecore_list_new (); Ecore_List *events; int term = 0; if (proc->terminate) { goto FREE_AND_LEAVE; } /*data = file list */ while (i < ICON_ADD_COUNT && (file = ecore_list_first_remove (el))) { ewl_icon_local_viewer_add_icon (proc->requestor, file, DONT_DO_MIME); /*Remove the pre-idle-add ref*/ entropy_core_file_cache_remove_reference (file->md5); ecore_list_append (added_list, file); i++; } if (!file) term = 1; while ((file = ecore_list_first_remove (added_list))) { mime = (char *) entropy_mime_file_identify (file); if (mime && strcmp (mime, ENTROPY_NULL_MIME)) { entropy_plugin_thumbnail_request(comp,file,(void*)gui_event_callback); } else { thumb = NULL; } } ecore_list_destroy (added_list); if (!term) { proc->count += ICON_ADD_COUNT; //printf("Continuing process thread..(%d)\n", proc->count); ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (((entropy_icon_viewer *) comp-> data)->iconbox)); return 1; } else { ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (((entropy_icon_viewer *) comp-> data)->iconbox)); view->last_processor = NULL; //printf("Terminated process thread..\n"); goto FREE_AND_LEAVE; return 0; } FREE_AND_LEAVE: ecore_list_destroy (proc->user_data); entropy_free (proc); return 0; }