/* Add or Update Contact details */ static void add_update_user(Db_Entry NewContact) { Db_Entry *entry; if (App.editing) { Db_Entry *contact; contact = elm_list_item_data_get(App.selection); /* Replace strings on memory */ eina_stringshare_replace(&(contact->Name), NewContact.Name); eina_stringshare_replace(&(contact->Email), NewContact.Email); eina_stringshare_replace(&(contact->Phone), NewContact.Phone); eina_stringshare_replace(&(contact->Street), NewContact.Street); eina_stringshare_replace(&(contact->Neighborhood), NewContact.Neighborhood); contact->Gender = NewContact.Gender; /* Update Elementary List */ elm_list_item_label_set(App.selection, NewContact.Name); } else { /* Add New Entry on DB */ entry = db_append(App._db, NewContact); elm_list_item_append(App.contactlist, entry->Name, NULL, NULL, NULL, entry); elm_list_go(App.contactlist); } }
EOLIAN static void _efl_net_control_technology_efl_object_destructor(Eo *o, Efl_Net_Control_Technology_Data *pd) { Eldbus_Pending *p; Eldbus_Signal_Handler *sh; EINA_LIST_FREE(pd->pending, p) eldbus_pending_cancel(p); EINA_LIST_FREE(pd->signal_handlers, sh) eldbus_signal_handler_del(sh); if (pd->proxy) { Eldbus_Object *obj = eldbus_proxy_object_get(pd->proxy); eldbus_proxy_unref(pd->proxy); pd->proxy = NULL; eldbus_object_unref(obj); } efl_destructor(efl_super(o, MY_CLASS)); eina_stringshare_replace(&pd->path, NULL); eina_stringshare_replace(&pd->name, NULL); eina_stringshare_replace(&pd->tethering.identifier, NULL); eina_stringshare_replace(&pd->tethering.passphrase, NULL); }
EAPI Eina_Bool emotion_object_file_set(Evas_Object *obj, const char *file) { Smart_Data *sd; E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE); DBG("file=%s", file); if (!eina_stringshare_replace(&sd->file, file)) return EINA_TRUE; if (!sd->engine_instance) { WRN("No engine choosen. Call emotion_object_init()?"); return EINA_FALSE; } sd->video.w = 0; sd->video.h = 0; if ((file) && (file[0] != 0)) { eina_stringshare_replace(&sd->file, file); emotion_engine_instance_file_close(sd->engine_instance); evas_object_image_data_set(sd->obj, NULL); evas_object_image_size_set(sd->obj, 1, 1); _emotion_image_data_zero(sd->obj); sd->open = 0; if (!emotion_engine_instance_file_open(sd->engine_instance, sd->file)) { WRN("Couldn't open file=%s", sd->file); return EINA_FALSE; } DBG("successfully opened file=%s", sd->file); sd->pos = 0.0; if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0); } else { emotion_engine_instance_file_close(sd->engine_instance); evas_object_image_data_set(sd->obj, NULL); evas_object_image_size_set(sd->obj, 1, 1); _emotion_image_data_zero(sd->obj); eina_stringshare_replace(&sd->file, NULL); } if (sd->anim) ecore_animator_del(sd->anim); sd->anim = NULL; #ifdef HAVE_EIO /* Only cancel the load_xattr or we will loose ref to time_seek stringshare */ if (sd->load_xattr) eio_file_cancel(sd->load_xattr); sd->load_xattr = NULL; if (sd->save_xattr) eio_file_cancel(sd->save_xattr); sd->save_xattr = NULL; #endif return EINA_TRUE; }
static void _fsel_path_save(E_Import_Dialog *id) { const char *fdev = NULL, *fpath = NULL; e_widget_fsel_path_get(id->fsel_obj, &fdev, &fpath); if ((fdev) || (fpath)) { eina_stringshare_replace(&e_config->wallpaper_import_last_dev, fdev); eina_stringshare_replace(&e_config->wallpaper_import_last_path, fpath); e_config_save_queue(); } }
static void _e_icon_obj_prepare(Evas_Object *obj, E_Smart_Data *sd) { if (!sd->obj) return; if (sd->edje) { Evas_Object *pclip; pclip = evas_object_clip_get(sd->obj); evas_object_del(sd->obj); #ifdef USE_ICON_CACHE sd->ci = NULL; eina_stringshare_replace(&sd->file, NULL); #endif sd->obj = evas_object_image_add(evas_object_evas_get(obj)); if (!sd->animated) evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_STATIC); evas_object_smart_member_add(sd->obj, obj); evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED, _e_icon_preloaded, obj); evas_object_clip_set(sd->obj, pclip); } }
void ewk_settings_web_database_path_set(const char* path) { #if ENABLE(SQL_DATABASE) WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(WTF::String::fromUTF8(path)); eina_stringshare_replace(&s_webDatabasePath, path); #endif }
static Eina_List * _font_list_get(const Evas *e) { Eina_List *flist = evas_font_available_list(e); Eina_List *itr, *nitr; const char *font, *prev_font = NULL; flist = eina_list_sort(flist, eina_list_count(flist), (Eina_Compare_Cb) strcasecmp); EINA_LIST_FOREACH_SAFE(flist, itr, nitr, font) { Elm_Font_Properties *efp; efp = elm_font_properties_get(font); /* Remove dups */ if (prev_font && !strcmp(efp->name, prev_font)) { flist = eina_list_remove_list(flist, itr); } else { eina_stringshare_replace(&font, efp->name); prev_font = font; eina_list_data_set(itr, font); } elm_font_properties_free(efp); }
/** * @brief Set the currently active database * This function calls all necessary functions to switch databases to * @p database_name. After it is called, all subsequent queries should be assumed * to be directed at database specified by @p database_name. * @note This function should always be called before esql_connect to ensure portability. * @param e The #Esql object (NOT NULL) * @param database_name The database name * @return EINA_TRUE on successful queue of the action, else EINA_FALSE */ Eina_Bool esql_database_set(Esql *e, const char *database_name) { DBG("(e=%p, database_name='%s')", e, database_name); EINA_SAFETY_ON_NULL_RETURN_VAL(e, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(database_name, EINA_FALSE); if (e->database && (e->type != ESQL_TYPE_MYSQL)) { ERR("Database switching is not supported by this database type!"); return EINA_FALSE; } eina_stringshare_replace(&e->database, database_name); if (e->pool) return esql_pool_database_set((Esql_Pool *)e, database_name); if (!e->backend.database_set) return EINA_TRUE; if ((!e->current) && e->connected) { e->backend.database_set(e, database_name); e->current = ESQL_CONNECT_TYPE_DATABASE_SET; } else { e->backend_set_funcs = eina_list_append(e->backend_set_funcs, esql_database_set); e->backend_set_params = eina_list_append(e->backend_set_params, strdup(database_name)); e->backend_ids = eina_list_append(e->backend_ids, e); } return EINA_TRUE; }
/** * @brief Frees an allocated Store structure. * @param store Store structure to free. */ void store_free(Store *store) { EINA_SAFETY_ON_NULL_RETURN(store); eina_stringshare_replace(&store->url, NULL); free(store); }
const char* ewk_url_response_url_get(const Ewk_Url_Response* response) { EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); eina_stringshare_replace(&ewkResponse->url, response->coreResponse.url().string().utf8().data()); return response->url; }
const char* ewk_url_response_mime_type_get(const Ewk_Url_Response* response) { EINA_SAFETY_ON_NULL_RETURN_VAL(response, 0); Ewk_Url_Response* ewkResponse = const_cast<Ewk_Url_Response*>(response); eina_stringshare_replace(&ewkResponse->mimeType, response->coreResponse.mimeType().utf8().data()); return response->mimeType; }
static void _elm_panes_smart_theme(Eo *obj, void *_pd, va_list *list) { double size; Evas_Coord minw = 0, minh = 0; Elm_Panes_Smart_Data *sd = _pd; Eina_Bool *ret = va_arg(*list, Eina_Bool *); if (ret) *ret = EINA_FALSE; Eina_Bool int_ret = EINA_FALSE; ELM_LAYOUT_DATA_GET(obj, ld); if (sd->horizontal) eina_stringshare_replace(&ld->group, "horizontal"); else eina_stringshare_replace(&ld->group, "vertical"); evas_object_hide(sd->event); elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_size_hint_min_set(sd->event, minw, minh); eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret)); if (!int_ret) return; size = elm_panes_content_left_size_get(obj); if (sd->fixed) { elm_layout_signal_emit(obj, "elm,panes,fixed", "elm"); //TODO: remove this signal on EFL 2.0. // I left this due to the backward compatibility. elm_layout_signal_emit(obj, "elm.panes.fixed", "elm"); } elm_layout_sizing_eval(obj); elm_panes_content_left_size_set(obj, size); if (ret) *ret = EINA_TRUE; }
/** * Sets the current path to the directory WebKit will write Web * Database databases. * * @path: the new database directory path * */ void ewk_settings_web_database_path_set(const char *path) { #if ENABLE(DATABASE) WTF::String corePath = WTF::String::fromUTF8(path); WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath); if (!_ewk_default_web_database_path) _ewk_default_web_database_path = eina_stringshare_add(corePath.utf8().data()); else eina_stringshare_replace(&_ewk_default_web_database_path, corePath.utf8().data()); #endif }
EAPI Eina_Bool e_icon_fdo_icon_set(Evas_Object *obj, const char *icon) { E_Smart_Data *sd; const char *path; int len; if (!icon) return EINA_FALSE; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0); if (icon[0] == '/') return e_icon_file_set(obj, icon); if (!(sd = evas_object_smart_data_get(obj))) return EINA_FALSE; if (sd->timer) ecore_timer_del(sd->timer); sd->timer = NULL; if (sd->guessing_animation) ecore_timer_del(sd->guessing_animation); sd->guessing_animation = NULL; sd->frame = 0; sd->frame_count = 0; sd->edje = EINA_FALSE; eina_stringshare_replace(&sd->fdo, icon); if (!sd->fdo) return EINA_FALSE; path = efreet_icon_path_find(e_config->icon_theme, sd->fdo, sd->size); if (!path) return EINA_FALSE; len = strlen(icon); if ((len > 4) && (!strcasecmp(icon + len - 4, ".edj"))) return e_icon_file_edje_set(obj, path, "icon"); /* smart code here */ _e_icon_obj_prepare(obj, sd); sd->loading = 0; if (sd->size != 0) evas_object_image_load_size_set(sd->obj, sd->size, sd->size); if (sd->preload) evas_object_hide(sd->obj); evas_object_image_file_set(sd->obj, path, NULL); if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE) return EINA_FALSE; if (sd->preload) { sd->loading = 1; evas_object_image_preload(sd->obj, 0); } else if (evas_object_visible_get(obj)) evas_object_show(sd->obj); _e_icon_smart_reconfigure(sd); return EINA_TRUE; }
static void _icon_thumb_done(Ethumb_Client *client, const char *thumb_path, const char *thumb_key, void *data) { Elm_Icon_Smart_Data *sd = data; if (EINA_UNLIKELY(!sd->thumb.request)) { ERR("Something odd happened with a thumbnail request"); return; } _icon_pending_request--; sd->thumb.request = NULL; eina_stringshare_replace(&sd->thumb.thumb.path, thumb_path); eina_stringshare_replace(&sd->thumb.thumb.key, thumb_key); sd->thumb.format = ethumb_client_format_get(client); _icon_thumb_finish(sd, client); }
EAPI void ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_name) { struct wl_cursor *cursor; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!input) return; _pointer_update_stop(input); eina_stringshare_replace(&input->cursor_name, cursor_name); /* No cursor. Set to default Left Pointer */ if (!cursor_name) eina_stringshare_replace(&input->cursor_name, "left_ptr"); /* try to get this cursor from the theme */ if (!(cursor = ecore_wl_cursor_get(input->cursor_name))) { /* if the theme does not have this cursor, default to left pointer */ if (!(cursor = ecore_wl_cursor_get("left_ptr"))) return; } input->cursor = cursor; if ((!cursor->images) || (!cursor->images[0])) { ecore_wl_input_pointer_set(input, NULL, 0, 0); return; } input->cursor_current_index = 0; _ecore_wl_input_cursor_update(input); }
EOLIAN static void _efl_net_dialer_simple_efl_io_buffered_stream_inner_io_set(Eo *o, Efl_Net_Dialer_Simple_Data *pd, Efl_Object *io) { EINA_SAFETY_ON_FALSE_RETURN(efl_isa(io, EFL_NET_DIALER_INTERFACE)); efl_io_buffered_stream_inner_io_set(efl_super(o, MY_CLASS), io); efl_event_callback_array_add(io, _efl_net_dialer_simple_inner_io_cbs(), o); /* apply pending dialer values */ if (pd->pending.proxy_url) { pd->pending.proxy_url = EINA_FALSE; efl_net_dialer_proxy_set(io, pd->proxy_url); eina_stringshare_replace(&pd->proxy_url, NULL); } if (pd->pending.dial_timeout) { pd->pending.dial_timeout = EINA_FALSE; efl_net_dialer_timeout_dial_set(io, pd->dial_timeout); } /* apply pending io buffered stream (own) values */ if (pd->pending.timeout_inactivity) { pd->pending.timeout_inactivity = EINA_FALSE; efl_io_buffered_stream_timeout_inactivity_set(o, pd->timeout_inactivity); } if (pd->pending.max_queue_size_input) { pd->pending.max_queue_size_input = EINA_FALSE; efl_io_buffered_stream_max_queue_size_input_set(o, pd->max_queue_size_input); } if (pd->pending.max_queue_size_output) { pd->pending.max_queue_size_output = EINA_FALSE; efl_io_buffered_stream_max_queue_size_output_set(o, pd->max_queue_size_output); } if (pd->pending.read_chunk_size) { pd->pending.read_chunk_size = EINA_FALSE; efl_io_buffered_stream_read_chunk_size_set(o, pd->read_chunk_size); } if (pd->pending.line_delimiter) { pd->pending.line_delimiter = EINA_FALSE; efl_io_buffered_stream_line_delimiter_set(o, pd->line_delimiter); free((void *)pd->line_delimiter.mem); pd->line_delimiter.mem = NULL; } }
static void _efl_net_control_technology_property_name_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value) { const char *name; if (!eldbus_message_iter_arguments_get(value, "s", &name)) { ERR("Expected string, got %s", eldbus_message_iter_signature_get(value)); return; } if (!eina_stringshare_replace(&pd->name, name)) return; DBG("name=%s", name); efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL); }
EAPI void ecore_wl_input_cursor_theme_name_set(Ecore_Wl_Input *input, const char *cursor_theme_name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!input) return; eina_stringshare_replace(&input->cursor_theme_name, cursor_theme_name); EINA_SAFETY_ON_NULL_RETURN(input->display->wl.shm); input->display->cursor_theme = wl_cursor_theme_load(input->cursor_theme_name, input->cursor_size, input->display->wl.shm); }
static Eina_Bool _elm_fileselector_button_smart_theme(Evas_Object *obj) { char buf[4096]; const char *style; ELM_FILESELECTOR_BUTTON_DATA_GET(obj, sd); style = eina_stringshare_add(elm_widget_style_get(obj)); snprintf(buf, sizeof(buf), "fileselector_button/%s", style); /* file selector button's style has an extra bit */ eina_stringshare_replace(&(ELM_WIDGET_DATA(sd)->style), buf); if (!ELM_WIDGET_CLASS(_elm_fileselector_button_parent_sc)->theme(obj)) return EINA_FALSE; eina_stringshare_replace(&(ELM_WIDGET_DATA(sd)->style), style); eina_stringshare_del(style); return EINA_TRUE; }
Eina_Bool ewk_settings_icon_database_path_set(const char* directory) { WebCore::IconDatabase::delayDatabaseCleanup(); if (directory) { if (WebCore::iconDatabase().isEnabled()) { ERR("IconDatabase is already open: %s", _ewk_icon_database_path); return false; } struct stat st; if (stat(directory, &st)) { ERR("could not stat(%s): %s", directory, strerror(errno)); return false; } if (!S_ISDIR(st.st_mode)) { ERR("not a directory: %s", directory); return false; } if (access(directory, R_OK | W_OK)) { ERR("could not access directory '%s' for read and write: %s", directory, strerror(errno)); return false; } WebCore::iconDatabase().setEnabled(true); WebCore::iconDatabase().open(WTF::String::fromUTF8(directory), WebCore::IconDatabase::defaultDatabaseFilename()); eina_stringshare_replace(&_ewk_icon_database_path, directory); } else { WebCore::iconDatabase().setEnabled(false); WebCore::iconDatabase().close(); eina_stringshare_del(_ewk_icon_database_path); _ewk_icon_database_path = 0; } return true; }
uint8_t * untag_string(Pulse_Tag *tag, const char **val) { uint8_t *ret; ret = tag->data + tag->size; switch (*ret) { case PA_TAG_STRING: eina_stringshare_replace(val, (char*)ret + 1); ret += PA_TAG_SIZE_STRING + strlen(*val); break; case PA_TAG_STRING_NULL: *val = NULL; ret += PA_TAG_SIZE_STRING_NULL; break; default: return 0; } tag->size = ret - tag->data; return ret; }
/** * Sets directory where to store icon database, opening database. * * @param directory where to store icon database, must be * write-able. If @c NULL is given, then database is closed. * * @return @c EINA_TRUE on success, @c EINA_FALSE on errors. */ Eina_Bool ewk_settings_icon_database_path_set(const char *directory) { WebCore::iconDatabase()->delayDatabaseCleanup(); if (directory) { struct stat st; if (stat(directory, &st)) { ERR("could not stat(%s): %s", directory, strerror(errno)); return EINA_FALSE; } if (!S_ISDIR(st.st_mode)) { ERR("not a directory: %s", directory); return EINA_FALSE; } if (access(directory, R_OK | W_OK)) { ERR("could not access directory '%s' for read and write: %s", directory, strerror(errno)); return EINA_FALSE; } WebCore::iconDatabase()->setEnabled(true); WebCore::iconDatabase()->open(WTF::String::fromUTF8(directory)); if (!_ewk_icon_database_path) _ewk_icon_database_path = eina_stringshare_add(directory); else eina_stringshare_replace(&_ewk_icon_database_path, directory); } else { WebCore::iconDatabase()->setEnabled(false); WebCore::iconDatabase()->close(); if (_ewk_icon_database_path) { eina_stringshare_del(_ewk_icon_database_path); _ewk_icon_database_path = 0; } } return EINA_TRUE; }
int main(int argc, char **argv) { const char *str, *str2; const char *prologe = "The Cylons were created by man. They rebelled. They " "evolved."; const char *prologe2 = "%d Cylon models. %d are known. %d live in secret. " "%d will be revealed."; const char *prologe3 = "There are many copies. And they have a plan."; eina_init(); str = eina_stringshare_add_length(prologe, 31); printf("%s\n", str); printf("length: %d\n", eina_stringshare_strlen(str)); eina_stringshare_del(str); str = eina_stringshare_printf(prologe2, 12, 7, 4, 1); printf("%s\n", str); eina_stringshare_del(str); str = eina_stringshare_nprintf(45, "%s", prologe3); printf("%s\n", str); str2 = eina_stringshare_add(prologe3); printf("%s\n", str2); eina_stringshare_ref(str2); eina_stringshare_del(str2); printf("%s\n", str2); eina_stringshare_replace(&str, prologe); printf("%s\n", str); eina_stringshare_del(str); eina_stringshare_del(str2); eina_shutdown(); return 0; }
EOLIAN static void _efl_net_dialer_simple_efl_object_destructor(Eo *o, Efl_Net_Dialer_Simple_Data *pd) { Eo *inner_io; if (pd->inner_class) pd->inner_class = NULL; eina_stringshare_replace(&pd->proxy_url, NULL); if (pd->line_delimiter.mem) { free((void *)pd->line_delimiter.mem); pd->line_delimiter.mem = NULL; } inner_io = efl_io_buffered_stream_inner_io_get(o); if (inner_io) { efl_event_callback_array_del(inner_io, _efl_net_dialer_simple_inner_io_cbs(), o); if (efl_parent_get(inner_io) == o) efl_parent_set(inner_io, NULL); } efl_destructor(efl_super(o, EFL_NET_DIALER_SIMPLE_CLASS)); }
void ewk_settings_css_media_type_set(const char* type) { eina_stringshare_replace(&s_cssMediaType, type); }
void ewk_settings_application_cache_path_set(const char* path) { WebCore::cacheStorage().setCacheDirectory(WTF::String::fromUTF8(path)); eina_stringshare_replace(&s_offlineAppCachePath, path); }
void ewk_settings_local_storage_path_set(const char* path) { WebCore::StorageTracker::tracker().setDatabaseDirectoryPath(WTF::String::fromUTF8(path)); eina_stringshare_replace(&s_localStoragePath, path); }
void shotgun_servername_set(Shotgun_Auth *auth, const char *svr_name) { eina_stringshare_replace(&auth->svr_name, svr_name); }
void shotgun_password_set(Shotgun_Auth *auth, const char *password) { EINA_SAFETY_ON_NULL_RETURN(auth); eina_stringshare_replace(&auth->pass, password); }