summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-06-29 13:58:42 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-06-29 13:58:42 +0000
commit59ebbdeee0a29dc642777c391aceb823d162b478 (patch)
tree6aba29a24d4e3556d65635f59ca84429b1c50b50 /legacy/emotion/src/lib/emotion_smart.c
parent83711f3d95afc9883fe49911a670f9c195cb9eeb (diff)
emotion: use stringshare for file.
SVN revision: 60818
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 7cfe946d49..c9451d30de 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -1,6 +1,14 @@
1#include "emotion_private.h" 1#include "emotion_private.h"
2#include "Emotion.h" 2#include "Emotion.h"
3 3
4#ifdef HAVE_EIO
5# include <Eio.h>
6#else
7# ifdef HAVE_XATTR
8# include <sys/xattr.h>
9# endif
10#endif
11
4#define E_SMART_OBJ_GET(smart, o, type) \ 12#define E_SMART_OBJ_GET(smart, o, type) \
5 { \ 13 { \
6 char *_e_smart_str; \ 14 char *_e_smart_str; \
@@ -42,7 +50,7 @@ struct _Smart_Data
42 50
43 char *module_name; 51 char *module_name;
44 52
45 char *file; 53 const char *file;
46 Evas_Object *obj; 54 Evas_Object *obj;
47 double ratio; 55 double ratio;
48 double pos; 56 double pos;
@@ -69,6 +77,11 @@ struct _Smart_Data
69 int button; 77 int button;
70 } spu; 78 } spu;
71 79
80#ifdef HAVE_EIO
81 Eio_File *load_xattr;
82 Eio_File *save_xattr;
83#endif
84
72 Emotion_Module_Options module_options; 85 Emotion_Module_Options module_options;
73}; 86};
74 87
@@ -275,7 +288,7 @@ EAPI Eina_Bool
275emotion_object_init(Evas_Object *obj, const char *module_filename) 288emotion_object_init(Evas_Object *obj, const char *module_filename)
276{ 289{
277 Smart_Data *sd; 290 Smart_Data *sd;
278 char *file; 291 const char *file;
279 292
280 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 293 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
281 294
@@ -317,7 +330,7 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
317 if (file) 330 if (file)
318 { 331 {
319 emotion_object_file_set(obj, file); 332 emotion_object_file_set(obj, file);
320 free(file); 333 eina_stringshare_del(file);
321 } 334 }
322 335
323 return EINA_TRUE; 336 return EINA_TRUE;
@@ -333,13 +346,12 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
333 DBG("file=%s", file); 346 DBG("file=%s", file);
334 if (!sd->module) return EINA_FALSE; 347 if (!sd->module) return EINA_FALSE;
335 348
336 if ((file) && (sd->file) && (!strcmp(file, sd->file))) return EINA_FALSE; 349 if ((file) && (sd->file) && (file == sd->file || !strcmp(file, sd->file))) return EINA_FALSE;
337 if ((file) && (file[0] != 0)) 350 if ((file) && (file[0] != 0))
338 { 351 {
339 int w, h; 352 int w, h;
340 353
341 free(sd->file); 354 eina_stringshare_replace(&sd->file, file);
342 sd->file = strdup(file);
343 sd->module->file_close(sd->video); 355 sd->module->file_close(sd->video);
344 evas_object_image_data_set(sd->obj, NULL); 356 evas_object_image_data_set(sd->obj, NULL);
345 evas_object_image_size_set(sd->obj, 1, 1); 357 evas_object_image_size_set(sd->obj, 1, 1);
@@ -361,8 +373,7 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
361 evas_object_image_size_set(sd->obj, 1, 1); 373 evas_object_image_size_set(sd->obj, 1, 1);
362 _emotion_image_data_zero(sd->obj); 374 _emotion_image_data_zero(sd->obj);
363 } 375 }
364 free(sd->file); 376 eina_stringshare_replace(&sd->file, NULL);
365 sd->file = NULL;
366 } 377 }
367 378
368 return EINA_TRUE; 379 return EINA_TRUE;
@@ -1597,7 +1608,7 @@ _smart_del(Evas_Object * obj)
1597 if (sd->video) sd->module->file_close(sd->video); 1608 if (sd->video) sd->module->file_close(sd->video);
1598 _emotion_module_close(sd->module, sd->video); 1609 _emotion_module_close(sd->module, sd->video);
1599 evas_object_del(sd->obj); 1610 evas_object_del(sd->obj);
1600 free(sd->file); 1611 eina_stringshare_del(sd->file);
1601 free(sd->module_name); 1612 free(sd->module_name);
1602 if (sd->job) ecore_job_del(sd->job); 1613 if (sd->job) ecore_job_del(sd->job);
1603 free(sd->progress.info); 1614 free(sd->progress.info);