static EXML_Node *find_node(EXML_Node *node, char *key, char *value) { Ecore_List *props; EXML_Node *prop; props = node->children; ecore_list_first_goto(props); prop = ecore_list_current(props); while(prop != NULL) { if(ecore_hash_get(prop->attributes, key)) { if(!strcmp(ecore_hash_get(prop->attributes, key), value)) return prop; } if(prop->children) { EXML_Node *ret; if((ret = find_node(prop, key, value))) return ret; } prop = ecore_list_next(props); } return NULL; }
static E_Widget * _e_widget_spinner_handle(Enhance *en, EXML_Node *node) { E_Widget *spinner; char *id; Ecore_List *props; EXML_Node *prop; double value; double min = 0; double max = 0; double step_inc = 1; double page_inc = 1; double page_size = 1; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; props = node->children; ecore_list_first_goto(props); prop = ecore_list_current(props); while(prop != NULL) { if(!strcmp(prop->tag, "property")) { char *name; name = ecore_hash_get(prop->attributes, "name"); if(!name) { prop = ecore_list_next(props); continue; } if(!strcmp(name, "adjustment")) { if(prop->value) { char *adj; adj = strdup(prop->value); sscanf(adj, "%lf %lf %lf %lf %lf %lf", &value, &min, &max, &step_inc, &page_inc, &page_size); E_FREE(adj); } } } prop = ecore_list_next(props); } ecore_list_first_goto(props); spinner = _e_widget_new(en, node, etk_spinner_new(min, max, value, step_inc, page_inc), id); return spinner; }
void evfs_posix_monitor_remove(evfs_client * client, char *path) { Ecore_List *mon_list = ecore_hash_get(posix_monitor_hash, path); Ecore_File_Monitor *em = NULL; if (!mon_list) { /*There is no one monitoring this - so this client can't be... */ return; } else { evfs_file_monitor *mon = NULL; evfs_file_monitor *check_last = NULL; ecore_list_first_goto(mon_list); while ((mon = ecore_list_current(mon_list))) { if (mon->client == client) { em = mon->em; ecore_list_remove(mon_list); goto final; } ecore_list_next(mon_list); } goto out; final:
/** * file menu action callback */ static EWL_CALLBACK_DEFN(project_file_menu_cb) { int action; char *name = user_data; Ewler_Form *form; action = (int) ewl_widget_data_get(w, "Action"); switch( action ) { case EWLER_FILE_SAVE: form = form_get(name); form->filename = ecore_hash_get(active_project->files, name); if( form->dirty ) { if( file_form_save(form) < 0 ) ewler_error("Unable to save file: %s", form->filename); else form->dirty = false; } break; case EWLER_FILE_DELETE: /* add history jiggies */ form = form_get(name); if( form ) form_close(form); project_file_delete(name); break; case EWLER_FILE_SETTINGS: project_file_settings(name); break; } ewl_widget_destroy(file_menu); file_menu = NULL; }
static const char * ewl_icon_theme_icon_path_get_helper(const char *icon, unsigned int size, const char *theme, const char *key, Ecore_Hash *cache) { char *ret; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(icon, EWL_THEME_KEY_NOMATCH); #if BUILD_EFREET_SUPPORT ret = ecore_hash_get(cache, key); if (!ret) { /* XXX: How to store NOMATCH in the cache? The cache is strings which must be free'd */ ret = efreet_icon_path_find(theme, icon, size); if (!ret) ret = EWL_THEME_KEY_NOMATCH; else ecore_hash_set(cache, strdup(key), (void *)ret); } #else ret = EWL_THEME_KEY_NOMATCH; #endif DRETURN_PTR(ret, DLEVEL_STABLE); }
int egxp_opcode_add (Egxp_Opcode * op, const char * name) { #ifdef EGXP_DEBUG printf("TRACE: egxp_opcode_add\n"); #endif assert (op && name); int * id = NULL; /* check if the name already exist */ if ( (id = ecore_hash_get (op->string_id, (char*) name)) != NULL) { #ifdef EGXP_DEBUG printf("TRACE: egxp_opcode_add -> %s already exists\n", name); #endif return *id; } /* allocate the memory for the id */ id = (int*) malloc (sizeof (int)); *id = op->id++; #ifdef EGXP_DEBUG printf("TRACE: egxp_opcode_add -> %s %d\n", name, *id); #endif /* add the new element */ ecore_hash_set (op->string_id, (char*)name, id); /* the id_string must be updated */ op->need_update = 1; return *id; }
static void _exml_write_element(EXML_Node *node, xmlTextWriterPtr writer) { EXML_Node *child; Ecore_List *keys; xmlChar *name; xmlTextWriterStartElement( writer, (xmlChar *) node->tag ); keys = ecore_hash_keys( node->attributes ); ecore_list_first_goto( keys ); while( (name = ecore_list_next( keys )) ) { xmlChar *value = ecore_hash_get( node->attributes, name ); xmlTextWriterWriteAttribute( writer, name, value ); } ecore_list_destroy( keys ); if (node->value) xmlTextWriterWriteString( writer, (xmlChar *) node->value ); ecore_list_first_goto( node->children ); while( (child = ecore_list_next( node->children )) ) _exml_write_element( child, writer ); xmlTextWriterEndElement( writer ); }
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); }
void icon_click_cb (Ewl_Widget * w, void *ev_data, void *user_data) { Ewl_Event_Mouse_Down *ev = ev_data; entropy_gui_event *gui_event; gui_file *local_file = ecore_hash_get (((entropy_icon_viewer *) user_data)->icon_hash, w); if (!local_file) { printf ("*Alert* Couldn't find a local file reference for icon\n"); } if (ev->clicks > 1) { if (ev->button == 1) { //printf("Icon clicked %d, widget %p!\n", ev->clicks, w); /*Send an event to the core */ gui_event = entropy_malloc (sizeof (entropy_gui_event)); gui_event->event_type = entropy_core_gui_event_get (ENTROPY_GUI_EVENT_ACTION_FILE); gui_event->data = local_file->file; entropy_core_layout_notify_event (local_file->instance, gui_event, ENTROPY_EVENT_GLOBAL); } else if (ev->button == 2) { } } }
void ewl_iconbox_file_copy_cb (Ewl_Widget * w, void *ev_data, void *user_data) { Ecore_List *icon_list; gui_file *file; Ewl_Iconbox_Icon *list_item; entropy_gui_component_instance *instance = (entropy_gui_component_instance *) user_data; /*Clear the existing contents */ entropy_core_selected_files_clear (instance->core); icon_list = ewl_iconbox_get_selection (EWL_ICONBOX (((entropy_icon_viewer *) instance->data)-> iconbox)); ecore_list_first_goto (icon_list); while ((list_item = ecore_list_next (icon_list))) { file = ecore_hash_get (((entropy_icon_viewer *) instance->data)->icon_hash, list_item); entropy_core_selected_file_add (file->file); } ecore_list_destroy (icon_list); }
void egxp_node_add_child (Egxp_Node * parent, Egxp_Node * child) { #ifdef EGXP_DEBUG printf("TRACE: egxp_node_add_child\n"); #endif assert (parent && child); if (parent->childs == NULL) { /* create a hash */ parent->childs = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); /* destroy each element */ ecore_hash_set_free_value (parent->childs, (Ecore_Free_Cb)ecore_dlist_destroy); } /* try to get the list for the special tag */ Ecore_DList * ltmp = ECORE_DLIST (ecore_hash_get (parent->childs, (int*)child->tag)); if (ltmp == NULL) { /* doesn't exist, so create it */ ltmp = ecore_dlist_new (); ecore_dlist_set_free_cb (ltmp,(Ecore_Free_Cb)egxp_node_free); /* append the list to the hash, hash is indexed by the tag id */ ecore_hash_set (parent->childs, (int*)child->tag, ltmp); } /* now append the child to the list */ egxp_node_add_in_order (ltmp, child); /* set the parent for the child */ child->parent = parent; }
/** * Free memory allocated by a call to exml_mem_write * @param xml The xml document * @param ptr The xml buffer content * @return nothing */ void exml_mem_free(EXML *xml, void *ptr) { CHECK_PARAM_POINTER("xml", xml); if (ecore_hash_get(xml->buffers, ptr)) { ecore_hash_remove(xml->buffers, ptr); } }
static int string_is_keyword(Ecore_Hash *keys, const char *string) { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(string, FALSE); DRETURN_INT(((ecore_hash_get(keys, string) != NULL) ? TRUE : FALSE), DLEVEL_STABLE); }
int posix_monitor_add(evfs_client * client, evfs_command * command) { Ecore_List *mon_list = ecore_hash_get(posix_monitor_hash, evfs_command_first_file_get(command)->path); evfs_file_monitor *mon; evfs_file_monitor *old; mon = calloc(1, sizeof(evfs_file_monitor)); mon->client = client; mon->monitor_path = strdup(evfs_command_first_file_get(command)->path); /*Check if we are already monitoring, if not, make a new list of monitors.. */ if (!mon_list) { /*printf("No previous instance, making a new list, monitoring..\n"); */ mon_list = ecore_list_new(); ecore_hash_set(posix_monitor_hash, mon->monitor_path, mon_list); printf("Adding monitor on path '%s'\n", mon->monitor_path); if (! (mon->em = ecore_file_monitor_add(mon->monitor_path, &evfs_file_monitor_fam_handler, mon->monitor_path))) { fprintf(stderr, "EVFS: Error monitoring '%s'\n", mon->monitor_path); } ecore_list_append(mon_list, mon); } else { if (!client_already_monitoring(client, mon_list)) { /*We assume there is something already in the list. This is probably bad a bad assumption */ ecore_list_first_goto(mon_list); old = ecore_list_current(mon_list); /*Make sure we have the ecore ref, so the last monitor can nuke it */ mon->em = old->em; ecore_list_append(mon_list, mon); } else { printf("Oi, dufus, you're already monitoring this object\n"); } } return 0; }
void eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed) { Eke_Gui_Ewl_Feed *disp; Eke_Feed_Item *item; Ewl_Widget *o; disp = ecore_hash_get(eke->feeds, feed); if (!disp->tab) { Ewl_Widget *o; disp->tab = ewl_text_new(feed->title); ewl_widget_show(disp->tab); o = ewl_vbox_new(); ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook), disp->tab, o); ewl_widget_show(o); disp->page = ewl_scrollpane_new(); ewl_container_child_append(EWL_CONTAINER(o), disp->page); ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5); ewl_widget_show(disp->page); } ewl_container_reset(EWL_CONTAINER(disp->page)); ecore_list_first_goto(feed->items); while ((item = ecore_list_next(feed->items)) != NULL) { o = ewl_text_new(NULL); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_text_style_set(EWL_TEXT(o), "soft_shadow"); ewl_text_text_set(EWL_TEXT(o), item->title); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); if (item->link) { o = ewl_text_new(item->link); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } if (item->desc) { o = ewl_text_new(item->desc); ewl_text_wrap_set(EWL_TEXT(o), 1); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } o = ewl_text_new(" "); ewl_container_child_append(EWL_CONTAINER(disp->page), o); ewl_widget_show(o); } }
static E_Widget * _e_widget_dialog_handle(Enhance *en, EXML_Node *node) { E_Widget *dia; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; dia = _e_widget_new(en, node, etk_dialog_new(), id); return dia; }
static E_Widget * _e_widget_entry_handle(Enhance *en, EXML_Node *node) { E_Widget *entry; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; entry = _e_widget_new(en, node, etk_entry_new(), id); return entry; }
static E_Widget * _e_widget_tool_toggle_button_handle(Enhance *en, EXML_Node *node) { E_Widget *tool_toggle_button; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; tool_toggle_button = _e_widget_new(en, node, etk_tool_toggle_button_new(), id); return tool_toggle_button; }
static E_Widget * _e_widget_iconview_handle(Enhance *en, EXML_Node *node) { E_Widget *iconbox; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; iconbox = _e_widget_new(en, node, etk_iconbox_new(), id); return iconbox; }
static E_Widget * _e_widget_filechooser_widget_handle(Enhance *en, EXML_Node *node) { E_Widget *filechooser; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; filechooser = _e_widget_new(en, node, etk_filechooser_widget_new(), id); return filechooser; }
static E_Widget * _e_widget_textview_handle(Enhance *en, EXML_Node *node) { E_Widget *tview; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; tview = _e_widget_new(en, node, etk_text_view_new(), id); return tview; }
static E_Widget * _e_widget_frame_handle(Enhance *en, EXML_Node *node) { E_Widget *frame; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; frame = _e_widget_new(en, node, etk_frame_new(NULL), id); return frame; }
static E_Widget * _e_widget_vseparator_handle(Enhance *en, EXML_Node *node) { E_Widget *sep; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; sep = _e_widget_new(en, node, etk_vseparator_new(), id); return sep; }
static E_Widget * _e_widget_combo_box_handle(Enhance *en, EXML_Node *node) { E_Widget *combo; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; combo = _e_widget_new(en, node, etk_combobox_new(), id); return combo; }
static E_Widget * _e_widget_menu_handle(Enhance *en, EXML_Node *node) { E_Widget *menu; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; menu = _e_widget_new(en, node, etk_menu_new(), id); return menu; }
static E_Widget * _e_widget_menu_image_item_handle(Enhance *en, EXML_Node *node) { E_Widget *item; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; item = _e_widget_new(en, node, etk_menu_item_image_new(), id); return item; }
static E_Widget * _e_widget_vpaned_handle(Enhance *en, EXML_Node *node) { E_Widget *paned; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; paned = _e_widget_new(en, node, etk_vpaned_new(), id); return paned; }
static E_Widget * _e_widget_label_handle(Enhance *en, EXML_Node *node) { E_Widget *label; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; label = _e_widget_new(en, node, etk_label_new(NULL), id); return label; }
/** * @param ext: The extension to look up * @return Returns the icon name for the given extension or NULL if none found * @brief Retrieve the icon name for the given extension or NULL if none found */ const char * ewl_io_manager_extension_icon_name_get(const char *ext) { char *ret = NULL; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET(ext, NULL); ret = ecore_hash_get(ewl_io_manager_ext_icon_map, ext); if (ret) DRETURN_PTR(ret, DLEVEL_STABLE); DRETURN_PTR(NULL, DLEVEL_STABLE); }
static E_Widget * _e_widget_statusbar_handle(Enhance *en, EXML_Node *node) { E_Widget *bar; char *id; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; bar = _e_widget_new(en, node, etk_statusbar_new(), id); return bar; }