/** * @param ini The Efreet_Ini to work with * @param section The section of the ini file we want to add * @return Returns no value * @brief Adds a new working section of the ini file to @a section */ EAPI void efreet_ini_section_add(Efreet_Ini *ini, const char *section) { Eina_Hash *hash; if (!ini || !section) return; if (!ini->data) ini->data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free)); if (eina_hash_find(ini->data, section)) return; hash = eina_hash_string_small_new(EINA_FREE_CB(eina_stringshare_del)); eina_hash_add(ini->data, section, hash); }
/** * @internal * @param datadirs List of XDG data dirs * @param datahome Path to XDG data home directory * @return Returns no value * @brief Read all glob files in XDG data/home dirs. * Also reads the /etc/mime.types file. */ static void efreet_mime_load_globs(Eina_List *datadirs, const char *datahome) { Eina_List *l; char buf[4096]; const char *datadir = NULL; IF_FREE_HASH(wild); wild = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); while (globs) { efreet_mime_glob_free(eina_list_data_get(globs)); globs = eina_list_remove_list(globs, globs); } /* * This is here for legacy reasons. It is mentioned briefly * in the spec and seems to still be quite valid. It is * loaded first so the globs files will override anything * in here. */ efreet_mime_mime_types_load("/etc/mime.types"); datadir = datahome; snprintf(buf, sizeof(buf), "%s/mime/globs", datadir); efreet_mime_shared_mimeinfo_globs_load(buf); EINA_LIST_FOREACH(datadirs, l, datadir) { snprintf(buf, sizeof(buf), "%s/mime/globs", datadir); efreet_mime_shared_mimeinfo_globs_load(buf); }
void efreet_cache_shutdown(void) { Efreet_Old_Cache *d; IF_RELEASE(theme_name); icon_cache = efreet_cache_close(icon_cache); icon_theme_cache = efreet_cache_close(icon_theme_cache); IF_FREE_HASH(themes); IF_FREE_HASH(icons); IF_FREE_HASH(fallbacks); IF_FREE_HASH_CB(desktops, EINA_FREE_CB(efreet_cache_desktop_free)); desktop_cache = efreet_cache_close(desktop_cache); IF_RELEASE(desktop_cache_file); efreet_cache_edd_shutdown(); IF_RELEASE(icon_theme_cache_file); if (old_desktop_caches) ERR("This application has not properly closed all its desktop references!"); EINA_LIST_FREE(old_desktop_caches, d) { eina_hash_free(d->hash); eet_close(d->ef); free(d); }
EAPI void efreet_mime_type_cache_clear(void) { if (mime_icons) { eina_hash_free(mime_icons); mime_icons_lru = NULL; } mime_icons = eina_hash_stringshared_new(EINA_FREE_CB(efreet_mime_icon_entry_head_free)); }
static Efl_Object* _eldbus_model_arguments_efl_object_constructor(Eo *obj, Eldbus_Model_Arguments_Data *pd) { obj = efl_constructor(efl_super(obj, MY_CLASS)); pd->obj = obj; pd->properties_array = NULL; pd->properties_hash = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free)); pd->pending_list = NULL; pd->proxy = NULL; pd->arguments = NULL; pd->name = NULL; return obj; }
Eina_Bool eet_loader_init(void) { if (!elixir_loader_register(&eet_loader)) return EINA_FALSE; eina_init(); eet_init(); stack = eina_array_new(4); cache = eina_hash_string_superfast_new(EINA_FREE_CB(_elixir_eet_filename_free)); return EINA_TRUE; }
EAPI Eina_Bool efreet_desktop_x_field_set(Efreet_Desktop *desktop, const char *key, const char *data) { EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), EINA_FALSE); if (!desktop->x) desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); eina_hash_del_by_key(desktop->x, key); eina_hash_add(desktop->x, key, eina_stringshare_add(data)); return EINA_TRUE; }
EAPI Eina_Bool efreet_desktop_x_field_set(Efreet_Desktop *desktop, const char *key, const char *data) { if (!desktop || strncmp(key, "X-", 2)) return EINA_FALSE; if (!desktop->x) desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); eina_hash_del_by_key(desktop->x, key); eina_hash_add(desktop->x, key, eina_stringshare_add(data)); return EINA_TRUE; }
Hist * hist_new() { Hist *hist = calloc(1, sizeof(Hist)); if (!hist) { fprintf(stderr, "ERROR: could not calloc Hist\n"); return NULL; } hist->items = eina_hash_stringshared_new(EINA_FREE_CB(hist_item_free)); return hist; }
Fav * fav_new() { Fav *fav = calloc(1, sizeof(Fav)); if (!fav) { fprintf(stderr, "ERROR: could not calloc Fav\n"); return NULL; } fav->items = eina_hash_stringshared_new(EINA_FREE_CB(fav_item_free)); return fav; }
int efreet_util_init(void) { if (init++) return init; _efreet_utils_log_dom = eina_log_domain_register ("efreet_util", EFREET_DEFAULT_LOG_COLOR); if (_efreet_utils_log_dom < 0) { ERROR("Efreet: Could not create a log domain for efreet_util"); return 0; } file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del)); return init; }
EAPI int efreet_mime_init(void) { if (++_efreet_mime_init_count != 1) return _efreet_mime_init_count; if (!ecore_init()) return --_efreet_mime_init_count; if (!ecore_file_init()) goto shutdown_ecore; if (!efreet_init()) goto shutdown_ecore_file; _efreet_mime_log_dom = eina_log_domain_register ("efreet_mime", EFREET_DEFAULT_LOG_COLOR); if (_efreet_mime_log_dom < 0) { EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_mime."); goto shutdown_efreet; } efreet_mime_endianess = efreet_mime_endian_check(); monitors = eina_hash_string_superfast_new(EINA_FREE_CB(ecore_file_monitor_del)); efreet_mime_type_cache_clear(); if (!efreet_mime_init_files()) goto unregister_log_domain; return _efreet_mime_init_count; unregister_log_domain: eina_log_domain_unregister(_efreet_mime_log_dom); _efreet_mime_log_dom = -1; shutdown_efreet: efreet_shutdown(); shutdown_ecore_file: ecore_file_shutdown(); shutdown_ecore: ecore_shutdown(); return --_efreet_mime_init_count; }
Hist * hist_load(const char *filename) { Hist *hist = NULL; Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ); if (!ef) { fprintf(stderr, "ERROR: could not open '%s' for read\n", filename); return NULL; } hist = eet_data_read(ef, _hist_descriptor, HIST_ENTRY); if (!hist) goto end; hist->__eet_filename = eina_stringshare_add(filename); if (!hist->items) hist->items = eina_hash_stringshared_new(EINA_FREE_CB(hist_item_free)); end: eet_close(ef); return hist; }
Fav * fav_load(const char *filename) { Fav *fav = NULL; Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ); if (!ef) { fprintf(stderr, "ERROR: could not open '%s' for read\n", filename); return NULL; } fav = eet_data_read(ef, _fav_descriptor, FAV_ENTRY); if (!fav) goto end; fav->__eet_filename = eina_stringshare_add(filename); if (!fav->items) fav->items = eina_hash_stringshared_new(EINA_FREE_CB(fav_item_free)); end: eet_close(ef); return fav; }
/** * @internal * @param file The file to parse * @return Returns an Eina_Hash with the contents of @a file, or NULL if the * file fails to parse or if the file doesn't exist * @brief Parses the ini file @a file into an Eina_Hash */ static Eina_Hash * efreet_ini_parse(const char *file) { Eina_Hash *data = NULL, *section = NULL; Eina_Iterator *it = NULL; Eina_File_Line *line; Eina_File *f; EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL); f = eina_file_open(file, EINA_FALSE); if (!f) return NULL; data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free)); if (!data) goto error; /* let's make mmap safe and just get 0 pages for IO erro */ eina_mmap_safety_enabled_set(EINA_TRUE); it = eina_file_map_lines(f); if (!it) goto error; EINA_ITERATOR_FOREACH(it, line) { const char *eq; unsigned int start = 0; /* skip empty lines */ if (line->length == 0) continue; /* skip white space at start of line */ while ((start < line->length) && (isspace((unsigned char)line->start[start]))) start++; /* skip empty lines */ if (start == line->length) continue; /* skip comments */ if (line->start[start] == '#') continue; /* new section */ if (line->start[start] == '[') { const char *head_start; const char *head_end; head_start = &(line->start[start]) + 1; head_end = memchr(line->start, ']', line->length); if (head_end) { char *header; size_t len; len = head_end - head_start + 1; header = alloca(len); memcpy(header, head_start, len - 1); header[len - 1] = '\0'; section = eina_hash_string_small_new(EINA_FREE_CB(eina_stringshare_del)); eina_hash_del_by_key(data, header); eina_hash_add(data, header, section); } else { /* invalid file - skip line? or refuse to parse file? */ /* just printf for now till we figure out what to do */ // ERR("Invalid file (%s) (missing ] on group name)", file); } continue; } if (!section) { INF("Invalid file (%s) (missing section)", file); goto error; } eq = memchr(line->start, '=', line->length); if (eq) { const char *key_start, *key_end; const char *value_start, *value_end; char *key, *value; size_t len; key_start = &(line->start[start]); key_end = eq - 1; /* trim whitespace from end of key */ while ((isspace((unsigned char)*key_end)) && (key_end > key_start)) key_end--; key_end++; /* make sure we have a key */ if (key_start == key_end) continue; value_start = eq + 1; value_end = line->end; /* line->end points to char after '\n' or '\r' */ value_end--; /* trim whitespace from end of value */ while ((isspace((unsigned char)*value_end)) && (value_end > value_start)) value_end--; value_end++; /* trim whitespace from start of value */ while ((isspace((unsigned char)*value_start)) && (value_start < value_end)) value_start++; len = key_end - key_start + 1; key = alloca(len); memcpy(key, key_start, len - 1); key[len - 1] = '\0'; /* empty value allowed */ if (value_end == value_start) { eina_hash_del_by_key(section, key); eina_hash_add(section, key, ""); } else { len = value_end - value_start + 1; value = alloca(len); memcpy(value, value_start, len - 1); value[len - 1] = '\0'; eina_hash_del_by_key(section, key); eina_hash_add(section, key, efreet_ini_unescape(value)); } } else { /* invalid file... */ INF("Invalid file (%s) (missing = from key=value pair)", file); goto error; } } eina_iterator_free(it); eina_file_close(f); #if 0 if (!eina_hash_population(data)) { eina_hash_free(data); return NULL; } #endif return data; error: if (data) eina_hash_free(data); if (it) eina_iterator_free(it); eina_file_close(f); return NULL; }
int efreet_cache_init(void) { char buf[PATH_MAX]; _efreet_cache_log_dom = eina_log_domain_register("efreet_cache", EFREET_DEFAULT_LOG_COLOR); if (_efreet_cache_log_dom < 0) return 0; if (!eina_lock_new(&_lock)) { ERR("Could not create lock"); goto error; } snprintf(buf, sizeof(buf), "%s/efreet", efreet_cache_home_get()); if (!ecore_file_mkpath(buf)) { ERR("Failed to create directory '%s'", buf); } EFREET_EVENT_ICON_CACHE_UPDATE = ecore_event_type_new(); EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new(); EFREET_EVENT_DESKTOP_CACHE_BUILD = ecore_event_type_new(); themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free)); icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free)); fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free)); desktops = eina_hash_string_superfast_new(NULL); eldbus_init(); if (efreet_cache_update) { conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); if (conn) { Eldbus_Object *obj; obj = eldbus_object_get(conn, BUS, PATH); proxy = eldbus_proxy_get(obj, INTERFACE); eldbus_proxy_signal_handler_add(proxy, "IconCacheUpdate", icon_cache_update, NULL); eldbus_proxy_signal_handler_add(proxy, "DesktopCacheUpdate", desktop_cache_update, NULL); eldbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, "s", efreet_language_get()); /* * TODO: Needed? eldbus_name_owner_changed_callback_add(conn, BUS, on_name_owner_changed, conn, EINA_TRUE); */ } else { /* TODO: Run cache process directly */ } } return 1; error: if (themes) eina_hash_free(themes); themes = NULL; if (icons) eina_hash_free(icons); icons = NULL; if (fallbacks) eina_hash_free(fallbacks); fallbacks = NULL; if (desktops) eina_hash_free(desktops); desktops = NULL; efreet_cache_edd_shutdown(); return 0; }
int main(int argc, char **argv) { /* TODO: * - Add file monitor on files, so that we catch changes on files * during whilst this program runs. * - Maybe linger for a while to reduce number of cache re-creates. */ Efreet_Cache_Hash hash; Efreet_Cache_Version version; Eina_List *dirs = NULL; Eina_List *systemdirs = NULL; Eina_List *extra_dirs = NULL; Eina_List *l = NULL; Eina_Inarray *stack = NULL; int priority = 0; char *dir = NULL; char *path; int lockfd = -1, tmpfd; int changed = 0; int i; char file[PATH_MAX] = { '\0' }; char util_file[PATH_MAX] = { '\0' }; mode_t um; if (!eina_init()) goto eina_error; _efreet_desktop_cache_log_dom = eina_log_domain_register("efreet_desktop_cache", EFREET_DEFAULT_LOG_COLOR); if (_efreet_desktop_cache_log_dom < 0) { EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_desktop_cache."); return -1; } for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v")) eina_log_domain_level_set("efreet_desktop_cache", EINA_LOG_LEVEL_DBG); else if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "--h")) || (!strcmp(argv[i], "--help"))) { printf("Options:\n"); printf(" -v Verbose mode\n"); printf(" -d dir1 dir2 Extra dirs\n"); exit(0); } else if (!strcmp(argv[i], "-d")) { while ((i < (argc - 1)) && (argv[(i + 1)][0] != '-')) extra_dirs = eina_list_append(extra_dirs, argv[++i]); } } extra_dirs = eina_list_sort(extra_dirs, -1, EINA_COMPARE_CB(strcmp)); #ifdef HAVE_SYS_RESOURCE_H setpriority(PRIO_PROCESS, 0, 19); #elif _WIN32 SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); #endif /* init external subsystems */ if (!eet_init()) goto eet_error; if (!ecore_init()) goto ecore_error; efreet_cache_update = 0; /* finish efreet init */ if (!efreet_init()) goto efreet_error; /* create homedir */ snprintf(file, sizeof(file), "%s/efreet", efreet_cache_home_get()); if (!ecore_file_exists(file)) { if (!ecore_file_mkpath(file)) goto efreet_error; efreet_setowner(file); } /* lock process, so that we only run one copy of this program */ lockfd = cache_lock_file(); if (lockfd == -1) goto efreet_error; edd = efreet_desktop_edd(); if (!edd) goto edd_error; /* read user dirs from old cache */ ef = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ); if (ef) { old_file_ids = eet_data_read(ef, efreet_hash_string_edd(), "file_id"); eet_close(ef); } /* create cache */ snprintf(file, sizeof(file), "%s.XXXXXX", efreet_desktop_cache_file()); /* set secure umask for temporary files */ um = umask(0077); tmpfd = mkstemp(file); umask(um); if (tmpfd < 0) goto error; close(tmpfd); ef = eet_open(file, EET_FILE_MODE_READ_WRITE); if (!ef) goto error; snprintf(util_file, sizeof(util_file), "%s.XXXXXX", efreet_desktop_util_cache_file()); /* set secure umask for temporary files */ um = umask(0077); tmpfd = mkstemp(util_file); umask(um); if (tmpfd < 0) goto error; close(tmpfd); util_ef = eet_open(util_file, EET_FILE_MODE_READ_WRITE); if (!util_ef) goto error; /* write cache version */ version.major = EFREET_DESKTOP_UTILS_CACHE_MAJOR; version.minor = EFREET_DESKTOP_UTILS_CACHE_MINOR; eet_data_write(util_ef, efreet_version_edd(), EFREET_CACHE_VERSION, &version, 1); version.major = EFREET_DESKTOP_CACHE_MAJOR; version.minor = EFREET_DESKTOP_CACHE_MINOR; eet_data_write(ef, efreet_version_edd(), EFREET_CACHE_VERSION, &version, 1); desktops = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free)); file_ids = eina_hash_string_superfast_new(NULL); paths = eina_hash_string_superfast_new(NULL); mime_types = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); categories = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); startup_wm_class = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); name = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); generic_name = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); comment = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); exec = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_array_string_free)); dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(), "applications"); if (!dirs) goto error; stack = eina_inarray_new(sizeof(struct stat), 16); if (!stack) goto error; EINA_LIST_FREE(dirs, path) { char file_id[PATH_MAX] = { '\0' }; eina_inarray_flush(stack); if (!cache_scan(stack, path, file_id, priority++, 1, &changed)) goto error; systemdirs = eina_list_append(systemdirs, path); }
/** * @internal * @param file The file to parse * @return Returns an Eina_Hash with the contents of @a file, or NULL if the * file fails to parse or if the file doesn't exist * @brief Parses the ini file @a file into an Eina_Hash */ static Eina_Hash * efreet_ini_parse(const char *file) { const char *buffer, *line_start; FILE *f; Eina_Hash *data, *section = NULL; struct stat file_stat; int line_length, left; if (!file) return NULL; f = fopen(file, "rb"); if (!f) return NULL; if (fstat(fileno(f), &file_stat) || (file_stat.st_size < 1)) { fclose(f); return NULL; } if (!S_ISREG(file_stat.st_mode)) /* if not a regular file - close */ { fclose(f); return NULL; } left = file_stat.st_size; buffer = mmap(NULL, left, PROT_READ, MAP_SHARED, fileno(f), 0); if (buffer == MAP_FAILED) { fclose(f); return NULL; } data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free)); line_start = buffer; while (left > 0) { int sep; /* find the end of line */ for (line_length = 0; (line_length < left) && (line_start[line_length] != '\n'); line_length++) ; /* check for all white space */ while (isspace(line_start[0]) && (line_length > 0)) { line_start++; line_length--; } /* skip empty lines and comments */ if ((line_length == 0) || (line_start[0] == '\r') || (line_start[0] == '\n') || (line_start[0] == '#') || (line_start[0] == '\0')) goto next_line; /* new section */ if (line_start[0] == '[') { int header_length; /* find the ']' */ for (header_length = 1; (header_length < line_length) && (line_start[header_length] != ']'); ++header_length) ; if (line_start[header_length] == ']') { const char *header; header = alloca(header_length * sizeof(unsigned char)); if (!header) goto next_line; memcpy((char*)header, line_start + 1, header_length - 1); ((char*)header)[header_length - 1] = '\0'; section = eina_hash_string_small_new(EINA_FREE_CB(eina_stringshare_del)); eina_hash_del_by_key(data, header); // if (old) INF("[efreet] Warning: duplicate section '%s' " // "in file '%s'", header, file); eina_hash_add(data, header, section); } else { /* invalid file - skip line? or refuse to parse file? */ /* just printf for now till we figure out what to do */ // printf("Invalid file (%s) (missing ] on group name)\n", file); } goto next_line; } if (!section) { // INF("Invalid file (%s) (missing section)", file); goto next_line; } /* find for '=' */ for (sep = 0; (sep < line_length) && (line_start[sep] != '='); ++sep) ; if (sep < line_length) { char *key, *value; int key_end, value_start, value_end; /* trim whitespace from end of key */ for (key_end = sep - 1; (key_end > 0) && isspace(line_start[key_end]); --key_end) ; if (!isspace(line_start[key_end])) key_end++; /* trim whitespace from start of value */ for (value_start = sep + 1; (value_start < line_length) && isspace(line_start[value_start]); ++value_start) ; /* trim \n off of end of value */ for (value_end = line_length; (value_end > value_start) && ((line_start[value_end] == '\n') || (line_start[value_end] == '\r')); --value_end) ; if (line_start[value_end] != '\n' && line_start[value_end] != '\r' && value_end < line_length) value_end++; /* make sure we have a key. blank values are allowed */ if (key_end == 0) { /* invalid file... */ // INF("Invalid file (%s) (invalid key=value pair)", file); goto next_line; } key = alloca(key_end + 1); value = alloca(value_end - value_start + 1); if (!key || !value) goto next_line; memcpy(key, line_start, key_end); key[key_end] = '\0'; memcpy(value, line_start + value_start, value_end - value_start); value[value_end - value_start] = '\0'; eina_hash_del_by_key(section, key); eina_hash_add(section, key, efreet_ini_unescape(value)); } // else // { // /* invalid file... */ // INF("Invalid file (%s) (missing = from key=value pair)", file); // } next_line: left -= line_length + 1; line_start += line_length + 1; } munmap((char*) buffer, file_stat.st_size); fclose(f); #if 0 if (!eina_hash_population(data)) { eina_hash_free(data); return NULL; } #endif return data; }
void * unmarshal_device_get_all_properties(DBusMessage *msg, DBusError *err) { E_Ukit_Get_All_Properties_Return *ret = NULL; DBusMessageIter iter, a_iter, s_iter, v_iter; int type; char *tmp; /* a{sv} = array of string+variants */ if (!dbus_message_has_signature(msg, "a{sv}")) { dbus_set_error(err, DBUS_ERROR_INVALID_SIGNATURE, ""); return NULL; } ret = calloc(1, sizeof(E_Ukit_Get_All_Properties_Return)); if (!ret) { dbus_set_error(err, DBUS_ERROR_NO_MEMORY, ""); return NULL; } ret->properties = eina_hash_string_small_new(EINA_FREE_CB(e_ukit_property_free)); dbus_message_iter_init(msg, &iter); dbus_message_iter_recurse(&iter, &a_iter); while (dbus_message_iter_get_arg_type(&a_iter) != DBUS_TYPE_INVALID) { const char *name; E_Ukit_Property *prop = calloc(1, sizeof(E_Ukit_Property)); dbus_message_iter_recurse(&a_iter, &s_iter); dbus_message_iter_get_basic(&s_iter, &name); dbus_message_iter_next(&s_iter); dbus_message_iter_recurse(&s_iter, &v_iter); type = dbus_message_iter_get_arg_type(&v_iter); switch(type) { case DBUS_TYPE_STRING: prop->type = E_UKIT_PROPERTY_TYPE_STRING; dbus_message_iter_get_basic(&v_iter, &tmp); prop->val.s = eina_stringshare_add(tmp); break; case DBUS_TYPE_INT32: prop->type = E_UKIT_PROPERTY_TYPE_INT; dbus_message_iter_get_basic(&v_iter, &(prop->val.i)); break; case DBUS_TYPE_UINT32: prop->type = E_UKIT_PROPERTY_TYPE_UINT32; dbus_message_iter_get_basic(&v_iter, &(prop->val.u)); break; case DBUS_TYPE_UINT64: prop->type = E_UKIT_PROPERTY_TYPE_UINT64; dbus_message_iter_get_basic(&v_iter, &(prop->val.t)); break; case DBUS_TYPE_INT64: prop->type = E_UKIT_PROPERTY_TYPE_INT64; dbus_message_iter_get_basic(&v_iter, &(prop->val.x)); break; case DBUS_TYPE_BOOLEAN: prop->type = E_UKIT_PROPERTY_TYPE_BOOL; dbus_message_iter_get_basic(&v_iter, &(prop->val.b)); break; case DBUS_TYPE_DOUBLE: prop->type = E_UKIT_PROPERTY_TYPE_DOUBLE; dbus_message_iter_get_basic(&v_iter, &(prop->val.d)); break; case DBUS_TYPE_ARRAY: prop->type = E_UKIT_PROPERTY_TYPE_STRLIST; { DBusMessageIter list_iter; prop->val.strlist = NULL; dbus_message_iter_recurse(&v_iter, &list_iter); while (dbus_message_iter_get_arg_type(&list_iter) != DBUS_TYPE_INVALID) { char *str; dbus_message_iter_get_basic(&list_iter, &str); tmp = (char*)eina_stringshare_add(str); prop->val.strlist = eina_list_append(prop->val.strlist, tmp); dbus_message_iter_next(&list_iter); } } break; default: WARN("EUkit Error: unexpected property type (%s): %c", name, dbus_message_iter_get_arg_type(&v_iter)); break; } eina_hash_add(ret->properties, name, prop); dbus_message_iter_next(&a_iter); } return ret; }