/** * @brief Convert result to a string * @param res Result * @return Stringshared result */ const char * esql_res_to_string(Esql_Res *res) { Esql_Row *row; Esql_Cell *cell; EINA_SAFETY_ON_NULL_RETURN_VAL(res, NULL); EINA_SAFETY_ON_TRUE_RETURN_VAL(res->row_count > 1, NULL); if (!res->row_count) return NULL; row = EINA_INLIST_CONTAINER_GET(res->rows, Esql_Row); cell = EINA_INLIST_CONTAINER_GET(row->cells, Esql_Cell); EINA_SAFETY_ON_TRUE_RETURN_VAL( (cell->type != ESQL_CELL_TYPE_STRING) && (cell->type != ESQL_CELL_TYPE_UNKNOWN), NULL); return eina_stringshare_add(cell->value.string); }
EAPI const char * efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key) { const char *ret; EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(desktop->x, NULL); EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), NULL); ret = eina_hash_find(desktop->x, key); if (!ret) return NULL; return eina_stringshare_add(ret); }
static void _rename_done_cb(void *data, Eio_File *handler) { Enna_Localfiles_Priv *priv = data; const char *new_path = priv->new_path; const char *new_uri; const char *new_mrl; new_uri = eina_stringshare_printf("%s/%s", ecore_file_dir_get(priv->file_dialog->uri), ecore_file_file_get(new_path)); new_mrl = eina_stringshare_printf("%s/%s", ecore_file_dir_get(priv->file_dialog->mrl), ecore_file_file_get(new_path)); priv->file_dialog->name = eina_stringshare_add(ecore_file_dir_get(new_path)); priv->file_dialog->uri = new_uri; priv->file_dialog->label = eina_stringshare_add(ecore_file_file_get(new_path)); priv->file_dialog->mrl = new_mrl; enna_browser_file_update(priv->browser, priv->file_dialog); eina_stringshare_del(new_path); priv->new_path = NULL; }
EMap_Route *emap_route_gpx_new(const char *file) { if(!file) { ERR("File is null"); return NULL; } EMap_Route *route = emap_route_new(EMAP_TRACK_TYPE_GPX); route->gpx.file = eina_stringshare_add(file); _parse(route); return route; }
EAPI void e_init_status_set(const char *str) { if (!init_exe) return; // printf("---STAT %p %s\n", client, str); if (!client) { stats = eina_list_append(stats, eina_stringshare_add(str)); return; } // printf("---SEND\n"); ecore_ipc_client_send(client, E_IPC_DOMAIN_INIT, 1, 0, 0, 0, (void *)str, strlen(str) + 1); ecore_ipc_client_flush(client); }
static void _fill_list (Evasxx::Object *obj) { DIR *d; struct dirent *de; Eina_List *dirs = NULL, *l; char *real; if (!(d = opendir(getenv("HOME")))) return; while ((de = readdir(d)) != NULL) { char buff[PATH_MAX]; if (de->d_name[0] == '.') continue; snprintf(buff, sizeof(buff), "%s/%s", getenv("HOME"), de->d_name); if (!ecore_file_is_dir(buff)) continue; real = ecore_file_realpath(buff); dirs = eina_list_append(dirs, real); } closedir(d); dirs = eina_list_sort(dirs, eina_list_count(dirs), EINA_COMPARE_CB(strcoll)); #if 0 EINA_LIST_FOREACH(dirs, l, real) { Eina_Bool result = EINA_FALSE; result = _dir_has_subs(real); if (!result) elm_genlist_item_append(obj, &itc, eina_stringshare_add(real), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); else elm_genlist_item_append(obj, &itc, eina_stringshare_add(real), NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); free(real); }
EAPI const char * eeze_udev_syspath_get_subsystem(const char *syspath) { _udev_device *device; const char *subsystem; if (!syspath) return NULL; if (!(device = _new_device(syspath))) return NULL; subsystem = eina_stringshare_add(udev_device_get_property_value(device, "SUBSYSTEM")); udev_device_unref(device); return subsystem; }
E_API E_Drag * e_drag_new(int x, int y, const char **types, unsigned int num_types, void *data, int size, void *(*convert_cb)(E_Drag * drag, const char *type), void (*finished_cb)(E_Drag *drag, int dropped)) { E_Drag *drag; unsigned int i; /* No need to create a drag object without type */ if ((!types) || (!num_types)) return NULL; drag = e_object_alloc(sizeof(E_Drag) + num_types * sizeof(char *), E_DRAG_TYPE, E_OBJECT_CLEANUP_FUNC(_e_drag_free)); if (!drag) return NULL; drag->x = x; drag->y = y; drag->w = 24; drag->h = 24; drag->layer = E_LAYER_CLIENT_DRAG; drag->evas = e_comp->evas; drag->type = E_DRAG_NONE; for (i = 0; i < num_types; i++) drag->types[i] = eina_stringshare_add(types[i]); drag->num_types = num_types; drag->data = data; drag->data_size = size; drag->cb.convert = convert_cb; drag->cb.finished = finished_cb; _drag_list = eina_list_append(_drag_list, drag); #ifndef HAVE_WAYLAND_ONLY if (e_comp_util_has_x()) ecore_x_window_shadow_tree_flush(); #endif _drag_win_root = e_comp->root; drag->cb.key_down = NULL; drag->cb.key_up = NULL; return drag; }
static Enna_File * _file_get(const char *uri) { Enna_File *f; char *path; if (strlen(uri) < 7) { path = malloc(2 * sizeof(char)); path[0] = '/'; path[1] = '\0'; } else { path = malloc((strlen(uri + 7) + 1) * sizeof(char)); strncpy(path, uri + 7, strlen(uri + 7) + 1); } if (!ecore_file_exists(path)) return NULL; if (ecore_file_is_dir(path)) { const char *file; const char *label; file = ecore_file_file_get(path); if (!file || file[0] == '\0') { label = eina_stringshare_add("Root"); f = enna_file_directory_add(label, "file:///", path, label, "icon/directory"); eina_stringshare_del(label); } else { f = enna_file_directory_add(file, uri, path, file, "icon/directory"); } } else f = enna_file_file_add(ecore_file_file_get(path), uri, path, ecore_file_file_get(path), "icon/file"); free(path); return f; }
Eina_Bool azy_content_deserialize_request_json(Azy_Content *content, const char *buf, ssize_t len EINA_UNUSED) { cJSON *object, *grab; int i; if ((!content) || (!buf)) return EINA_FALSE; if (!(object = cJSON_Parse(buf))) { azy_content_error_code_set(content, AZY_ERROR_REQUEST_JSON_OBJECT); return EINA_FALSE; } if ((grab = cJSON_GetObjectItem(object, "id"))) content->id = grab->valueint; if (!(grab = cJSON_GetObjectItem(object, "method"))) { azy_content_error_code_set(content, AZY_ERROR_REQUEST_JSON_METHOD); cJSON_Delete(object); return EINA_FALSE; } content->method = eina_stringshare_add(grab->valuestring); grab = cJSON_GetObjectItem(object, "params"); for (i = 0; grab && (i < cJSON_GetArraySize(grab)); i++) { Eina_Value *v; if (!(v = azy_value_deserialize_json(cJSON_GetArrayItem(grab, i)))) { azy_content_error_faultmsg_set(content, -1, "Can't parse JSON-RPC request. Failed to deserialize parameter %d.", i); cJSON_Delete(object); return EINA_FALSE; } content->params = eina_list_append(content->params, v); } cJSON_Delete(object); return EINA_TRUE; }
static void print_iter (DBusMessageIter *iter, int depth) { do { int type = dbus_message_iter_get_arg_type (iter); if (type == DBUS_TYPE_INVALID) break; char *val; dbus_message_iter_get_basic (iter, &val); e->value = eina_stringshare_add(val); } while (dbus_message_iter_next (iter)); }
/** * @internal * @return Returns no value * @brief Parses out the language, country and modifer setting from the * LC_MESSAGES environment variable */ static void efreet_parse_locale(void) { efreet_parsed_locale = 1; if (efreet_parse_locale_setting("LANG")) return; if (efreet_parse_locale_setting("LC_ALL")) return; if (efreet_parse_locale_setting("LC_MESSAGES")) return; efreet_language = eina_stringshare_add("C"); }
EAPI Eina_Stringshare * eeze_udev_syspath_get_parent_filtered(const char *syspath, const char *subsystem, const char *devtype) { _udev_device *device, *parent; Eina_Stringshare *ret = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(syspath, NULL); if (!(device = _new_device(syspath))) return NULL; parent = udev_device_get_parent_with_subsystem_devtype(device, subsystem, devtype); if (parent) ret = eina_stringshare_add(udev_device_get_syspath(parent)); udev_device_unref(device); return ret; }
static const char * ems_config_filename_default_get(void) { static const char *filename = NULL; char tmp[PATH_MAX]; if (filename) return filename; snprintf(tmp, sizeof(tmp), "%s/.config/enna-media-server/%s", getenv("HOME"), EMS_CONFIG_FILE); filename = eina_stringshare_add(tmp); DBG("CONFIG filename : %s", filename); return filename; }
Enna_Volumes_Listener * enna_volumes_listener_add(const char *name, EnnaVolumesFunc add, EnnaVolumesFunc rmv, void *data) { Enna_Volumes_Listener *vl; vl = ENNA_NEW(Enna_Volumes_Listener, 1); vl->name = eina_stringshare_add(name); vl->add = add; vl->remove = rmv; vl->data = data; enna_log(ENNA_MSG_EVENT, "volumes", "Add: %s listener", vl->name); enna_volumes_listeners = eina_list_append(enna_volumes_listeners, vl); return vl; }
EAPI const char * eeze_udev_syspath_get_parent(const char *syspath) { _udev_device *device, *parent; const char *ret; if (!syspath) return NULL; if (!(device = _new_device(syspath))) return NULL; parent = udev_device_get_parent(device); ret = eina_stringshare_add(udev_device_get_syspath(parent)); udev_device_unref(device); return ret; }
void theme_status_set(const char *txt, int type) { Exquisite_Text_Line *t = NULL; if(!txt || (txt[0] == 0) || !messages) return; t = (Exquisite_Text_Line *)(eina_list_last(messages)->data); t->status = type; if(t->status_text) eina_stringshare_del(t->status_text); t->status_text = eina_stringshare_add(txt); /*A 2 means that a status update signal will be sent*/ theme_update_text(2); }
static int _basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata) { Config_Item *ci; ci = cfd->data; ci->poll_time = cfdata->poll_time; if (ci->hostname) eina_stringshare_del (ci->hostname); ci->hostname = eina_stringshare_add (cfdata->hostname); ci->port = atoi (cfdata->port); ci->show_popup = cfdata->show_popup; e_config_save_queue (); _mpdule_config_updated (ci); return 1; }
const char* ewk_web_database_filename_get(Ewk_Web_Database* database) { #if ENABLE(SQL_DATABASE) if (database->filename) return database->filename; WebCore::SecurityOrigin* origin = database->securityOrigin.get(); WTF::String path = WebCore::DatabaseManager::manager().fullPathForDatabase(origin, database->coreName); database->filename = eina_stringshare_add(path.utf8().data()); return database->filename; #else UNUSED_PARAM(database); return 0; #endif }
const char* ewk_web_database_display_name_get(Ewk_Web_Database* database) { #if ENABLE(SQL_DATABASE) if (database->displayName) return database->displayName; WebCore::SecurityOrigin* origin = database->securityOrigin.get(); WebCore::DatabaseDetails details = WebCore::DatabaseManager::manager().detailsForNameAndOrigin(database->name, origin); database->displayName = eina_stringshare_add(details.displayName().utf8().data()); return database->displayName; #else UNUSED_PARAM(database); return 0; #endif }
E_API void * e_modapi_init(E_Module *m) { conf_module = m; e_configure_registry_category_add("windows", 50, _("Windows"), NULL, "preferences-system-windows"); e_configure_registry_item_add("windows/window_list", 70, _("Window Switcher"), NULL, "preferences-winlist", e_int_config_winlist); e_winlist_init(); _winlist_act = eina_stringshare_add("winlist"); /* add module supplied action */ _act_winlist = e_action_add(_winlist_act); if (_act_winlist) { _act_winlist->func.go = _e_mod_action_winlist_cb; _act_winlist->func.go_mouse = _e_mod_action_winlist_mouse_cb; _act_winlist->func.go_wheel = _e_mod_action_winlist_wheel_cb; _act_winlist->func.go_key = _e_mod_action_winlist_key_cb; _act_winlist->func.go_edge = _e_mod_action_winlist_edge_cb; _act_winlist->func.go_signal = _e_mod_action_winlist_signal_cb; _act_winlist->func.go_acpi = _e_mod_action_winlist_acpi_cb; e_action_predef_name_set(N_("Window : List"), N_("Next Window"), "winlist", "next", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Previous Window"), "winlist", "prev", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Next window of same class"), "winlist", "class-next", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Previous window of same class"), "winlist", "class-prev", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Next window class"), "winlist", "classes-next", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Previous window class"), "winlist", "classes-prev", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Window on the Left"), "winlist", "left", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Window Down"), "winlist", "down", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Window Up"), "winlist", "up", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Window on the Right"), "winlist", "right", NULL, 0); } e_module_delayed_set(m, 1); return m; }
static Evry_Item_App * _item_new(Plugin *p, const char *label, const char *id) { Evry_Item_App *app; app = EVRY_ITEM_NEW(Evry_Item_App, p, label, NULL, evry_item_app_free); EVRY_ACTN(app)->action = &_exec_open_file_action; EVRY_ACTN(app)->it1.type = EVRY_TYPE_FILE; EVRY_ITEM(app)->id = eina_stringshare_add(id); eina_hash_add(p->added, id, app); EVRY_ACTN(app)->remember_context = EINA_TRUE; EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION; return app; }
EAPI void efreet_icon_extension_add(const char *ext) { Eina_List *l; EINA_SAFETY_ON_NULL_RETURN(ext); ext = eina_stringshare_add(ext); if ((l = eina_list_data_find_list(efreet_icon_extensions, ext))) { efreet_icon_extensions = eina_list_promote_list(efreet_icon_extensions, l); eina_stringshare_del(ext); } else efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, ext); }
static void _eco_match_add(void *data, void *data2) { Eco_Option *match, *value; e_widget_ilist_append(o_matches, NULL, "class=XTerm", _eco_match_click_cb, NULL, NULL); match = eco_config_option_list_add(cfg_screen, "opacity_matches"); match->stringValue = eina_stringshare_add("class=XTerm"); value = eco_config_option_list_add(cfg_screen, "opacity_values"); value->intValue = 100; e_widget_slider_value_int_set(o_opacity, value->intValue); e_widget_disabled_set(o_opacity, 0); e_widget_ilist_selected_set(o_matches, e_widget_ilist_count(o_matches)); }
/** * Setup basic module. * * It is called when the module is enabled. * * @param m a pointer to your E_Module structure. * @return This becomes m->data, return NULL if this falied, and you won't get enabled. * @ingroup Emu_Module_Basic_Group */ EAPI void * e_modapi_init(E_Module *m) { char buf[4096]; emu_module = m; snprintf(buf, sizeof(buf), "%s/e-module-emu.edj", e_module_dir_get(m)); _emu_module_edje = eina_stringshare_add(buf); /* Set up module's message catalogue */ snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m)); bindtextdomain(PACKAGE, buf); bind_textdomain_codeset(PACKAGE, "UTF-8"); e_gadcon_provider_register(&_gadcon_class); return m; }
EAPI const char * efreet_desktop_x_field_get(Efreet_Desktop *desktop, const char *key) { const char *ret; if (!desktop || strncmp(key, "X-", 2)) return NULL; if (!desktop->x) return NULL; ret = eina_hash_find(desktop->x, key); if (!ret) return NULL; return eina_stringshare_add(ret); }
static Elm_Calendar_Mark * _mark_new(Evas_Object *obj, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat) { Elm_Calendar_Mark *mark; mark = calloc(1, sizeof(Elm_Calendar_Mark)); if (!mark) return NULL; mark->obj = obj; mark->mark_type = eina_stringshare_add(mark_type); mark->mark_time = *mark_time; mark->repeat = repeat; return mark; }
EAPI Eina_Bool estate_transition_init(Estate_Transition *tr, const char *name, const Estate_State *from, const Estate_State *to, const Estate_Cb_Ctor *cb, const Estate_Cb_Ctor *st_enterer, const Estate_Cb_Ctor *st_exiter) { EINA_SAFETY_ON_NULL_RETURN_VAL(tr, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(from, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(to, EINA_FALSE); tr->name = eina_stringshare_add(name); tr->from = (Estate_State *)from; tr->to = (Estate_State *)to; /* Set transition callback */ if (cb) { tr->cb.func = cb->func; tr->cb.key = (cb->key) ? eina_stringshare_add_length(cb->key, cb->key_len) : NULL; } /* Set state enterer callback */ if (st_enterer) { tr->st_enterer.func = st_enterer->func; tr->st_enterer.key = (st_enterer->key) ? eina_stringshare_add_length(st_enterer->key, st_enterer->key_len) : NULL; tr->st_enterer.result = ESTATE_CB_OK; } /* Set state exiter callback */ if (st_exiter) { tr->st_exiter.func = st_exiter->func; tr->st_exiter.key = (st_exiter->key) ? eina_stringshare_add_length(st_exiter->key, st_enterer->key_len) : NULL; tr->st_exiter.result = ESTATE_CB_OK; } return EINA_TRUE; }
EAPI void * e_modapi_init(E_Module *m) { char buf[PATH_MAX]; bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); snprintf(buf, sizeof(buf), "%s/e-module-compiz.edj", m->dir); compiz_mod = E_NEW(Mod, 1); compiz_mod->module = m; compiz_mod->edje_file = eina_stringshare_add(buf); compiz_init(); return m; }
Ewk_Context_Menu_Item* ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Action action, Ewk_Context_Menu* submenu, const char* title, Eina_Bool checked, Eina_Bool enabled) { Ewk_Context_Menu_Item* item = (Ewk_Context_Menu_Item*) malloc(sizeof(*item)); if (!item) return 0; item->type = type; item->action = action; item->title = eina_stringshare_add(title); item->submenu = submenu; item->checked = checked; item->enabled = enabled; return item; }