diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2011-09-20 09:40:55 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2011-09-20 09:40:55 +0000 |
commit | d3345a5d754d0aa9494ce51a0e6bc333b6096ff1 (patch) | |
tree | 5a41a1ea53843ff7225afffde3486e52699c2268 /legacy/emotion/src/lib/emotion_smart.c | |
parent | 5f68e376b2e9bb566cd1f9b2f36df89a934e9a4b (diff) |
emotion: remove use of xattr.
SVN revision: 63495
Diffstat (limited to '')
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 61 |
1 files changed, 17 insertions, 44 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 8205af51b4..161f467c46 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -4,11 +4,6 @@ | |||
4 | #ifdef HAVE_EIO | 4 | #ifdef HAVE_EIO |
5 | # include <math.h> | 5 | # include <math.h> |
6 | # include <Eio.h> | 6 | # include <Eio.h> |
7 | #else | ||
8 | # ifdef HAVE_XATTR | ||
9 | # include <math.h> | ||
10 | # include <sys/xattr.h> | ||
11 | # endif | ||
12 | #endif | 7 | #endif |
13 | 8 | ||
14 | #define E_SMART_OBJ_GET(smart, o, type) \ | 9 | #define E_SMART_OBJ_GET(smart, o, type) \ |
@@ -1272,19 +1267,11 @@ _eio_load_xattr_cleanup(Smart_Data *sd, Eio_File *handler) | |||
1272 | } | 1267 | } |
1273 | 1268 | ||
1274 | static void | 1269 | static void |
1275 | _eio_load_xattr_done(void *data, Eio_File *handler, const char *xattr_data, unsigned int xattr_size) | 1270 | _eio_load_xattr_done(void *data, Eio_File *handler, double xattr_double) |
1276 | { | 1271 | { |
1277 | Smart_Data *sd = data; | 1272 | Smart_Data *sd = data; |
1278 | 1273 | ||
1279 | if (xattr_size < 128 && xattr_data[xattr_size - 1] == '\0') | 1274 | emotion_object_position_set(evas_object_smart_parent_get(sd->obj), xattr_double); |
1280 | { | ||
1281 | long long int m = 0; | ||
1282 | long int e = 0; | ||
1283 | |||
1284 | eina_convert_atod(xattr_data, xattr_size, &m, &e); | ||
1285 | emotion_object_position_set(evas_object_smart_parent_get(sd->obj), ldexp((double)m, e)); | ||
1286 | } | ||
1287 | |||
1288 | _eio_load_xattr_cleanup(sd, handler); | 1275 | _eio_load_xattr_cleanup(sd, handler); |
1289 | } | 1276 | } |
1290 | 1277 | ||
@@ -1302,6 +1289,9 @@ emotion_object_last_position_load(Evas_Object *obj) | |||
1302 | { | 1289 | { |
1303 | Smart_Data *sd; | 1290 | Smart_Data *sd; |
1304 | const char *tmp; | 1291 | const char *tmp; |
1292 | #ifndef HAVE_EIO | ||
1293 | double xattr; | ||
1294 | #endif | ||
1305 | 1295 | ||
1306 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); | 1296 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); |
1307 | if (!sd->file) return ; | 1297 | if (!sd->file) return ; |
@@ -1318,27 +1308,16 @@ emotion_object_last_position_load(Evas_Object *obj) | |||
1318 | 1308 | ||
1319 | EINA_REFCOUNT_REF(sd); | 1309 | EINA_REFCOUNT_REF(sd); |
1320 | 1310 | ||
1321 | sd->load_xattr = eio_file_xattr_get(tmp, | 1311 | sd->load_xattr = eio_file_xattr_double_get(tmp, |
1322 | "user.e.time_seek", | 1312 | "user.e.time_seek", |
1323 | _eio_load_xattr_done, | 1313 | _eio_load_xattr_done, |
1324 | _eio_load_xattr_error, | 1314 | _eio_load_xattr_error, |
1325 | sd); | 1315 | sd); |
1326 | #else | 1316 | #else |
1327 | # ifdef HAVE_XATTR | 1317 | if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr)) |
1328 | { | 1318 | { |
1329 | char double_to_string[128]; | 1319 | emotion_object_position_set(obj, xattr); |
1330 | ssize_t sz; | 1320 | } |
1331 | long long int m = 0; | ||
1332 | long int e = 0; | ||
1333 | |||
1334 | sz = getxattr(tmp, "user.e.time_seek", double_to_string, 128); | ||
1335 | if (sz <= 0 || sz > 128 || double_to_string[sz] != '\0') | ||
1336 | return ; | ||
1337 | |||
1338 | eina_convert_atod(double_to_string, 128, &m, &e); | ||
1339 | emotion_object_position_set(obj, ldexp((double)m, e)); | ||
1340 | } | ||
1341 | # endif | ||
1342 | #endif | 1321 | #endif |
1343 | } | 1322 | } |
1344 | 1323 | ||
@@ -1359,7 +1338,6 @@ emotion_object_last_position_save(Evas_Object *obj) | |||
1359 | { | 1338 | { |
1360 | Smart_Data *sd; | 1339 | Smart_Data *sd; |
1361 | const char *tmp; | 1340 | const char *tmp; |
1362 | char double_to_string[128]; | ||
1363 | 1341 | ||
1364 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); | 1342 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); |
1365 | if (!sd->file) return ; | 1343 | if (!sd->file) return ; |
@@ -1371,16 +1349,11 @@ emotion_object_last_position_save(Evas_Object *obj) | |||
1371 | else | 1349 | else |
1372 | return ; | 1350 | return ; |
1373 | 1351 | ||
1374 | eina_convert_dtoa(emotion_object_position_get(obj), double_to_string); | ||
1375 | |||
1376 | #ifdef HAVE_EIO | 1352 | #ifdef HAVE_EIO |
1377 | eio_file_xattr_set(tmp, "user.e.time_seek", | 1353 | eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0, |
1378 | double_to_string, strlen(double_to_string) + 1, 0, | 1354 | _eio_save_xattr_done, _eio_save_xattr_error, sd); |
1379 | _eio_save_xattr_done, _eio_save_xattr_error, sd); | ||
1380 | #else | 1355 | #else |
1381 | # ifdef HAVE_XATTR | 1356 | eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0); |
1382 | setxattr(tmp, "user.e.time_seek", double_to_string, strlen(double_to_string), 0); | ||
1383 | # endif | ||
1384 | #endif | 1357 | #endif |
1385 | } | 1358 | } |
1386 | 1359 | ||